Merge pull request #409 from patriot1burke/master

fix urn redirect uri
This commit is contained in:
Bill Burke 2014-05-20 16:15:40 -04:00
commit 79828ddc78
2 changed files with 13 additions and 1 deletions

View file

@ -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 *

View file

@ -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