Hi all,
I'm integrating keycloak.js with the Red Hat Customer Portal and have a
question about passing a configuration object into the Keycloak()
constructor.
At the point where I call Keycloak(), I'm attempting to avoid waiting
for the keycloak.json HTTP GET by inlining keycloak.json during a build
step. By example, my build now produces this:
var keycloak = new Keycloak({
"realm" : "myRealm",
"realm-public-key" : "myPublicKey",
"auth-server-url" : "https://keycloak.me/auth",
"ssl-required" : "external",
"resource" : "myClientId",
"public-client" : true,
"token-store": "cookie"
});
I was hoping this would Just Work, but I quickly discovered that some of
the properties are "renamed" after the HTTP request:
kc.authServerUrl = config['auth-server-url'];
kc.realm = config['realm'];
kc.clientId = config['resource'];
kc.clientSecret = (config['credentials'] || {})['secret'];
And thus my setup doesn't work because "clientId" doesn't exist inside
keycloak.json.
My question is: would I be foolish to rename the properties inside
keycloak.json so that the JSON can be passed directly into the Keycloak
constructor? For example, "resource" becomes "clientId" and
"auth-server-url" becomes "authServerUrl".
It would be really convenient if I could give keycloak.js the contents
of keycloak.json without having to fret about where it came from (AJAX
or hardcoded or build-inlined). If others would like that feature too,
I'd happily put together a contribution.
Thanks for any advice!
--
Michael Clayton