fix: 🐛 oidc retry not working for secure links in desktop ui (#2641)
* fix: 🐛 oidc retry not working for secure links in desktop ui
This commit is contained in:
1 parent
1cbf3b227e
commit
f7f1041daa
6 files changed
+60
-14
No files matched your search
@@ -3,21 +3,34 @@
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import Controller from '@ember/controller';
|
||||
import Controller, { inject as controller } from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class ScopesScopeAuthenticateMethodOidcController extends Controller {
|
||||
@controller('scopes/scope/authenticate/method/index') authenticateMethod;
|
||||
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
|
||||
// =attributes
|
||||
// =actions
|
||||
|
||||
/**
|
||||
* Authentication URL for the pending OIDC flow, if any.
|
||||
* @type {?string}
|
||||
* Retry by starting a new OIDC authentication flow.
|
||||
* @param {object} e
|
||||
*/
|
||||
get authURL() {
|
||||
return this.session.data.pending.oidc.attributes.auth_url;
|
||||
@action
|
||||
async retryAuthentication(e) {
|
||||
// TODO: This event handler can be removed when rose dialog gets
|
||||
// refactored to use hds.
|
||||
e.preventDefault();
|
||||
|
||||
const scope = this.authMethod.scope;
|
||||
const authenticatorName = `authenticator:${this.authMethod.type}`;
|
||||
await this.authenticateMethod.startOIDCAuthentication(authenticatorName, {
|
||||
scope,
|
||||
authMethod: this.authMethod,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,16 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
|
||||
return oidc.attemptFetchToken({ scope, authMethod });
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the auth-method to the controller context.
|
||||
* @param {Controller} controller
|
||||
*/
|
||||
setupController(controller) {
|
||||
super.setupController(...arguments);
|
||||
const authMethod = this.modelFor('scopes.scope.authenticate.method');
|
||||
controller.authMethod = authMethod;
|
||||
}
|
||||
|
||||
@runEvery(POLL_TIMEOUT_SECONDS * 1000)
|
||||
poller() {
|
||||
this.refresh();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<p>{{t 'resources.auth-method.messages.pending.description'}}</p>
|
||||
<p>
|
||||
{{t 'resources.auth-method.questions.no-see-window'}}
|
||||
<a href={{this.authURL}} target='_blank' rel='noreferrer noopener'>
|
||||
<a href='#' {{on 'click' this.retryAuthentication}}>
|
||||
{{t 'actions.retry'}}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
Reference in new issue
Block a user