Package com.jangular.backend.service

# Class TokenService

java.lang.Object
com.jangular.backend.service.TokenService

@Service public class TokenService extends Object

## Constructor Summary

Constructors
Constructor
Description
`TokenService()`

## Method Summary

Modifier and Type
Method
Description
`String`
`generateAccessToken(String username)`
Generate access token with user information and roles
`String`
`generateRefreshToken(String username)`
Generate refresh token
`Date`
`getExpirationDateFromToken(String token)`
Get token expiration date
`Set<String>`
`getRolesFromToken(String token)`
Extract roles from token
`Long`
`getUserIdFromToken(String token)`
Extract user ID from token
`String`
`getUsernameFromToken(String token)`
Extract username from token
`boolean`
`isTokenExpired(String token)`
Check if token is expired
`boolean`
`validateToken(String token, org.springframework.security.core.userdetails.UserDetails userDetails)`
Validate token

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TokenService

public TokenService()

## Method Details

### generateAccessToken

public String generateAccessToken(String username)
Generate access token with user information and roles

### generateRefreshToken

public String generateRefreshToken(String username)
Generate refresh token

### validateToken

public boolean validateToken(String token, org.springframework.security.core.userdetails.UserDetails userDetails)
Validate token

### getUsernameFromToken

public String getUsernameFromToken(String token)
Extract username from token

### getUserIdFromToken

public Long getUserIdFromToken(String token)
Extract user ID from token

### getRolesFromToken

public Set<String> getRolesFromToken(String token)
Extract roles from token

### isTokenExpired

public boolean isTokenExpired(String token)
Check if token is expired

### getExpirationDateFromToken

public Date getExpirationDateFromToken(String token)
Get token expiration date