commit
79828ddc78
2 changed files with 13 additions and 1 deletions
|
@ -946,7 +946,6 @@ public class TokenService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean matchesRedirects(Set<String> validRedirects, String redirect) {
|
public static boolean matchesRedirects(Set<String> validRedirects, String redirect) {
|
||||||
if (Constants.INSTALLED_APP_URN.equals(redirect)) return true;
|
|
||||||
for (String validRedirect : validRedirects) {
|
for (String validRedirect : validRedirects) {
|
||||||
if (validRedirect.endsWith("*")) {
|
if (validRedirect.endsWith("*")) {
|
||||||
// strip off *
|
// strip off *
|
||||||
|
|
|
@ -85,6 +85,12 @@ public class AuthorizationCodeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void authorizationRequestInstalledApp() throws IOException {
|
public void authorizationRequestInstalledApp() throws IOException {
|
||||||
|
keycloakRule.configure(new KeycloakRule.KeycloakSetup() {
|
||||||
|
@Override
|
||||||
|
public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {
|
||||||
|
appRealm.getApplicationNameMap().get("test-app").addRedirectUri(Constants.INSTALLED_APP_URN);
|
||||||
|
}
|
||||||
|
});
|
||||||
oauth.redirectUri(Constants.INSTALLED_APP_URN);
|
oauth.redirectUri(Constants.INSTALLED_APP_URN);
|
||||||
|
|
||||||
oauth.doLogin("test-user@localhost", "password");
|
oauth.doLogin("test-user@localhost", "password");
|
||||||
|
@ -97,6 +103,13 @@ public class AuthorizationCodeTest {
|
||||||
|
|
||||||
String codeId = events.expectLogin().detail(Details.REDIRECT_URI, Constants.INSTALLED_APP_URN).assertEvent().getDetails().get(Details.CODE_ID);
|
String codeId = events.expectLogin().detail(Details.REDIRECT_URI, Constants.INSTALLED_APP_URN).assertEvent().getDetails().get(Details.CODE_ID);
|
||||||
Assert.assertEquals(codeId, new JWSInput(code).readContentAsString());
|
Assert.assertEquals(codeId, new JWSInput(code).readContentAsString());
|
||||||
|
|
||||||
|
keycloakRule.configure(new KeycloakRule.KeycloakSetup() {
|
||||||
|
@Override
|
||||||
|
public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {
|
||||||
|
appRealm.getApplicationNameMap().get("test-app").removeRedirectUri(Constants.INSTALLED_APP_URN);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue