all: add signout redirect url (#1324)

Fixes #1213
This commit is contained in:
Cuong Manh Le 2020-08-25 01:23:58 +07:00 committed by GitHub
parent 3d7206dc1e
commit 9de99d0211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 34 deletions

View file

@ -112,6 +112,9 @@ type Options struct {
// used for authentication requests and callbacks
AuthenticateURLString string `mapstructure:"authenticate_service_url" yaml:"authenticate_service_url,omitempty"`
AuthenticateURL *url.URL `yaml:"-,omitempty"`
// SignOutRedirectURL represents the url that user will be redirected to after signing out.
SignOutRedirectURLString string `mapstructure:"signout_redirect_url" yaml:"signout_redirect_url,omitempty"`
SignOutRedirectURL *url.URL `yaml:"-,omitempty"`
// AuthenticateCallbackPath is the path to the HTTP endpoint that will
// receive the response from your identity provider. The value must exactly
@ -539,6 +542,14 @@ func (o *Options) Validate() error {
o.AuthenticateURL = u
}
if o.SignOutRedirectURLString != "" {
u, err := urlutil.ParseAndValidateURL(o.SignOutRedirectURLString)
if err != nil {
return fmt.Errorf("config: bad signout-redirect-url %s : %w", o.SignOutRedirectURLString, err)
}
o.SignOutRedirectURL = u
}
if o.AuthorizeURLString != "" {
u, err := urlutil.ParseAndValidateURL(o.AuthorizeURLString)
if err != nil {