1
0
mirror of synced 2026-08-04 01:07:02 +00:00

Suppress Compiler Warnings

This commit is contained in:
Josh Cummings
2021-01-08 11:30:28 -07:00
parent 8cefc8a792
commit 6499a235b0
2 changed files with 7 additions and 1 deletions
@@ -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);
}
@@ -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;
}
}