Suppress Compiler Warnings

This commit is contained in:
Josh Cummings 2021-01-08 11:30:28 -07:00
parent 8cefc8a792
commit 6499a235b0
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
2 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,7 @@ public interface OAuth2AuthenticatedPrincipal extends AuthenticatedPrincipal {
* @return the attribute or {@code null} otherwise
*/
@Nullable
@SuppressWarnings("unchecked")
default <A> A getAttribute(String name) {
return (A) getAttributes().get(name);
}

View File

@ -118,9 +118,14 @@ public final class JwtGrantedAuthoritiesConverter implements Converter<Jwt, Coll
return Collections.emptyList();
}
if (authorities instanceof Collection) {
return (Collection<String>) authorities;
return castAuthoritiesToCollection(authorities);
}
return Collections.emptyList();
}
@SuppressWarnings("unchecked")
private Collection<String> castAuthoritiesToCollection(Object authorities) {
return (Collection<String>) authorities;
}
}