Merge branch 'ICU-1369-oidc-status-change' of github.com:hashicorp/boundary-ui into ICU-1369-oidc-status-change

This commit is contained in:
Susmitha Girumala committed 2021-06-02 14:06:06 -04:00
commit 8098beb450
3 files changed
+33 -2

No files matched your search

+26 -1
View File
@@ -1,6 +1,6 @@
import Ember from 'ember';
import config from '../config/environment';
import { authHandler, deauthHandler } from './route-handlers/auth';
import { deauthHandler } from './route-handlers/auth';
import { pickRandomStatusString } from './factories/session';
import { Response } from 'miragejs';
import initializeMockIPC from './scenarios/ipc';
@@ -71,6 +71,31 @@ export default function () {
}
return new Response(202);
});
this.post('/auth-methods/:idMethod', function (schema, request) {
const idMethod = request.params.idMethod;
const id = idMethod.split(':')[0];
const method = idMethod.split(':')[1];
if (method === 'authenticate') {
schema.authHandler.call(this, schema, request);
return;
}
const attrs = this.normalizedRequestAttrs();
const authMethods = schema.authMethods;
const authMethod = authMethods.find(id);
let updatedAttrs = {};
if (method === 'change-state') {
updatedAttrs = {
attributes: {
state: attrs.attributes.state,
},
};
}
return authMethod.update(updatedAttrs);
});
// Auth Method Accounts
this.get(
+6
View File
@@ -1,3 +1,5 @@
import { authHandler } from '../route-handlers/auth';
export default function (server) {
// Scope resources
@@ -50,4 +52,8 @@ export default function (server) {
server.createList('target', 2, { scope }, 'withRandomHostSets');
server.createList('session', 4, { scope }, 'withAssociations');
});
// Authenticate route handler
// TODO: Better way to pass-in auth handler
server.schema.authHandler = authHandler;
}
@@ -67,4 +67,4 @@
>
{{t 'resources.auth-method.actions.delete'}}
</dropdown.button>
</Rose::Dropdown>
</Rose::Dropdown>