move jwt user and jwt authentication

This commit is contained in:
2025-08-12 15:09:07 +02:00
committed by swordsteel
parent e19e0e59bc
commit b070a22b0e
4 changed files with 9 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
package ltd.hlaeja.security.user
import org.springframework.security.core.Authentication
import org.springframework.security.core.GrantedAuthority
data class JwtAuthentication(
private val jwtUserDetails: JwtUserDetails,
private val token: String,
private var authorities: MutableCollection<out GrantedAuthority>,
private var authenticated: Boolean = false,
) : Authentication {
override fun getName(): String = "Bearer Token"
override fun getAuthorities(): MutableCollection<out GrantedAuthority> = authorities
override fun getCredentials(): Any = token
override fun getDetails(): Any? = null
override fun getPrincipal(): Any = jwtUserDetails
override fun isAuthenticated(): Boolean = authenticated
override fun setAuthenticated(isAuthenticated: Boolean) {
authenticated = isAuthenticated
}
}