Добавлен основные классы для сервиса авторизаци

This commit is contained in:
Ганеев Артем
2025-10-28 20:49:54 +03:00
parent def3552a67
commit 736b8031f8
26 changed files with 904 additions and 40 deletions

22
internal/config/token.go Normal file
View 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)
}