-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
29 lines (26 loc) · 839 Bytes
/
config.go
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
package auth
type Config struct {
JWTPrivateKey []byte `json:"jwtPrivateKey,omitempty"`
// expires in seconds. Defaults to 5 minutes.
TokenExpiresIn int64 `json:"expiresIn,omitempty"`
Issuer string `json:"issuer,omitempty"`
JWTCookieName string `json:"cookieName,omitempty"`
// max allowed time in seconds, for which an expired token may be renewed. Defaults to one month
MaxRenewalTime int `json:"maxRenewalTime,omitempty"`
}
/**
Default values used:
JWTCookieName: "JWT",
TokenExpiresIn: 900,
Issuer: "AuthServer",
MaxRenewalTime: 2592000,
*/
func DefaultAuthConfig(privateKey []byte) Config {
return Config{
JWTCookieName: "JWT",
TokenExpiresIn: 300, //5 minutes in seconds
Issuer: "AuthServer",
JWTPrivateKey: privateKey,
MaxRenewalTime: 2592000, //one month in seconds
}
}