0357790fb8
* fix default rendering of svg and allow plugins access to mount tune form * add auth-jwt component * add callback route, and allow it to be navigated to on load * add jwt as a supported auth method * use auth-jwt component and implement intial oidc flow * allow wrapping un-authed requests * pass redirect_url and properly redirect with the wrapped token * popup for login * center popup window and move to localStorage events for cross window communication because of IE11 * access window via a getter on the auth-form component * show OIDC provider name on the button * fetch default role on render of the auth-jwt component * simplify auth-form template * style callback page * refetch auth_url when path changes for auth-jwt component * fix glimmer error on alias metadata, and add back popup-metadata component * fix link in metadata page * add logo-edition component and remove use of partial for logo svg * render oidc callback template on the loading page if we're going there * add docs icon and change timeout on the auth form * move OIDC auth specific things to auth-jwt component * start to add branded buttons for OIDC providers * add google button * finish branded buttons * update glyph for error messages * update tests for auth screen not showing tabs, add adapter tests and new auth jwt tests * start auth-jwt tests * simplify auth-jwt * remove negative top margin on AlertInline * only preventDefault if there's an event * fill out tests * sort out some naming * feedback on templates and styles * clear error when starting OIDC auth and call for new auth_url * also allow 'oidc' as the auth method type * handle namespaces with OIDC auth * review feedback * use new getters in popup-metadata
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
import { DOMAIN_STRINGS, PROVIDER_WITH_LOGO } from 'vault/models/role-jwt';
|
|
|
|
module('Unit | Model | role-jwt', function(hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('it exists', function(assert) {
|
|
let model = this.owner.lookup('service:store').createRecord('role-jwt');
|
|
assert.ok(!!model);
|
|
assert.equal(model.providerName, null, 'no providerName');
|
|
assert.equal(model.providerButtonComponent, null, 'no providerButtonComponent');
|
|
});
|
|
|
|
test('it computes providerName when known provider url match fails', function(assert) {
|
|
let model = this.owner.lookup('service:store').createRecord('role-jwt', {
|
|
authUrl: 'http://example.com',
|
|
});
|
|
|
|
assert.equal(model.providerName, null, 'no providerName');
|
|
assert.equal(model.providerButtonComponent, null, 'no providerButtonComponent');
|
|
});
|
|
|
|
test('it provides a providerName for listed known providers', function(assert) {
|
|
Object.keys(DOMAIN_STRINGS).forEach(domainPart => {
|
|
let model = this.owner.lookup('service:store').createRecord('role-jwt', {
|
|
authUrl: `http://provider-${domainPart}.com`,
|
|
});
|
|
|
|
let expectedName = DOMAIN_STRINGS[domainPart];
|
|
assert.equal(model.providerName, expectedName, `computes providerName: ${expectedName}`);
|
|
if (PROVIDER_WITH_LOGO.includes(expectedName)) {
|
|
assert.equal(
|
|
model.providerButtonComponent,
|
|
`auth-button-${domainPart}`,
|
|
`computes providerButtonComponent: ${domainPart}`
|
|
);
|
|
} else {
|
|
assert.equal(model.providerButtonComponent, null, `computes providerButtonComponent: ${domainPart}`);
|
|
}
|
|
});
|
|
});
|
|
});
|