Skip to content

Commit 6499a23

Browse files
committed
Suppress Compiler Warnings
1 parent 8cefc8a commit 6499a23

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticatedPrincipal.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public interface OAuth2AuthenticatedPrincipal extends AuthenticatedPrincipal {
3939
* @return the attribute or {@code null} otherwise
4040
*/
4141
@Nullable
42+
@SuppressWarnings("unchecked")
4243
default <A> A getAttribute(String name) {
4344
return (A) getAttributes().get(name);
4445
}

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtGrantedAuthoritiesConverter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,14 @@ private Collection<String> getAuthorities(Jwt jwt) {
118118
return Collections.emptyList();
119119
}
120120
if (authorities instanceof Collection) {
121-
return (Collection<String>) authorities;
121+
return castAuthoritiesToCollection(authorities);
122122
}
123123
return Collections.emptyList();
124124
}
125125

126+
@SuppressWarnings("unchecked")
127+
private Collection<String> castAuthoritiesToCollection(Object authorities) {
128+
return (Collection<String>) authorities;
129+
}
130+
126131
}

0 commit comments

Comments
 (0)