// Validate checks to see if configuration values are valid for the authenticate service.
// The checks do not modify the internal state of the Option structure. Returns
// on first error found.
Validate checks to see if configuration values are valid for the authenticate service.
The checks do not modify the internal state of the Option structure. Returns
on first error found.
// Validate checks to see if configuration values are valid for the authenticate service . // The checks do not modify the internal state of the Option structure . Returns // on first error found .
func (o *Options) Validate() error {
	if o.AuthenticateURL == nil {
		return errors.New("authenticate: 'AUTHENTICATE_SERVICE_URL' missing")
	}
	if o.ClientID == "" {
		return errors.New("authenticate: 'IDP_CLIENT_ID' missing")
	}
	if o.ClientSecret == "" {
		return errors.New("authenticate: 'IDP_CLIENT_SECRET' missing")
	}
	if o.SharedKey == "" {
		return errors.New("authenticate: 'SHARED_SECRET' missing")
	}
	decodedCookieSecret, err := base64.StdEncoding.DecodeString(o.CookieSecret)
	if err != nil {
		return fmt.Errorf("authenticate: 'COOKIE_SECRET' must be base64 encoded: %v", err)
	}
	if len(decodedCookieSecret) != 32 {
		return fmt.Errorf("authenticate: 'COOKIE_SECRET' should be 32; got %d", len(decodedCookieSecret))
	}
	return nil
}
func ( o * Options ) Validate ( ) error { if o . AuthenticateURL == nil { return errors . New ( " " ) } if o . ClientID == " " { return errors . New ( " " ) } if o . ClientSecret == " " { return errors . New ( " " ) } if o . SharedKey == " " { return errors . New ( " " ) } decodedCookieSecret , err := base64 . StdEncoding . DecodeString ( o . CookieSecret ) if err != nil { return fmt . Errorf ( " " , err ) } if len ( decodedCookieSecret ) != 32 { return fmt . Errorf ( " " , len ( decodedCookieSecret ) ) } return nil }
Validate checks to see if configuration values are valid for the authenticate service.
Validate checks to see if configuration values are valid for the authenticate service .