-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to kc24. trial of using it as an alternate account theme. (#140)
- Loading branch information
Showing
5 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
ext/main/java/io/phasetwo/portal/AccountPortalResourceProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.phasetwo.portal; | ||
|
||
import com.google.auto.service.AutoService; | ||
import lombok.extern.jbosslog.JBossLog; | ||
import org.keycloak.Config.Scope; | ||
import org.keycloak.models.KeycloakSession; | ||
import org.keycloak.models.KeycloakSessionFactory; | ||
import org.keycloak.models.RealmModel; | ||
import org.keycloak.provider.ProviderEvent; | ||
import org.keycloak.services.resource.AccountResourceProvider; | ||
import org.keycloak.services.resource.AccountResourceProviderFactory; | ||
|
||
@JBossLog | ||
@AutoService(AccountResourceProviderFactory.class) | ||
public class AccountPortalResourceProviderFactory implements AccountResourceProviderFactory { | ||
|
||
public static final String ID = "portal"; | ||
|
||
@Override | ||
public String getId() { | ||
return ID; | ||
} | ||
|
||
@Override | ||
public AccountResourceProvider create(KeycloakSession session) { | ||
// get override config | ||
RealmModel realm = session.getContext().getRealm(); | ||
String override = realm.getName(); | ||
return new PortalResourceProvider(session, override); | ||
} | ||
|
||
@Override | ||
public void init(Scope config) {} | ||
|
||
@Override | ||
public void postInit(KeycloakSessionFactory factory) { | ||
factory.register( | ||
(ProviderEvent event) -> { | ||
if (event instanceof RealmModel.RealmPostCreateEvent) { | ||
log.debug("RealmPostCreateEvent"); | ||
realmPostCreate((RealmModel.RealmPostCreateEvent) event); | ||
} | ||
}); | ||
} | ||
|
||
private void realmPostCreate(RealmModel.RealmPostCreateEvent event) { | ||
// no-op for now | ||
} | ||
|
||
@Override | ||
public void close() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"themes": [ | ||
{ | ||
"name": "portal", | ||
"types": ["login"] | ||
"types": ["account", "login"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
accountResourceProvider=portal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters