@@ -46,131 +46,7 @@ module('Integration | Component | auth | page', function (hooks) {
46
46
await this . renderComponent ( ) ;
47
47
assert . dom ( AUTH_FORM . logo ) . exists ( ) ;
48
48
assert
49
- . dom ( GENERAL . messageError )
50
- . hasText ( 'Error Authentication failed: API Error here' , 'shows the error from the API' ) ;
51
- } ) ;
52
-
53
- test ( 'it calls auth service authenticate method with expected args' , async function ( assert ) {
54
- assert . expect ( 1 ) ;
55
- const authenticateStub = sinon . stub ( this . auth , 'authenticate' ) ;
56
- this . selectedAuth = 'foo/' ; // set to a non-default path
57
- this . server . get ( '/sys/internal/ui/mounts' , ( ) => {
58
- return {
59
- data : {
60
- auth : {
61
- 'foo/' : {
62
- type : 'userpass' ,
63
- } ,
64
- } ,
65
- } ,
66
- } ;
67
- } ) ;
68
-
69
- await this . renderComponent ( ) ;
70
- await fillIn ( AUTH_FORM . input ( 'username' ) , 'sandy' ) ;
71
- await fillIn ( AUTH_FORM . input ( 'password' ) , '1234' ) ;
72
- await click ( AUTH_FORM . login ) ;
73
- const [ actual ] = authenticateStub . lastCall . args ;
74
- const expectedArgs = {
75
- backend : 'userpass' ,
76
- clusterId : '1' ,
77
- data : {
78
- username : 'sandy' ,
79
- password : '1234' ,
80
- path : 'foo' ,
81
- } ,
82
- selectedAuth : 'foo/' ,
83
- } ;
84
- assert . propEqual (
85
- actual ,
86
- expectedArgs ,
87
- `it calls auth service authenticate method with expected args: ${ JSON . stringify ( actual ) } `
88
- ) ;
89
- } ) ;
90
-
91
- test ( 'it calls onSuccess with expected args' , async function ( assert ) {
92
- assert . expect ( 3 ) ;
93
- this . server . get ( `auth/token/lookup-self` , ( ) => {
94
- return {
95
- data : {
96
- policies : [ 'default' ] ,
97
- } ,
98
- } ;
99
- } ) ;
100
-
101
- await this . renderComponent ( ) ;
102
- await fillIn ( AUTH_FORM . input ( 'token' ) , 'mytoken' ) ;
103
- await click ( AUTH_FORM . login ) ;
104
- const [ authResponse , backendType , data ] = this . onSuccess . lastCall . args ;
105
- const expected = { isRoot : false , namespace : '' , token : 'vault-token☃1' } ;
106
-
107
- assert . propEqual (
108
- authResponse ,
109
- expected ,
110
- `it calls onSuccess with response: ${ JSON . stringify ( authResponse ) } `
111
- ) ;
112
- assert . strictEqual ( backendType , 'token' , `it calls onSuccess with backend type: ${ backendType } ` ) ;
113
- assert . propEqual ( data , { token : 'mytoken' } , `it calls onSuccess with data: ${ JSON . stringify ( data ) } ` ) ;
114
- } ) ;
115
-
116
- test ( 'it makes a request to unwrap if passed a wrappedToken and logs in' , async function ( assert ) {
117
- assert . expect ( 3 ) ;
118
- const authenticateStub = sinon . stub ( this . auth , 'authenticate' ) ;
119
- this . wrappedToken = '54321' ;
120
-
121
- this . server . post ( '/sys/wrapping/unwrap' , ( _ , req ) => {
122
- assert . strictEqual ( req . url , '/v1/sys/wrapping/unwrap' , 'makes call to unwrap the token' ) ;
123
- assert . strictEqual (
124
- req . requestHeaders [ 'x-vault-token' ] ,
125
- this . wrappedToken ,
126
- 'uses passed wrapped token for the unwrap'
127
- ) ;
128
- return {
129
- auth : {
130
- client_token : '12345' ,
131
- } ,
132
- } ;
133
- } ) ;
134
-
135
- await this . renderComponent ( ) ;
136
- later ( ( ) => cancelTimers ( ) , 50 ) ;
137
- await settled ( ) ;
138
- const [ actual ] = authenticateStub . lastCall . args ;
139
- assert . propEqual (
140
- actual ,
141
- {
142
- backend : 'token' ,
143
- clusterId : '1' ,
144
- data : {
145
- token : '12345' ,
146
- } ,
147
- selectedAuth : 'token' ,
148
- } ,
149
- `it calls auth service authenticate method with correct args: ${ JSON . stringify ( actual ) } `
150
- ) ;
151
- } ) ;
152
-
153
- test ( 'it should set nonce value as uuid for okta method type' , async function ( assert ) {
154
- assert . expect ( 4 ) ;
155
- this . server . post ( '/auth/okta/login/foo' , ( _ , req ) => {
156
- const { nonce } = JSON . parse ( req . requestBody ) ;
157
- assert . true ( validate ( nonce ) , 'Nonce value passed as uuid for okta login' ) ;
158
- return {
159
- auth : {
160
- client_token : '12345' ,
161
- policies : [ 'default' ] ,
162
- } ,
163
- } ;
164
- } ) ;
165
-
166
- await this . renderComponent ( ) ;
167
-
168
- await fillIn ( GENERAL . selectByAttr ( 'auth-method' ) , 'okta' ) ;
169
- await fillIn ( AUTH_FORM . input ( 'username' ) , 'foo' ) ;
170
- await fillIn ( AUTH_FORM . input ( 'password' ) , 'bar' ) ;
171
- await click ( AUTH_FORM . login ) ;
172
- assert
173
- . dom ( '[data-test-okta-number-challenge]' )
49
+ . dom ( AUTH_FORM . helpText )
174
50
. hasText (
175
51
'Once you log in, you will be redirected back to your application. If you require login credentials, contact your administrator.'
176
52
) ;
0 commit comments