Skip to content

Commit 31af416

Browse files
committed
fix: Token validity
1 parent 08f0ec1 commit 31af416

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/kotlin/osahner/security/TokenProvider.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ class TokenProvider(
2020
private val userDetailsService: AppUserDetailsService,
2121
) {
2222
private var key: SecretKey? = null
23-
private var tokenValidity: Date? = null
2423

2524
@PostConstruct
2625
fun init() {
2726
key = Keys.hmacShaKeyFor(securityProperties.secret.toByteArray())
28-
tokenValidity = Date().add(Calendar.DAY_OF_MONTH, securityProperties.expirationTime)
2927
}
3028

3129
fun createToken(authentication: Authentication): String {
30+
val tokenValidity = Date().add(Calendar.DAY_OF_MONTH, securityProperties.expirationTime)
3231
val authClaims: MutableList<String> = mutableListOf()
3332
authentication.authorities?.let { authorities ->
3433
authorities.forEach { claim -> authClaims.add(claim.toString()) }

0 commit comments

Comments
 (0)