cloud.hedou.abp.auth.AbpGrantedAuthoritiesConverter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abp-spring-boot-starter Show documentation
Show all versions of abp-spring-boot-starter Show documentation
When the functions of ABP cannot meet service requirements, the Spring Boot framework can be used to expand its own services to make use of abundant Java frameworks on the market.
package cloud.hedou.abp.auth
import cloud.hedou.abp.identity.RemoteIdentityService
import org.springframework.security.oauth2.jwt.Jwt
import org.springframework.core.convert.converter.Converter
import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.authority.SimpleGrantedAuthority
class AbpGrantedAuthoritiesConverter(
private val remoteIdentityService: RemoteIdentityService
) : Converter> {
override fun convert(source: Jwt): Collection {
return remoteIdentityService
.getGrantedAuthorities(source.tokenValue)
.map(::SimpleGrantedAuthority)
}
}