[keycloak-user] keycloak.json file for angular app

Marek Posolda mposolda at redhat.com
Fri Apr 3 01:37:16 EDT 2015


Yes, that works too. You can pass the JSON object with properties "url", 
"realm" and "clientId" to the constructor. See the docs with the example 
for this: 
http://docs.jboss.org/keycloak/docs/1.2.0.Beta1/userguide/html/ch08.html#javascript-adapter

Marek

On 2.4.2015 22:02, Ryvlin, Andrey wrote:
>
> Marek,
>
> I guess this would work if I can pass Json object to Keycloak constructor.
>
> Is it possible?
>
> Thanks‼
>
> -----------------
>
> Andrey Ryvlin
>
> Principal Software Engineer
>
> Phone: 952-979-8492
>
> 5705 W Old Shakopee Road, Suite 100
>
> Bloomington, MN 55437 USA
>
> ARyvlin at MorphoTrust.com <mailto:ARyvlin at MorphoTrust.com>
>
> www.MorphoTrust.com <http://www.morphotrust.com/>
>
> cid:image003.jpg at 01CFF75A.60542BC0
>
> *From:*Marek Posolda [mailto:mposolda at redhat.com]
> *Sent:* Thursday, April 02, 2015 1:05 PM
> *To:* Ryvlin, Andrey; keycloak-user at lists.jboss.org
> *Subject:* Re: [keycloak-user] keycloak.json file for angular app
>
> Hi,
>
> I guess in your Angular application you're using something like:
>
> var keycloakAuth = new Keycloak('keycloak.json');
>
> right? So instead of this, you can read the Keycloak configuration 
> from some separate URI like:
>
> var keycloakAuth = new Keycloak('myconfig');
>
> Where the path 'myconfig' could be mapped to some servlet (or jaxrs 
> application if you prefer), which will return you the JSON with the 
> configuration. So instead of serving the configuration directly from 
> file keycloak.json, you will serve it from the servlet (or jaxrs app). 
> The servlet will run on server side, so you can use whatever is good 
> for your app to init the auth-server-url dynamically (For example read 
> it from System property)
>
> Marek
>
>
> On 2.4.2015 19:21, Ryvlin, Andrey wrote:
>
>     Hi
>
>     I have AngularJs based UI web app talking to RESTfull web services
>     using Keycloak security.
>
>     Keycloak is running on a separate instance of Wildfly having https
>     connection.
>
>     UI Web application has keycloak.json file with hardcoded Keycloak URL.
>
>     Everything works well with one problem: when I need to install my
>     web application to a different environment I need to open WAR,
>     modify keycloak.json with new URL and package it back.
>
>     Since we deliver the entire installation to the client, I don’t
>     know their host names, so they have to open WAR, which is
>     in-convenient.
>
>     Is there any way to avoid that?
>
>     Thanks‼
>
>     Thanks‼
>
>     -----------------
>
>     Andrey Ryvlin
>
>     Principal Software Engineer
>
>     Phone: 952-979-8492
>
>     5705 W Old Shakopee Road, Suite 100
>
>     Bloomington, MN 55437 USA
>
>     ARyvlin at MorphoTrust.com <mailto:ARyvlin at MorphoTrust.com>
>
>     www.MorphoTrust.com <http://www.morphotrust.com/>
>
>     cid:image003.jpg at 01CFF75A.60542BC0
>
>     ------------------------------------------------------------------------
>
>
>     This message is only for the use of the intended recipient and may
>     contain information that is CONFIDENTIAL and PROPRIETARY to
>     MorphoTrust USA, Inc. If you are not the intended recipient,
>     please erase all copies of the message and its attachments and
>     notify the sender immediately.
>
>
>
>     _______________________________________________
>
>     keycloak-user mailing list
>
>     keycloak-user at lists.jboss.org  <mailto:keycloak-user at lists.jboss.org>
>
>     https://lists.jboss.org/mailman/listinfo/keycloak-user
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20150403/ca309569/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 1778 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20150403/ca309569/attachment-0001.jpe 


More information about the keycloak-user mailing list