mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 aa94835a45
			
		
	
	aa94835a45
	
	
	
		
			
			* adds error handling to auth-jwt component for missing roles and fixes bug where role wasn't being retained when using alternate oidc mount path at login * fixes jwt login bug from auth mount tabs and adds test * updates okta-number-challenge success value to arg in template * adds changelog entry * fixes issues logging in manually with jwt * reverts mistaken change
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { module, test } from 'qunit';
 | |
| import { setupTest } from 'ember-qunit';
 | |
| import { settled } from '@ember/test-helpers';
 | |
| 
 | |
| module('Unit | Component | auth-form', function (hooks) {
 | |
|   setupTest(hooks);
 | |
| 
 | |
|   test('it should use token for oidc and jwt auth method types when processing form submit', async function (assert) {
 | |
|     assert.expect(4);
 | |
| 
 | |
|     const component = this.owner.lookup('component:auth-form');
 | |
|     component.reopen({
 | |
|       methods: [], // eslint-disable-line
 | |
|       // eslint-disable-next-line
 | |
|       authenticate: {
 | |
|         unlinked() {
 | |
|           return {
 | |
|             perform(type, data) {
 | |
|               assert.deepEqual(
 | |
|                 type,
 | |
|                 'token',
 | |
|                 `Token type correctly passed to authenticate method for ${component.providerName}`
 | |
|               );
 | |
|               assert.deepEqual(
 | |
|                 data,
 | |
|                 { token: component.token },
 | |
|                 `Token passed to authenticate method for ${component.providerName}`
 | |
|               );
 | |
|             },
 | |
|           };
 | |
|         },
 | |
|       },
 | |
|     });
 | |
| 
 | |
|     const event = new Event('submit');
 | |
| 
 | |
|     for (const type of ['oidc', 'jwt']) {
 | |
|       component.set('selectedAuth', type);
 | |
|       await settled();
 | |
|       await component.actions.doSubmit.apply(component, [undefined, event, 'foo-bar']);
 | |
|     }
 | |
|   });
 | |
| });
 |