github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/controllers/oidc-mock.js (about) 1 import Controller from '@ember/controller'; 2 import { action } from '@ember/object'; 3 import { inject as service } from '@ember/service'; 4 import Ember from 'ember'; 5 6 export default class OidcMockController extends Controller { 7 @service router; 8 9 queryParams = ['auth_method', 'client_nonce', 'redirect_uri', 'meta']; 10 11 @action 12 signIn(fakeAccount) { 13 const url = `${this.redirect_uri.split('?')[0]}?code=${ 14 fakeAccount.accessor 15 }&state=success`; 16 if (Ember.testing) { 17 this.router.transitionTo(url); 18 } else { 19 window.location = url; 20 } 21 } 22 23 @action 24 failToSignIn() { 25 const url = `${this.redirect_uri.split('?')[0]}?state=failure`; 26 if (Ember.testing) { 27 this.router.transitionTo(url); 28 } else { 29 window.location = url; 30 } 31 } 32 }