@@ -316,6 +316,52 @@ func Test_Authenticate(t *testing.T) {
316
316
require .Nil (t , err )
317
317
require .NotEmpty (t , got )
318
318
})
319
+ t .Run ("Pass mfa-token via loginDetails" , func (t * testing.T ) {
320
+ ts := httptest .NewTLSServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
321
+ switch r .URL .Path {
322
+ case "/index" , "/applications/redirecttofederatedapplication.aspx" :
323
+ writeFixtureBytes (t , w , r , "ConvergedSignIn.html" , FixtureData {
324
+ UrlPost : "/defaultLogin" ,
325
+ UrlGetCredentialType : "/getCredentialType" ,
326
+ })
327
+ case "/getCredentialType" :
328
+ writeFixtureBytes (t , w , r , "GetCredentialType_default.json" , FixtureData {})
329
+ case "/defaultLogin" :
330
+ writeFixtureBytes (t , w , r , "KmsiInterrupt.html" , FixtureData {
331
+ UrlPost : "/hForm" ,
332
+ })
333
+ case "/hForm" :
334
+ writeFixtureBytes (t , w , r , "HiddenForm.html" , FixtureData {
335
+ UrlHiddenForm : "/sRequest" ,
336
+ })
337
+ case "/sRequest" :
338
+ writeFixtureBytes (t , w , r , "SAMLRequest.html" , FixtureData {
339
+ UrlSamlRequest : "/sResponse?SAMLRequest=ExampleValue" ,
340
+ })
341
+ case "/sResponse" :
342
+ writeFixtureBytes (t , w , r , "ConvergedTFA.html" , FixtureData {
343
+ UrlPost : "/processAuth" ,
344
+ UrlBeginAuth : "/beginAuth" ,
345
+ UrlEndAuth : "/endAuth" ,
346
+ })
347
+ case "/beginAuth" :
348
+ writeFixtureBytes (t , w , r , "BeginAuth.json" , FixtureData {})
349
+ case "/endAuth" :
350
+ writeFixtureBytes (t , w , r , "EndAuth.json" , FixtureData {})
351
+ case "/processAuth" :
352
+ writeFixtureBytes (t , w , r , "SAMLResponse.html" , FixtureData {})
353
+ default :
354
+ http .Error (w , http .StatusText (http .StatusBadRequest ), http .StatusBadRequest )
355
+ }
356
+ }))
357
+ defer ts .Close ()
358
+
359
+ ac , loginDetails := setupTestClient (t , ts )
360
+ loginDetails .MFAToken = "000000"
361
+ got , err := ac .Authenticate (loginDetails )
362
+ require .Nil (t , err )
363
+ require .NotEmpty (t , got )
364
+ })
319
365
t .Run ("Default login with KMSI and MFA but Authenticator required" , func (t * testing.T ) {
320
366
ts := httptest .NewTLSServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
321
367
switch r .URL .Path {
0 commit comments