vault/ui/app/helpers/supported-auth-backends.js
Austin Gebauer 21bd134ad2
ui: adds a new auth form option (#22640)
* ui: adds a new auth form option

* add warning if nonsecure context, cleanup

* more ember-y

* Only show saml auth method for enterprise, plus tests

* Use error message helper

* Dont include saml on community auth list

* Add allSupportedAuthBackends method

* change token request from GET to PUT to match backend change

* Fetch role on sign in, cancel login after timeout

* saml acceptance test

* Add changelog

* saml test only on enterprise

* set the acs_url according to which cluster the UI is served from

* prepare namespace in addition to path with a helper func

---------

Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
2023-09-08 08:53:26 -07:00

95 lines
2.4 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { helper as buildHelper } from '@ember/component/helper';
const SUPPORTED_AUTH_BACKENDS = [
{
type: 'token',
typeDisplay: 'Token',
description: 'Token authentication.',
tokenPath: 'id',
displayNamePath: 'display_name',
formAttributes: ['token'],
},
{
type: 'userpass',
typeDisplay: 'Username',
description: 'A simple username and password backend.',
tokenPath: 'client_token',
displayNamePath: 'metadata.username',
formAttributes: ['username', 'password'],
},
{
type: 'ldap',
typeDisplay: 'LDAP',
description: 'LDAP authentication.',
tokenPath: 'client_token',
displayNamePath: 'metadata.username',
formAttributes: ['username', 'password'],
},
{
type: 'okta',
typeDisplay: 'Okta',
description: 'Authenticate with your Okta username and password.',
tokenPath: 'client_token',
displayNamePath: 'metadata.username',
formAttributes: ['username', 'password'],
},
{
type: 'jwt',
typeDisplay: 'JWT',
description: 'Authenticate using JWT or OIDC provider.',
tokenPath: 'client_token',
displayNamePath: 'display_name',
formAttributes: ['role', 'jwt'],
},
{
type: 'oidc',
typeDisplay: 'OIDC',
description: 'Authenticate using JWT or OIDC provider.',
tokenPath: 'client_token',
displayNamePath: 'display_name',
formAttributes: ['role', 'jwt'],
},
{
type: 'radius',
typeDisplay: 'RADIUS',
description: 'Authenticate with your RADIUS username and password.',
tokenPath: 'client_token',
displayNamePath: 'metadata.username',
formAttributes: ['username', 'password'],
},
{
type: 'github',
typeDisplay: 'GitHub',
description: 'GitHub authentication.',
tokenPath: 'client_token',
displayNamePath: ['metadata.org', 'metadata.username'],
formAttributes: ['token'],
},
];
const ENTERPRISE_AUTH_METHODS = [
{
type: 'saml',
typeDisplay: 'SAML',
description: 'Authenticate using SAML provider.',
tokenPath: 'client_token',
displayNamePath: 'display_name',
formAttributes: ['role'],
},
];
export function supportedAuthBackends() {
return SUPPORTED_AUTH_BACKENDS;
}
export function allSupportedAuthBackends() {
return [...SUPPORTED_AUTH_BACKENDS, ...ENTERPRISE_AUTH_METHODS];
}
export default buildHelper(supportedAuthBackends);