diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
index 3e33cc6a8e..d0aadec88a 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
index d565cfb7eb..a4630ac786 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
index 175b8cb71f..ab7cfa46a9 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
index 52ccfcae6d..ccccbaec68 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
index ff318b0c88..bd1bab9f84 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
index f19e3c40da..fdbc33e109 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
index 2e6f1f7aad..c08d5f9d43 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
index b2833c9466..c322bf2c54 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
@@ -1,4 +1,4 @@
-
+
- Realm Sessions
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
index 06fa783fbc..299b6989d4 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
index 74a8670874..17879ca7ba 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
@@ -1,4 +1,4 @@
-
+
- Realm Roles
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
index 6a07ca73af..0ae08be374 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
@@ -1,4 +1,4 @@
-
+
- Attributes
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
index 8730395b7b..1394703e15 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
@@ -1,4 +1,4 @@
-
+
- Realm Sessions
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
index 866c6fbe2a..c87af7f9ae 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
@@ -1,4 +1,4 @@
-
+
- Realm Sessions
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
index 0efd271938..8ca73a6e40 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
index 5e770a882c..8ed77b74a0 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
@@ -1,4 +1,4 @@
-
+
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
index 845be1f428..70a2691f00 100644
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
@@ -1,4 +1,4 @@
-
+
- Attributes
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
index 0d7e4c6a59..d81ef0cdb5 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
@@ -1,4 +1,4 @@
-
+
- User List
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
index 3fdd481ced..df5006727f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
@@ -1,4 +1,4 @@
-
+
- User List
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
index a2a8ee09d4..f3de7e404d 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
@@ -1,4 +1,4 @@
-
+
- Attributes
diff --git a/forms/common-themes/src/main/resources/theme/login/base/messages/messages.properties b/forms/common-themes/src/main/resources/theme/login/base/messages/messages.properties
index 5c5d1f7e92..3a1c04113f 100755
--- a/forms/common-themes/src/main/resources/theme/login/base/messages/messages.properties
+++ b/forms/common-themes/src/main/resources/theme/login/base/messages/messages.properties
@@ -56,7 +56,6 @@ emailExists=Email already exists
federatedIdentityEmailExists=User with email already exists. Please login to account management to link the account.
federatedIdentityUsernameExists=User with username already exists. Please login to account management to link the account.
-federatedIdentityDisabledRegistration=Registration of new users is not allowed. Please ask admin to register you and login to account management to link the account.
loginTitle=Log in to
loginOauthTitle=Temporary access.
diff --git a/forms/login-freemarker/pom.xml b/forms/login-freemarker/pom.xml
index 637ba88b17..944157c6d9 100755
--- a/forms/login-freemarker/pom.xml
+++ b/forms/login-freemarker/pom.xml
@@ -62,14 +62,13 @@
provided
- org.freemarker
- freemarker
+ org.freemarker
+ freemarker
provided
-
+
- org.jboss
- jboss-vfs
- 3.2.2.Final
+ org.jboss.logging
+ jboss-logging
provided
diff --git a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
index 1bbb5811d5..e0a2797655 100644
--- a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
+++ b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
@@ -526,12 +526,6 @@ public class IdentityBrokerService {
throw new IdentityBrokerException("federatedIdentityUsernameExists");
}
- // Check if realm registration is allowed
- if (!this.realmModel.isRegistrationAllowed()) {
- fireErrorEvent(Errors.FEDERATED_IDENTITY_DISABLED_REGISTRATION);
- throw new IdentityBrokerException("federatedIdentityDisabledRegistration");
- }
-
if (isDebugEnabled()) {
LOGGER.debugf("Creating account from identity [%s].", federatedIdentityModel);
}
diff --git a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
index 19ddaec856..488774d275 100755
--- a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
@@ -5,9 +5,8 @@ import org.keycloak.Config;
import org.keycloak.freemarker.Theme;
import org.keycloak.freemarker.ThemeProvider;
import org.keycloak.models.KeycloakSession;
+import org.keycloak.util.MimeTypeUtil;
-import javax.activation.FileTypeMap;
-import javax.activation.MimetypesFileTypeMap;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -21,13 +20,11 @@ import java.io.InputStream;
*
* @author Stian Thorgersen
*/
-@Path("/theme")
+@Path("/resources")
public class ThemeResource {
private static final Logger logger = Logger.getLogger(ThemeResource.class);
- private static FileTypeMap mimeTypes = MimetypesFileTypeMap.getDefaultFileTypeMap();
-
@Context
private KeycloakSession session;
@@ -40,7 +37,7 @@ public class ThemeResource {
* @return
*/
@GET
- @Path("/{themeType}/{themeName}/{path:.*}")
+ @Path("/{version}/{themeType}/{themeName}/{path:.*}")
public Response getResource(@PathParam("themeType") String themType, @PathParam("themeName") String themeName, @PathParam("path") String path) {
try {
ThemeProvider themeProvider = session.getProvider(ThemeProvider.class, "extending");
@@ -51,7 +48,7 @@ public class ThemeResource {
cacheControl.setNoTransform(false);
cacheControl.setMaxAge(Config.scope("theme").getInt("staticMaxAge", -1));
- return Response.ok(resource).type(mimeTypes.getContentType(path)).cacheControl(cacheControl).build();
+ return Response.ok(resource).type(MimeTypeUtil.getContentType(path)).cacheControl(cacheControl).build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
diff --git a/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java b/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
index f0f9b506d3..3feacf1f5d 100755
--- a/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
@@ -5,9 +5,8 @@ import org.keycloak.Config;
import org.keycloak.freemarker.Theme;
import org.keycloak.freemarker.ThemeProvider;
import org.keycloak.models.KeycloakSession;
+import org.keycloak.util.MimeTypeUtil;
-import javax.activation.FileTypeMap;
-import javax.activation.MimetypesFileTypeMap;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -28,8 +27,6 @@ public class WelcomeResource {
private static final Logger logger = Logger.getLogger(WelcomeResource.class);
- private static FileTypeMap mimeTypes = MimetypesFileTypeMap.getDefaultFileTypeMap();
-
@Context
private UriInfo uriInfo;
@@ -70,7 +67,7 @@ public class WelcomeResource {
Theme theme = themeProvider.getTheme(config.get("welcomeTheme"), Theme.Type.WELCOME);
InputStream resource = theme.getResourceAsStream(path);
if (resource != null) {
- String contentType = mimeTypes.getContentType(path);
+ String contentType = MimeTypeUtil.getContentType(path);
CacheControl cacheControl = new CacheControl();
cacheControl.setNoTransform(false);
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
index 13dbe251e7..ff6e0fcbfa 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
@@ -9,6 +9,8 @@ import org.jboss.resteasy.spi.NotFoundException;
import org.keycloak.ClientConnection;
import org.keycloak.Config;
import org.keycloak.freemarker.BrowserSecurityHeaderSetup;
+import org.keycloak.freemarker.FreeMarkerException;
+import org.keycloak.freemarker.FreeMarkerUtil;
import org.keycloak.freemarker.Theme;
import org.keycloak.freemarker.ThemeProvider;
import org.keycloak.models.AdminRoles;
@@ -24,9 +26,9 @@ import org.keycloak.services.managers.ApplicationManager;
import org.keycloak.services.managers.AuthenticationManager;
import org.keycloak.services.managers.RealmManager;
import org.keycloak.services.resources.KeycloakApplication;
+import org.keycloak.services.resources.flows.Urls;
+import org.keycloak.util.MimeTypeUtil;
-import javax.activation.FileTypeMap;
-import javax.activation.MimetypesFileTypeMap;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -34,9 +36,11 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.ext.Providers;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
@@ -249,7 +253,7 @@ public class AdminConsole {
@GET
@NoCache
public Response logout() {
- URI redirect = AdminRoot.adminConsoleUrl(uriInfo).path("index.html").build(realm.getName());
+ URI redirect = AdminRoot.adminConsoleUrl(uriInfo).build(realm.getName());
return Response.status(302).location(
OIDCLoginProtocolService.logoutUrl(uriInfo).queryParam("redirect_uri", redirect.toString()).build(realm.getName())
@@ -260,8 +264,6 @@ public class AdminConsole {
return realmManager.getKeycloakAdminstrationRealm();
}
- private static FileTypeMap mimeTypes = MimetypesFileTypeMap.getDefaultFileTypeMap();
-
/**
* Main page of this realm's admin console
*
@@ -269,72 +271,41 @@ public class AdminConsole {
* @throws URISyntaxException
*/
@GET
- public Response getMainPage() throws URISyntaxException {
+ @NoCache
+ public Response getMainPage() throws URISyntaxException, IOException, FreeMarkerException {
if (!uriInfo.getRequestUri().getPath().endsWith("/")) {
return Response.status(302).location(uriInfo.getRequestUriBuilder().path("/").build()).build();
} else {
- return getResource("index.html");
- }
- }
+ String adminTheme = realm.getAdminTheme();
+ if (adminTheme == null) {
+ adminTheme = "keycloak";
+ }
- /**
- * Javascript used by admin console
- *
- * @return
- */
- @GET
- @Path("js/keycloak.js")
- @Produces("text/javascript")
- public Response getKeycloakJs() {
- InputStream inputStream = getClass().getClassLoader().getResourceAsStream("keycloak.js");
- if (inputStream != null) {
- CacheControl cacheControl = new CacheControl();
- cacheControl.setNoTransform(false);
- cacheControl.setMaxAge(Config.scope("theme").getInt("staticMaxAge", -1));
+ Map map = new HashMap();
- return Response.ok(inputStream).type("text/javascript").cacheControl(cacheControl).build();
- } else {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- }
+ URI baseUri = uriInfo.getBaseUri();
- /**
- * Theme resources for this realm's admin console. (images, html files, etc..)
- *
- * @param path
- * @return
- */
- @GET
- @Path("{path:.+}")
- public Response getResource(@PathParam("path") String path) {
- // todo
- // I don't know why I need this. On IE 11, if I don't have this, getKeycloakJs() isn't invoked
- // I just can't figure out what the difference is between IE11 and FF for console/js/keycloak.js calls
- if (path.equals("js/keycloak.js")) {
- return getKeycloakJs();
- }
+ String authUrl = baseUri.toString();
+ authUrl = authUrl.substring(0, authUrl.length() - 1);
+
+ map.put("authUrl", authUrl);
+ map.put("resourceUrl", Urls.themeRoot(baseUri) + "/admin/" + adminTheme);
- try {
ThemeProvider themeProvider = session.getProvider(ThemeProvider.class, "extending");
Theme theme = themeProvider.getTheme(realm.getAdminTheme(), Theme.Type.ADMIN);
- InputStream resource = theme.getResourceAsStream(path);
- if (resource != null) {
- String contentType = mimeTypes.getContentType(path);
- CacheControl cacheControl = new CacheControl();
- cacheControl.setNoTransform(false);
- cacheControl.setMaxAge(Config.scope("theme").getInt("staticMaxAge", -1));
-
- Response.ResponseBuilder builder = Response.ok(resource).type(contentType).cacheControl(cacheControl);
- BrowserSecurityHeaderSetup.headers(builder, realm);
- return builder.build();
- } else {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- } catch (Exception e) {
- logger.warn("Failed to get theme resource", e);
- return Response.serverError().build();
+ FreeMarkerUtil freeMarkerUtil = new FreeMarkerUtil();
+ String result = freeMarkerUtil.processTemplate(map, "index.ftl", theme);
+ Response.ResponseBuilder builder = Response.status(Response.Status.OK).type(MediaType.TEXT_HTML).entity(result);
+ BrowserSecurityHeaderSetup.headers(builder, realm);
+ return builder.build();
}
}
+ @GET
+ @Path("index.html")
+ public Response getIndexHtmlRedirect() {
+ return Response.status(302).location(uriInfo.getRequestUriBuilder().path("../").build()).build();
+ }
+
}
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
index ecde0fdbe2..f1d3e355e0 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
@@ -1,5 +1,6 @@
package org.keycloak.services.resources.admin;
+import org.jboss.resteasy.annotations.cache.Cache;
import org.keycloak.Version;
import org.keycloak.broker.provider.IdentityProvider;
import org.keycloak.broker.provider.IdentityProviderFactory;
diff --git a/services/src/main/java/org/keycloak/services/resources/flows/Urls.java b/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
index 2eb1ed4315..7889388fc9 100755
--- a/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
+++ b/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
@@ -22,6 +22,7 @@
package org.keycloak.services.resources.flows;
import org.keycloak.OAuth2Constants;
+import org.keycloak.Version;
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
import org.keycloak.services.resources.AccountService;
@@ -190,7 +191,7 @@ public class Urls {
}
public static URI themeRoot(URI baseUri) {
- return themeBase(baseUri).build();
+ return themeBase(baseUri).path(Version.RESOURCES_VERSION).build();
}
private static UriBuilder requiredActionsBase(URI baseUri) {
diff --git a/services/src/main/resources/META-INF/mime.types b/services/src/main/resources/META-INF/mime.types
deleted file mode 100755
index 11de430b04..0000000000
--- a/services/src/main/resources/META-INF/mime.types
+++ /dev/null
@@ -1,6 +0,0 @@
-text/css css CSS
-text/javascript js JS
-text/javascript js JS
-image/png png PNG
-image/svg+xml svg SVG
-text/html html htm HTML HTM
\ No newline at end of file
diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderTest.java
index edd0812ce1..473c375e34 100644
--- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderTest.java
+++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderTest.java
@@ -257,32 +257,6 @@ public abstract class AbstractIdentityProviderTest {
this.updateProfilePage.assertCurrent();
}
- @Test
- public void testDisabledRegistration() {
- // Disable registration in realm
- getRealm().setRegistrationAllowed(false);
- brokerServerRule.stopSession(this.session, true);
- this.session = brokerServerRule.startSession();
-
- // Login with identity provider
- this.driver.navigate().to("http://localhost:8081/test-app/");
- assertTrue(this.driver.getCurrentUrl().startsWith("http://localhost:8081/auth/realms/realm-with-broker/protocol/openid-connect/login"));
- this.loginPage.clickSocial(getProviderId());
-
- assertTrue(this.driver.getCurrentUrl().startsWith("http://localhost:8082/auth/"));
- this.loginPage.login("test-user", "password");
- doAfterProviderAuthentication();
-
- WebElement element = this.driver.findElement(By.className("kc-feedback-text"));
- assertNotNull(element);
- assertEquals("Registration of new users is not allowed. Please ask admin to register you and login to account management to link the account.", element.getText());
-
- // Re-enable registration in realm
- getRealm().setRegistrationAllowed(true);
- brokerServerRule.stopSession(this.session, true);
- this.session = brokerServerRule.startSession();
- }
-
@Test(expected = NoSuchElementException.class)
public void testIdentityProviderNotAllowed() {
this.driver.navigate().to("http://localhost:8081/test-app/");