2024-01-25 11:43:39 +00:00
|
|
|
package auth
|
2024-01-02 15:35:26 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
SignKey string `koanf:"sign_key"`
|
|
|
|
AccessExpirationTime time.Duration `koanf:"access_expiration_time"`
|
|
|
|
RefreshExpirationTime time.Duration `koanf:"refresh_expiration_time"`
|
|
|
|
AccessSubject string `koanf:"access_subject"`
|
|
|
|
RefreshSubject string `koanf:"refresh_subject"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Service struct {
|
2024-08-01 10:20:18 +00:00
|
|
|
Config Config
|
2024-01-02 15:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func New(cfg Config) Service {
|
|
|
|
return Service{
|
2024-08-01 10:20:18 +00:00
|
|
|
Config: cfg,
|
2024-01-02 15:35:26 +00:00
|
|
|
}
|
|
|
|
}
|