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
This commit is contained in:
Elim Tsiagbey authored and GitHub committed 2023-11-21 11:30:02 -05:00
1 parent b6df5693b5
commit 8b8d2822df
31 files changed
+1668 -345

No files matched your search

@@ -33,6 +33,7 @@ type extraOidcCmdVars struct {
flagAccountClaimMaps []string
flagDisableDiscoveredConfigValidation bool
flagDryRun bool
flagPrompts []string
}
const (
@@ -50,6 +51,7 @@ const (
stateFlagName = "state"
disableDiscoveredConfigValidationFlagName = "disable-discovered-config-validation"
dryRunFlagName = "dry-run"
promptsFlagName = "prompts"
)
func extraOidcActionsFlagsMapFuncImpl() map[string][]string {
@@ -65,6 +67,7 @@ func extraOidcActionsFlagsMapFuncImpl() map[string][]string {
allowedAudienceFlagName,
claimsScopes,
accountClaimMaps,
promptsFlagName,
},
"change-state": {
idFlagName,
@@ -159,6 +162,12 @@ func extraOidcFlagsFuncImpl(c *OidcCommand, set *base.FlagSets, _ *base.FlagSet)
Target: &c.flagDryRun,
Usage: "Performs all completeness and validation checks with any newly-provided values without persisting the changes.",
})
case promptsFlagName:
f.StringSliceVar(&base.StringSliceVar{
Name: promptsFlagName,
Target: &c.flagPrompts,
Usage: "The optional prompt parameter that can be included in the authentication request to control the behavior of the authentication flow.",
})
}
}
}
@@ -283,6 +292,13 @@ func extraOidcFlagHandlingFuncImpl(c *OidcCommand, f *base.FlagSets, opts *[]aut
if c.flagDryRun {
*opts = append(*opts, authmethods.WithOidcAuthMethodDryRun(c.flagDryRun))
}
switch {
case len(c.flagPrompts) == 0:
case len(c.flagPrompts) == 1 && c.flagPrompts[0] == "null":
*opts = append(*opts, authmethods.DefaultOidcAuthMethodPrompts())
default:
*opts = append(*opts, authmethods.WithOidcAuthMethodPrompts(c.flagPrompts))
}
return true
}