Class HerodotusJwtGrantedAuthoritiesConverter
java.lang.Object
cn.herodotus.engine.oauth2.authorization.converter.HerodotusJwtGrantedAuthoritiesConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>>
public class HerodotusJwtGrantedAuthoritiesConverter
extends Object
implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>>
Description: Jwt 权限数据转换器
- Author:
- : gengwei.zheng
- Date:
- : 2022/3/13 14:21
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCollection<org.springframework.security.core.GrantedAuthority>convert(org.springframework.security.oauth2.jwt.Jwt jwt) ExtractGrantedAuthoritys from the givenJwt.voidsetAuthoritiesClaimName(String authoritiesClaimName) Sets the name of token claim to use for mappingauthoritiesby this converter.voidsetAuthorityPrefix(String authorityPrefix) Sets the prefix to use forauthoritiesmapped by this converter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
HerodotusJwtGrantedAuthoritiesConverter
public HerodotusJwtGrantedAuthoritiesConverter()
-
-
Method Details
-
convert
public Collection<org.springframework.security.core.GrantedAuthority> convert(org.springframework.security.oauth2.jwt.Jwt jwt) ExtractGrantedAuthoritys from the givenJwt.- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>> - Parameters:
jwt- TheJwttoken- Returns:
- The
authoritiesread from the token scopes
-
setAuthorityPrefix
Sets the prefix to use forauthoritiesmapped by this converter. Defaults to- Parameters:
authorityPrefix- The authority prefix- Since:
- 5.2
-
setAuthoritiesClaimName
Sets the name of token claim to use for mappingauthoritiesby this converter. Defaults to- Parameters:
authoritiesClaimName- The token claim name to map authorities- Since:
- 5.2
-