diff --git a/examples/as7-eap-dev/server/src/main/webapp/WEB-INF/jboss-web.xml b/examples/as7-eap-dev/server/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100755 index 0000000000..e0d667952f --- /dev/null +++ b/examples/as7-eap-dev/server/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,3 @@ + + true + \ No newline at end of file diff --git a/model/jpa/pom.xml b/model/jpa/pom.xml index 8f6edf9cc9..243e43801b 100755 --- a/model/jpa/pom.xml +++ b/model/jpa/pom.xml @@ -4,7 +4,7 @@ keycloak-parent org.keycloak 1.0-alpha-1 - ../pom.xml + ../../pom.xml 4.0.0 diff --git a/model/picketlink/pom.xml b/model/picketlink/pom.xml index a035b19a37..b42cd805ba 100755 --- a/model/picketlink/pom.xml +++ b/model/picketlink/pom.xml @@ -4,7 +4,7 @@ keycloak-parent org.keycloak 1.0-alpha-1 - ../pom.xml + ../../pom.xml 4.0.0 diff --git a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java new file mode 100755 index 0000000000..216339b57b --- /dev/null +++ b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java @@ -0,0 +1,63 @@ +package org.keycloak.services.managers; + +import org.keycloak.models.*; +import org.keycloak.representations.idm.CredentialRepresentation; +import org.keycloak.services.resources.SaasService; + +import java.util.UUID; + +/** + * @author Bill Burke + * @version $Revision: 1 $ + */ +public class ApplianceBootstrap { + + + public static final String ADMIN_REALM = "Keycloak Adminstration"; + public static final String ADMIN_CONSOLE = "Admin Console"; + + public void initKeycloakAdminRealm(RealmModel realm) { + + } + + public void bootstrap(KeycloakSession session) { + RealmManager manager = new RealmManager(session); + RealmModel realm = manager.createRealm(ADMIN_REALM, "Keycloak Adminstration"); + realm.setName("Keycloak Adminstration"); + realm.setEnabled(true); + realm.addRequiredCredential(CredentialRepresentation.PASSWORD); + realm.addRequiredOAuthClientCredential(CredentialRepresentation.PASSWORD); + realm.addRequiredResourceCredential(CredentialRepresentation.PASSWORD); + realm.setTokenLifespan(300); + realm.setAccessCodeLifespan(60); + realm.setSslNotRequired(true); + realm.setCookieLoginAllowed(true); + realm.setRegistrationAllowed(false); + manager.generateRealmKeys(realm); + initKeycloakAdminRealm(realm); + + ApplicationModel adminConsole = realm.addApplication(ADMIN_CONSOLE); + adminConsole.setEnabled(true); + UserCredentialModel adminConsolePassword = new UserCredentialModel(); + adminConsolePassword.setType(UserCredentialModel.PASSWORD); + adminConsolePassword.setValue(UUID.randomUUID().toString()); // just a random password as we'll never access it + realm.updateCredential(adminConsole.getApplicationUser(), adminConsolePassword); + + RoleModel applicationRole = realm.getRole(RealmManager.APPLICATION_ROLE); + realm.grantRole(adminConsole.getApplicationUser(), applicationRole); + RoleModel adminRole = adminConsole.addRole("admin"); + + UserModel adminUser = realm.addUser("admin"); + adminUser.setEnabled(true); + UserCredentialModel password = new UserCredentialModel(); + password.setType(UserCredentialModel.PASSWORD); + password.setValue("admin"); + realm.updateCredential(adminUser, password); + adminUser.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD); + + adminConsole.grantRole(adminUser, adminRole); + + + + } +}