feat(jwt): add helpers2`
This commit is contained in:
parent
e21bf927b5
commit
fc53e1f0e2
8
jwt.go
8
jwt.go
@ -15,6 +15,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
AccessType = "access"
|
AccessType = "access"
|
||||||
RefreshType = "refresh"
|
RefreshType = "refresh"
|
||||||
|
|
||||||
|
TFAStep = "tfa"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateRefreshTokenByAccess(accessClaims JWT, ttl time.Duration) JWT {
|
func CreateRefreshTokenByAccess(accessClaims JWT, ttl time.Duration) JWT {
|
||||||
@ -75,8 +77,8 @@ func (j *JWT) WithAuthorizationInfo(tai TokenAuthorizationInfo, secret string) *
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *JWT) WithTFAStep(tai TokenAuthorizationInfo, secret string) *JWT {
|
func (j *JWT) WithTFAStep() *JWT {
|
||||||
j.Step = "tfa"
|
j.Step = TFAStep
|
||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +96,7 @@ func (j *JWT) IsRefreshToken() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (j *JWT) IsTFAStep() bool {
|
func (j *JWT) IsTFAStep() bool {
|
||||||
return j.Step == "tfa"
|
return j.Step == TFAStep
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *JWT) CheckAccess() bool {
|
func (j *JWT) CheckAccess() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user