fix: 🐛 OIDC authentications not properly showing username (#2930)
* fix: 🐛 properly show username for oidc auth method in user menu * test: 💍 fix admin ui tests * test: 💍 fix desktop ui tests * refactor: 💡 admin to not store username in authenticated object * refactor: 💡 use getter in app controller * test: 💍 POC for how we could update our tests to use auth account * refactor: 💡 remove unused service * test: 💍 fix all tests in ui/admin * test: 💍 revert one change * refactor: 💡 update ui/desktop w/ feedback + fix tests * refactor: 💡 add in error handling * refactor: 💡 cleanup unused service * test: 💍 fix e2e test selector ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17231
This commit is contained in:
1 parent
838bc37243
commit
72f7c8a92d
195 files changed
+720
-1112
No files matched your search
+10
-13
@@ -9,7 +9,6 @@ import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
|
||||
|
||||
module(
|
||||
'Unit | Controller | scopes/scope/auth-methods/auth-method/accounts/index',
|
||||
@@ -36,24 +35,22 @@ module(
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({});
|
||||
intl = this.owner.lookup('service:intl');
|
||||
controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/auth-method/accounts/index',
|
||||
);
|
||||
store = this.owner.lookup('service:store');
|
||||
|
||||
instances.scopes.global = this.server.create('scope', {
|
||||
id: 'global',
|
||||
type: 'global',
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.global,
|
||||
type: TYPE_AUTH_METHOD_PASSWORD,
|
||||
});
|
||||
instances.account = this.server.create('account', {
|
||||
scope: instances.scopes.global,
|
||||
authMethod: instances.authMethod,
|
||||
instances.scopes.global = this.server.create(
|
||||
'scope',
|
||||
{ id: 'global' },
|
||||
'withGlobalAuth',
|
||||
);
|
||||
instances.authMethod = this.server.schema.authMethods.first();
|
||||
instances.account = this.server.schema.accounts.first();
|
||||
await authenticateSession({
|
||||
isGlobal: true,
|
||||
account_id: instances.account.id,
|
||||
});
|
||||
|
||||
getAccountCount = () => this.server.schema.accounts.all().models.length;
|
||||
|
||||
+8
-4
@@ -36,16 +36,20 @@ module(
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({});
|
||||
intl = this.owner.lookup('service:intl');
|
||||
controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/auth-method/managed-groups/index',
|
||||
);
|
||||
store = this.owner.lookup('service:store');
|
||||
|
||||
instances.scopes.global = this.server.create('scope', {
|
||||
id: 'global',
|
||||
type: 'global',
|
||||
instances.scopes.global = this.server.create(
|
||||
'scope',
|
||||
{ id: 'global' },
|
||||
'withGlobalAuth',
|
||||
);
|
||||
await authenticateSession({
|
||||
isGlobal: true,
|
||||
account_id: this.server.schema.accounts.first().id,
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.global,
|
||||
|
||||
@@ -29,7 +29,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
let getAuthMethodCount;
|
||||
|
||||
const instances = {
|
||||
scope: {
|
||||
scopes: {
|
||||
global: null,
|
||||
},
|
||||
authMethod: null,
|
||||
@@ -40,16 +40,21 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({});
|
||||
intl = this.owner.lookup('service:intl');
|
||||
store = this.owner.lookup('service:store');
|
||||
controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/index',
|
||||
);
|
||||
|
||||
instances.scope.global = this.server.create('scope', { id: 'global' });
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scope.global,
|
||||
instances.scopes.global = this.server.create(
|
||||
'scope',
|
||||
{ id: 'global' },
|
||||
'withGlobalAuth',
|
||||
);
|
||||
instances.authMethod = this.server.schema.authMethods.first();
|
||||
await authenticateSession({
|
||||
isGlobal: true,
|
||||
account_id: this.server.schema.accounts.first().id,
|
||||
});
|
||||
|
||||
urls.authMethods = '/scopes/global/auth-methods';
|
||||
@@ -148,7 +153,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
);
|
||||
|
||||
await controller.makePrimary(authMethod);
|
||||
const scope = await store.findRecord('scope', instances.scope.global.id);
|
||||
const scope = await store.findRecord('scope', instances.scopes.global.id);
|
||||
|
||||
assert.strictEqual(scope.primary_auth_method_id, instances.authMethod.id);
|
||||
});
|
||||
@@ -161,7 +166,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
);
|
||||
|
||||
await controller.removeAsPrimary(authMethod);
|
||||
const scope = await store.findRecord('scope', instances.scope.global.id);
|
||||
const scope = await store.findRecord('scope', instances.scopes.global.id);
|
||||
|
||||
assert.notOk(scope.primary_auth_method_id);
|
||||
});
|
||||
@@ -249,7 +254,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with create authorization', async function (assert) {
|
||||
instances.scope.global.authorized_collection_actions['auth-methods'] = [
|
||||
instances.scopes.global.authorized_collection_actions['auth-methods'] = [
|
||||
'create',
|
||||
];
|
||||
await visit(urls.authMethods);
|
||||
@@ -263,7 +268,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
});
|
||||
|
||||
test('messageDescription returns correct translation with no authorization', async function (assert) {
|
||||
instances.scope.global.authorized_collection_actions['auth-methods'] = [];
|
||||
instances.scopes.global.authorized_collection_actions['auth-methods'] = [];
|
||||
await visit(urls.authMethods);
|
||||
|
||||
assert.strictEqual(
|
||||
|
||||
Reference in new issue
Block a user