vault/ui/app/models/role-jwt.js
Vault Automation 0c6c13dd38
license: update headers to IBM Corp. (#10229) (#10233)
* license: update headers to IBM Corp.
* `make proto`
* update offset because source file changed

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2025-10-21 15:20:20 -06:00

44 lines
994 B
JavaScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import Model, { attr } from '@ember-data/model';
import parseURL from 'core/utils/parse-url';
const DOMAIN_STRINGS = {
'github.com': 'GitHub',
'gitlab.com': 'GitLab',
'google.com': 'Google',
'ping.com': 'Ping',
'okta.com': 'Okta',
'auth0.com': 'Auth0',
'login.microsoftonline.com': 'Azure',
};
const PROVIDER_WITH_LOGO = {
GitHub: 'github',
GitLab: 'gitlab',
Google: 'google',
Okta: 'okta',
Auth0: 'auth0',
Azure: 'azure',
};
export { DOMAIN_STRINGS, PROVIDER_WITH_LOGO };
export default class RoleJwtModel extends Model {
@attr('string') authUrl;
get providerName() {
const { hostname } = parseURL(this.authUrl);
const firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name));
return DOMAIN_STRINGS[firstMatch] || null;
}
get providerIcon() {
const { providerName } = this;
return PROVIDER_WITH_LOGO[providerName] || null;
}
}