@Test public void authorizationValidRedirectUri() throws IOException { keycloakRule.configure( new KeycloakRule.KeycloakSetup() { @Override public void config( RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) { appRealm.getApplicationByName("test-app").addRedirectUri(oauth.getRedirectUri()); } }); oauth.state("mystate"); AuthorizationCodeResponse response = oauth.doLogin("test-user@localhost", "password"); Assert.assertTrue(response.isRedirected()); Assert.assertNotNull(response.getCode()); oauth.verifyCode(response.getCode()); }
@Test public void authorizationRequestNoState() throws IOException { AuthorizationCodeResponse response = oauth.doLogin("test-user@localhost", "password"); Assert.assertTrue(response.isRedirected()); Assert.assertNotNull(response.getCode()); Assert.assertNull(response.getState()); Assert.assertNull(response.getError()); oauth.verifyCode(response.getCode()); }