first commit
This commit is contained in:
29
pkg/auth/config.go
Normal file
29
pkg/auth/config.go
Normal file
@ -0,0 +1,29 @@
|
||||
package auth
|
||||
|
||||
import "time"
|
||||
|
||||
// Config authorization configuration parameters
|
||||
type Config struct {
|
||||
// access token expiration time, 0 means it doesn't expire
|
||||
AccessTokenExp time.Duration
|
||||
// refresh token expiration time, 0 means it doesn't expire
|
||||
RefreshTokenExp time.Duration
|
||||
// whether to generate the refreshing token
|
||||
IsGenerateRefresh bool
|
||||
}
|
||||
|
||||
// RefreshConfig refreshing token config
|
||||
type RefreshConfig struct {
|
||||
// whether to reset the refreshing creation time
|
||||
IsResetRefreshTime bool
|
||||
// whether to remove access token
|
||||
IsRemoveAccess bool
|
||||
// whether to remove refreshing token
|
||||
IsRemoveRefreshing bool
|
||||
}
|
||||
|
||||
// default configs
|
||||
var (
|
||||
DefaultAccessTokenCfg = &Config{AccessTokenExp: time.Hour * 24, RefreshTokenExp: time.Hour * 24 * 7, IsGenerateRefresh: true}
|
||||
DefaultRefreshTokenCfg = &RefreshConfig{IsResetRefreshTime: true, IsRemoveAccess: true, IsRemoveRefreshing: true}
|
||||
)
|
Reference in New Issue
Block a user