wip: OIDC authenticator
This commit is contained in:
9 files changed
+92
-1
No files matched your search
@@ -1,9 +1,17 @@
|
||||
import factory from '../generated/factories/auth-method';
|
||||
import { trait } from 'ember-cli-mirage';
|
||||
|
||||
const types = [
|
||||
'password',
|
||||
'oidc'
|
||||
];
|
||||
|
||||
export default factory.extend({
|
||||
id: (i) => `auth-method-id-${i}`,
|
||||
|
||||
// Cycle through available types
|
||||
type: (i) => types[i % types.length],
|
||||
|
||||
/**
|
||||
* Adds accounts (with associated users) to auth method.
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function(server) {
|
||||
}, 'withChildren')[0];
|
||||
|
||||
// Auth
|
||||
server.createList('auth-method', 1, { scope: globalScope }, 'withAccountsAndUsers');
|
||||
server.createList('auth-method', 2, { scope: globalScope }, 'withAccountsAndUsers');
|
||||
server.createList('auth-method', 3, { scope: orgScope }, 'withAccountsAndUsers');
|
||||
|
||||
// Groups and Users
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import BaseAuthenticator from './base';
|
||||
// import { resolve, reject } from 'rsvp';
|
||||
// import fetch from 'fetch';
|
||||
import { Promise } from 'rsvp';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default class OIDCAuthenticator extends BaseAuthenticator {
|
||||
|
||||
// =unimplemented methods
|
||||
// TODO: implement ;-)
|
||||
|
||||
buildAuthEndpointURL(/* {
|
||||
scope: { id: scopeID },
|
||||
authMethod: { id: authMethodID },
|
||||
} */) { }
|
||||
|
||||
async authenticate(
|
||||
creds,
|
||||
requestCookies = true,
|
||||
options
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
|
||||
module('Unit | Authenticator | OIDC', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import BaseOIDCAuthenticator from 'auth/authenticators/oidc';
|
||||
//import { inject as service } from '@ember/service';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default class OIDCAuthenticator extends BaseOIDCAuthenticator {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Rose::Form
|
||||
class="full-width"
|
||||
@onSubmit={{@submit}}
|
||||
@cancel={{false}}
|
||||
@disabled={{@disabled}}
|
||||
as |form|
|
||||
>
|
||||
|
||||
<form.actions
|
||||
@submitText={{t "actions.authenticate"}}
|
||||
@showCancel={{false}} />
|
||||
|
||||
</Rose::Form>
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'core/authenticators/oidc';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'core/components/form/authenticate/oidc';
|
||||
@@ -0,0 +1,26 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | form/authenticate/oidc', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function(assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Form::Authenticate::Oidc />`);
|
||||
|
||||
assert.equal(this.element.textContent.trim(), '');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Form::Authenticate::Oidc>
|
||||
template block text
|
||||
</Form::Authenticate::Oidc>
|
||||
`);
|
||||
|
||||
assert.equal(this.element.textContent.trim(), 'template block text');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user