func()

in auth/provider_config.go [287:319]


func (config *OIDCProviderConfigToUpdate) buildRequest() (nestedMap, error) {
	if len(config.params) == 0 {
		return nil, errors.New("no parameters specified in the update request")
	}

	if val, ok := config.params.GetString(clientIDKey); ok && val == "" {
		return nil, errors.New("ClientID must not be empty")
	}

	if val, ok := config.params.GetString(issuerKey); ok {
		if val == "" {
			return nil, errors.New("Issuer must not be empty")
		}
		if _, err := url.ParseRequestURI(val); err != nil {
			return nil, fmt.Errorf("failed to parse Issuer: %v", err)
		}
	}

	if val, ok := config.params.Get(codeResponseTypeKey); ok && val.(bool) {
		if val, ok := config.params.GetString(clientSecretKey); !ok || val == "" {
			return nil, errors.New("Client Secret must not be empty for Code Response Type")
		}
		if val, ok := config.params.Get(idTokenResponseTypeKey); ok && val.(bool) {
			return nil, errors.New("Only one response type may be chosen")
		}
	} else if ok && !val.(bool) {
		if val, ok := config.params.Get(idTokenResponseTypeKey); ok && !val.(bool) {
			return nil, errors.New("At least one response type must be returned")
		}
	}

	return config.params, nil
}