Добавлен основные классы для сервиса авторизаци
This commit is contained in:
22
internal/config/token.go
Normal file
22
internal/config/token.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
import "time"
|
||||
|
||||
type TokenConfig struct {
|
||||
AccessToken TokenSettings `yaml:"accessToken" json:"accessToken"`
|
||||
RefreshToken TokenSettings `yaml:"refreshToken" json:"refreshToken"`
|
||||
}
|
||||
|
||||
type TokenSettings struct {
|
||||
TTLInMinutes int `yaml:"TTL-in-min" json:"TTL-in-min"`
|
||||
SecretWord string `yaml:"secretWord" json:"secretWord"`
|
||||
}
|
||||
|
||||
// Методы для удобства
|
||||
func (t *TokenSettings) GetTTL() time.Duration {
|
||||
return time.Duration(t.TTLInMinutes) * time.Minute
|
||||
}
|
||||
|
||||
func (t *TokenSettings) GetSecretBytes() []byte {
|
||||
return []byte(t.SecretWord)
|
||||
}
|
||||
Reference in New Issue
Block a user