[keycloak-dev] [AS7 Adapter] KeycloakAuthenticatorValve invoked too early
Matthias Wessendorf
matzew at apache.org
Fri Apr 4 04:59:10 EDT 2014
Hello,
trying to integrate the Keycloak "server" into my own JAX-RS application
(for the integration with the UnifiedPush Server). I started w/ a simple
app.
Generally I am doing something similar to what the LiveOak folks do:
I create leverage the Admin realm, using Java APIs:
https://github.com/liveoak-io/liveoak/blob/master/modules/keycloak/src/main/java/io/liveoak/keycloak/KeycloakServer.java#L72-L104
Now, to get rid of the 'keycloak.json' file for the AS7 adapter, I tried
the following, inside of the constructor of my JAX-RS Application class
(which extends KeycloakApplication):
....
final AdapterConfig config = new AdapterConfig();
config.setRealm(adminRealm.getName());
config.set......
......
final ObjectMapper om = new ObjectMapper();
String json = null;
try {
json = om.writeValueAsString(config);
} catch (IOException e) {
e.printStackTrace();
}
servletContext.setInitParameter(AdapterConstants.AUTH_DATA_PARAM_NAME,
json);
....
However, that happens too late (a ServletContextListener is too late as
well). This line of code:
https://github.com/keycloak/keycloak/blob/master/integration/as7-eap6/adapter/src/main/java/org/keycloak/adapters/as7/KeycloakAuthenticatorValve.java#L75
is invoked before the constructor of my JAX-RS Application class (which
extends KeycloakApplication); same with a context listener.
I am wondering what's the best way to provide the "keycloak.json" content,
using Java APIs ?
Greetings,
Matthias
--
Matthias Wessendorf
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20140404/55661906/attachment.html
More information about the keycloak-dev
mailing list