@@ -9,7 +9,6 @@ import Util from 'helpers/mocks/Util';
99import Expect from 'helpers/util/Expect' ;
1010import resError from 'helpers/xhr/ERROR_webfinger' ;
1111import resSuccess from 'helpers/xhr/SUCCESS' ;
12- import resSuccessRepostIWA from 'helpers/xhr/IDPDiscoverySuccessRepost_IWA' ;
1312import resSuccessIWA from 'helpers/xhr/IDPDiscoverySuccess_IWA' ;
1413import resSuccessOktaIDP from 'helpers/xhr/IDPDiscoverySuccess_OktaIDP' ;
1514import resSuccessSAML from 'helpers/xhr/IDPDiscoverySuccess_SAML' ;
@@ -960,6 +959,7 @@ Expect.describe('IDPDiscovery', function() {
960959 } )
961960 . then ( function ( test ) {
962961 spyOn ( test . securityBeacon , 'toggleClass' ) . and . callThrough ( ) ;
962+ spyOn ( test . ac . token , 'getWithRedirect' ) ;
963963 test . setNextWebfingerResponse ( resSuccessSAML ) ;
964964 test . form . submit ( ) ;
965965 return Expect . waitForSpyCall ( test . securityBeacon . toggleClass , test ) ;
@@ -970,7 +970,9 @@ Expect.describe('IDPDiscovery', function() {
970970 return waitForWebfingerCall ( test ) ;
971971 } )
972972 . then ( function ( test ) {
973- expect ( test . securityBeacon . toggleClass ) . toHaveBeenCalledWith ( BEACON_LOADING_CLS , false ) ;
973+ expect ( test . ac . token . getWithRedirect ) . toHaveBeenCalledWith ( jasmine . objectContaining ( {
974+ loginHint : test . form . usernameField ( ) . val ( )
975+ } ) ) ;
974976 } ) ;
975977 } ) ;
976978 itp ( 'does not show beacon-loading animation when authClient webfinger fails' , function ( ) {
@@ -1503,72 +1505,32 @@ Expect.describe('IDPDiscovery', function() {
15031505 spyOn ( SharedUtil , 'redirect' ) ;
15041506 return setup ( )
15051507 . then ( function ( test ) {
1508+ spyOn ( test . ac . token , 'getWithRedirect' ) ;
15061509 test . setNextWebfingerResponse ( resSuccessSAML ) ;
15071510 test . form . setUsername ( ' testuser@clouditude.net ' ) ;
15081511 test . form . submit ( ) ;
1509- return Expect . waitForSpyCall ( SharedUtil . redirect ) ;
1512+ return Expect . waitForSpyCall ( test . ac . token . getWithRedirect , test ) ;
15101513 } )
1511- . then ( function ( ) {
1512- expect ( SharedUtil . redirect ) . toHaveBeenCalledWith ( 'http://demo.okta1.com:1802/sso/saml2/0oa2hhcwIc78OGP1W0g4' ) ;
1513- } ) ;
1514- } ) ;
1515- itp ( 'redirects using form Get to idp for SAML idps when features.redirectByFormSubmit is on' , function ( ) {
1516- spyOn ( WidgetUtil , 'redirectWithFormGet' ) ;
1517- return setup ( { 'features.redirectByFormSubmit' : true } )
15181514 . then ( function ( test ) {
1519- test . setNextWebfingerResponse ( resSuccessSAML ) ;
1520- test . form . setUsername ( ' testuser@clouditude.net ' ) ;
1521- test . form . submit ( ) ;
1522- return Expect . waitForSpyCall ( WidgetUtil . redirectWithFormGet ) ;
1523- } )
1524- . then ( function ( ) {
1525- expect ( WidgetUtil . redirectWithFormGet ) . toHaveBeenCalledWith (
1526- 'http://demo.okta1.com:1802/sso/saml2/0oa2hhcwIc78OGP1W0g4'
1527- ) ;
1515+ expect ( test . ac . token . getWithRedirect ) . toHaveBeenCalledWith ( jasmine . objectContaining ( {
1516+ loginHint : test . form . usernameField ( ) . val ( ) . trim ( )
1517+ } ) ) ;
15281518 } ) ;
15291519 } ) ;
15301520 itp ( 'redirects to idp for idps other than okta/saml' , function ( ) {
15311521 spyOn ( SharedUtil , 'redirect' ) ;
15321522 return setup ( )
15331523 . then ( function ( test ) {
1524+ spyOn ( test . ac . token , 'getWithRedirect' ) ;
15341525 test . setNextWebfingerResponse ( resSuccessIWA ) ;
15351526 test . form . setUsername ( 'testuser@clouditude.net' ) ;
15361527 test . form . submit ( ) ;
1537- return Expect . waitForSpyCall ( SharedUtil . redirect ) ;
1528+ return Expect . waitForSpyCall ( test . ac . token . getWithRedirect , test ) ;
15381529 } )
1539- . then ( function ( ) {
1540- expect ( SharedUtil . redirect ) . toHaveBeenCalledWith ( 'http://demo.okta1.com:1802/login/sso_iwa' ) ;
1541- } ) ;
1542- } ) ;
1543- itp (
1544- 'redirects using form GET to idp for idps other than okta/saml when features.redirectByFormSubmit is on' ,
1545- function ( ) {
1546- spyOn ( WidgetUtil , 'redirectWithFormGet' ) ;
1547- return setup ( { 'features.redirectByFormSubmit' : true } )
1548- . then ( function ( test ) {
1549- test . setNextWebfingerResponse ( resSuccessIWA ) ;
1550- test . form . setUsername ( 'testuser@clouditude.net' ) ;
1551- test . form . submit ( ) ;
1552- return Expect . waitForSpyCall ( WidgetUtil . redirectWithFormGet ) ;
1553- } )
1554- . then ( function ( ) {
1555- expect ( WidgetUtil . redirectWithFormGet ) . toHaveBeenCalledWith ( 'http://demo.okta1.com:1802/login/sso_iwa' ) ;
1556- } ) ;
1557- }
1558- ) ;
1559- itp ( 'redirects using form GET to idp when OKTA_INVALID_SESSION_REPOST=true' , function ( ) {
1560- spyOn ( WidgetUtil , 'redirectWithFormGet' ) ;
1561- return setup ( )
15621530 . then ( function ( test ) {
1563- test . setNextWebfingerResponse ( resSuccessRepostIWA ) ;
1564- test . form . setUsername ( 'testuser@clouditude.net' ) ;
1565- test . form . submit ( ) ;
1566- return Expect . waitForSpyCall ( WidgetUtil . redirectWithFormGet ) ;
1567- } )
1568- . then ( function ( ) {
1569- expect ( WidgetUtil . redirectWithFormGet ) . toHaveBeenCalledWith (
1570- 'http://demo.okta1.com:1802/login/sso_iwa?fromURI=%2Fapp%2Finstance%2Fkey%3FSAMLRequest%3Dencoded%26RelayState%3DrelayState%26OKTA_INVALID_SESSION_REPOST%3Dtrue'
1571- ) ;
1531+ expect ( test . ac . token . getWithRedirect ) . toHaveBeenCalledWith ( jasmine . objectContaining ( {
1532+ loginHint : test . form . usernameField ( ) . val ( )
1533+ } ) ) ;
15721534 } ) ;
15731535 } ) ;
15741536 } ) ;
0 commit comments