Files
threshold/api/authmethods/oidc_auth_method_attributes.gen.go
T
Elim Tsiagbey 8b8d2822df feat(oidc): OIDC Prompt (#4053)
Boundary OIDC method does not currently support passing in prompts during authentication. This change adds the capability of passing OIDC prompts. Prompts are optional OIDC parameters that determine the behaviour of the authentication server: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest

## Changes

- New `auth_oidc_prompt` table which contains all the prompts for OIDC auth method
- New `auth_oidc_prompt_enm` table which contains possible enum values for a prompt
  - Currently supported:
    - `none`: 
The Authorization Server MUST NOT display any authentication or consent user interface pages
    - `login`: The Authorization Server SHOULD prompt the End-User for reauthentication
    - `consent`: The Authorization Server SHOULD prompt the End-User for consent before returning information to the Client
    - `select_account`: The Authorization Server SHOULD prompt the End-User to select a user account
- `oidc_auth_method_with_value_obj` view has been updated to return `prompt` value
- Add `prompt` option for OIDC auth method CLI create and update
- Pass configured prompt during OIDC authentication
- Add `prompt` API validation for create and update
2023-11-21 11:30:02 -05:00

56 lines
2.2 KiB
Go

// Code generated by "make api"; DO NOT EDIT.
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package authmethods
import (
"fmt"
"github.com/mitchellh/mapstructure"
)
type OidcAuthMethodAttributes struct {
State string `json:"state,omitempty"`
Issuer string `json:"issuer,omitempty"`
ClientId string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
ClientSecretHmac string `json:"client_secret_hmac,omitempty"`
MaxAge uint32 `json:"max_age,omitempty"`
SigningAlgorithms []string `json:"signing_algorithms,omitempty"`
ApiUrlPrefix string `json:"api_url_prefix,omitempty"`
CallbackUrl string `json:"callback_url,omitempty"`
IdpCaCerts []string `json:"idp_ca_certs,omitempty"`
AllowedAudiences []string `json:"allowed_audiences,omitempty"`
ClaimsScopes []string `json:"claims_scopes,omitempty"`
AccountClaimMaps []string `json:"account_claim_maps,omitempty"`
DisableDiscoveredConfigValidation bool `json:"disable_discovered_config_validation,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Prompts []string `json:"prompts,omitempty"`
}
func AttributesMapToOidcAuthMethodAttributes(in map[string]interface{}) (*OidcAuthMethodAttributes, error) {
if in == nil {
return nil, fmt.Errorf("nil input map")
}
var out OidcAuthMethodAttributes
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
Result: &out,
TagName: "json",
})
if err != nil {
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
}
if err := dec.Decode(in); err != nil {
return nil, fmt.Errorf("error decoding: %w", err)
}
return &out, nil
}
func (pt *AuthMethod) GetOidcAuthMethodAttributes() (*OidcAuthMethodAttributes, error) {
if pt.Type != "oidc" {
return nil, fmt.Errorf("asked to fetch %s-type attributes but auth-method is of type %s", "oidc", pt.Type)
}
return AttributesMapToOidcAuthMethodAttributes(pt.Attributes)
}