KEYCLOAK-5326 Test that userSession is still the same after prompt=login

This commit is contained in:
mposolda 2017-09-05 11:40:52 +02:00
parent bb9a1335ec
commit 30d8a7503b

View file

@ -282,8 +282,7 @@ public class OIDCAdvancedRequestParamsTest extends AbstractTestRealmKeycloakTest
Assert.assertEquals(AppPage.RequestType.AUTH_RESPONSE, appPage.getRequestType());
EventRepresentation loginEvent = events.expectLogin().detail(Details.USERNAME, "test-user@localhost").assertEvent();
IDToken idToken = sendTokenRequestAndGetIDToken(loginEvent);
int authTime = idToken.getAuthTime();
IDToken oldIdToken = sendTokenRequestAndGetIDToken(loginEvent);
// Set time offset
setTimeOffset(10);
@ -296,12 +295,13 @@ public class OIDCAdvancedRequestParamsTest extends AbstractTestRealmKeycloakTest
Assert.assertEquals(AppPage.RequestType.AUTH_RESPONSE, appPage.getRequestType());
loginEvent = events.expectLogin().detail(Details.USERNAME, "test-user@localhost").assertEvent();
idToken = sendTokenRequestAndGetIDToken(loginEvent);
int authTimeUpdated = idToken.getAuthTime();
IDToken newIdToken = sendTokenRequestAndGetIDToken(loginEvent);
// Assert that authTime was updated
Assert.assertTrue(authTime + 10 <= authTimeUpdated);
Assert.assertTrue(oldIdToken.getAuthTime() + 10 <= newIdToken.getAuthTime());
// Assert userSession didn't change
Assert.assertEquals(oldIdToken.getSessionState(), newIdToken.getSessionState());
}