feat(jwt): add helpers2`

This commit is contained in:
Sipachev Igor 2025-02-24 21:36:25 +07:00
parent e21bf927b5
commit fc53e1f0e2

8
jwt.go
View File

@ -15,6 +15,8 @@ import (
const (
AccessType = "access"
RefreshType = "refresh"
TFAStep = "tfa"
)
func CreateRefreshTokenByAccess(accessClaims JWT, ttl time.Duration) JWT {
@ -75,8 +77,8 @@ func (j *JWT) WithAuthorizationInfo(tai TokenAuthorizationInfo, secret string) *
return j
}
func (j *JWT) WithTFAStep(tai TokenAuthorizationInfo, secret string) *JWT {
j.Step = "tfa"
func (j *JWT) WithTFAStep() *JWT {
j.Step = TFAStep
return j
}
@ -94,7 +96,7 @@ func (j *JWT) IsRefreshToken() bool {
}
func (j *JWT) IsTFAStep() bool {
return j.Step == "tfa"
return j.Step == TFAStep
}
func (j *JWT) CheckAccess() bool {