@@ -30,17 +30,6 @@ type (
|
||||
SAML samlConfig `json:"saml"`
|
||||
}
|
||||
|
||||
trustAuthConfig struct {
|
||||
CookieName string `json:"cookie-name"`
|
||||
CookieDomain string `json:"cookie-domain"`
|
||||
CookieDuration int `json:"cookie-duration"`
|
||||
TokenDuration int `json:"token-duration"`
|
||||
ReportURLDuration int `json:"report-url-duration"`
|
||||
TokenSecret string `json:"token-secret"`
|
||||
Scope string `json:"scope"`
|
||||
TokenType string `json:"token-type"`
|
||||
}
|
||||
|
||||
cookieConfig struct {
|
||||
Domain string `json:"domain"`
|
||||
Secret string `json:"secret"`
|
||||
@@ -92,22 +81,3 @@ func (c authConfig) GetCookieSecretBytes() ([]byte, error) {
|
||||
|
||||
return []byte(c.Cookie.Secret), nil
|
||||
}
|
||||
|
||||
func (c trustAuthConfig) GetTokenSecretBytes() ([]byte, error) {
|
||||
if c.TokenSecret == "" {
|
||||
return nil, fmt.Errorf("token secret cannot be empty")
|
||||
}
|
||||
|
||||
if decoded, err := base64.StdEncoding.DecodeString(c.TokenSecret); err == nil {
|
||||
if len(decoded) < 32 {
|
||||
return nil, fmt.Errorf("decoded token secret must be at least 32 bytes long")
|
||||
}
|
||||
return decoded, nil
|
||||
}
|
||||
|
||||
if len(c.TokenSecret) < 32 {
|
||||
return nil, fmt.Errorf("token secret must be at least 32 bytes long")
|
||||
}
|
||||
|
||||
return []byte(c.TokenSecret), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user