2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-01 09:39:41 -06:00
|
|
|
*/
|
|
|
|
|
|
2020-11-13 17:10:56 -05:00
|
|
|
import Controller from '@ember/controller';
|
2025-03-12 08:29:54 -07:00
|
|
|
import { service } from '@ember/service';
|
2025-05-15 11:05:05 -07:00
|
|
|
import { action } from '@ember/object';
|
2020-11-13 17:10:56 -05:00
|
|
|
export default class ScopesScopeAuthenticateController extends Controller {
|
2020-11-25 16:42:28 -05:00
|
|
|
// =services
|
|
|
|
|
|
2022-07-27 10:25:01 -07:00
|
|
|
@service clusterUrl;
|
2025-04-18 12:42:18 -07:00
|
|
|
@service router;
|
2020-11-13 17:10:56 -05:00
|
|
|
// =attributes
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the global scope to index 0.
|
|
|
|
|
* @type {Array}
|
|
|
|
|
*/
|
|
|
|
|
get sortedScopes() {
|
|
|
|
|
return [
|
|
|
|
|
...this.model.scopes.filter((scope) => scope.id === 'global'),
|
|
|
|
|
...this.model.scopes.filter((scope) => scope.id !== 'global'),
|
2020-11-16 15:08:59 -05:00
|
|
|
];
|
2020-11-13 17:10:56 -05:00
|
|
|
}
|
2025-04-18 12:42:18 -07:00
|
|
|
|
2025-05-15 11:05:05 -07:00
|
|
|
// =actions
|
|
|
|
|
|
|
|
|
|
@action
|
|
|
|
|
selectScope(scope, callback) {
|
|
|
|
|
this.router.transitionTo('scopes.scope.authenticate', scope);
|
|
|
|
|
callback();
|
|
|
|
|
}
|
2025-04-18 12:42:18 -07:00
|
|
|
/**
|
|
|
|
|
* Checks if the current route is the OIDC method authentication route.
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
get isOIDCRoute() {
|
|
|
|
|
return (
|
|
|
|
|
this.router.currentRouteName === 'scopes.scope.authenticate.method.oidc'
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-11-13 17:10:56 -05:00
|
|
|
}
|