-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.go
More file actions
51 lines (46 loc) · 1.39 KB
/
common.go
File metadata and controls
51 lines (46 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package oidcsdk
import (
"github.com/go-jose/go-jose/v4"
"time"
)
type (
Config struct {
Issuer string
AuthCodeLifespan time.Duration
AccessTokenLifespan time.Duration
RefreshTokenLifespan time.Duration
AccessTokenEntropy int
AuthorizationCodeEntropy int
RefreshTokenEntropy int
StateParamMinimumEntropy int
GlobalConsentRequired bool
PKCEPlainEnabled bool
SupportedIDTokenAlgorithms []jose.SignatureAlgorithm
}
//IConfigurable interface {
// Configure(config *Config, arg ...interface{})
//}
IError interface {
error
GetStatus() string
GetReason() string
GetStatusCode() int
GetDescription() string
GetDebugInfo() string
}
ErrorFactory func(status uint8, code string, description string) IError
)
func NewConfig(issuer string) *Config {
config := &Config{Issuer: issuer}
config.StateParamMinimumEntropy = 20
config.RefreshTokenEntropy = 20
config.AccessTokenEntropy = 20
config.AuthorizationCodeEntropy = 20
config.AuthCodeLifespan = time.Minute * 10
config.AccessTokenLifespan = time.Minute * 60
config.RefreshTokenLifespan = time.Hour * 24 * 30
config.GlobalConsentRequired = true
config.PKCEPlainEnabled = true
config.SupportedIDTokenAlgorithms = []jose.SignatureAlgorithm{jose.RS256, jose.ES256, jose.ES384, jose.HS256, jose.HS384, jose.HS512, jose.RS384, jose.RS512}
return config
}