v2: fixed oauth errors, oauth clients native control added

This commit is contained in:
Ivan Rezchikov
2026-09-15 16:21:53 +03:00
parent 83e1849d73
commit 8b0a3d143b
51 changed files with 1392 additions and 3216 deletions
@@ -13,7 +13,7 @@ type Conf struct {
Postgres Postgres
Redis Redis
Client Client
JWT JWT
Tokens Tokens
}
type Server struct {
@@ -39,9 +39,12 @@ type Client struct {
Scopes []string `env:"CLIENT_SCOPES" envSeparator:"," envDefault:"profile:read,profile:edit,profile:consent:read,profile:consent:delete,auth:register"`
}
type JWT struct {
Secret string `env:"JWT_SECRET,required"`
TTL time.Duration `env:"JWT_TTL" envDefault:"24h"`
// Tokens holds the TTLs for opaque access/refresh tokens.
// NOTE: tokens issued by this service are opaque (random), not JWTs —
// this used to be a "JWT" config section with an unused JWT_SECRET var.
type Tokens struct {
AccessTTL time.Duration `env:"ACCESS_TOKEN_TTL" envDefault:"24h"`
RefreshTTL time.Duration `env:"REFRESH_TOKEN_TTL" envDefault:"168h"`
}
func New() (*Conf, error) {