mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-01-10 04:18:14 +02:00
bb5977095f
* Add option to remove tokens from cookie sessions * Move Minimal to be an option on CookieSession * Add sessionOptionsDefaults helper
33 lines
872 B
Go
33 lines
872 B
Go
package validation
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/oauth2-proxy/oauth2-proxy/pkg/apis/options"
|
|
)
|
|
|
|
func validateSessionCookieMinimal(o *options.Options) []string {
|
|
if !o.Session.Cookie.Minimal {
|
|
return []string{}
|
|
}
|
|
|
|
msgs := []string{}
|
|
if o.PassAuthorization {
|
|
msgs = append(msgs,
|
|
"pass_authorization_header requires oauth tokens in sessions. session_cookie_minimal cannot be set")
|
|
}
|
|
if o.SetAuthorization {
|
|
msgs = append(msgs,
|
|
"set_authorization_header requires oauth tokens in sessions. session_cookie_minimal cannot be set")
|
|
}
|
|
if o.PassAccessToken {
|
|
msgs = append(msgs,
|
|
"pass_access_token requires oauth tokens in sessions. session_cookie_minimal cannot be set")
|
|
}
|
|
if o.Cookie.Refresh != time.Duration(0) {
|
|
msgs = append(msgs,
|
|
"cookie_refresh > 0 requires oauth tokens in sessions. session_cookie_minimal cannot be set")
|
|
}
|
|
return msgs
|
|
}
|