what to do after storing the token with javascript
by Juan Diego
Hi,
After my user logs I am saving the token to a localstorage. I am using
angularjs by the way.
So if my user refreshes the page they still have the session. As far as I
can tell when you refresh the page, most of the info of the object keycloak
is null, except for the realm and all the stuff you get form
keycloak.json. Like if you have never logged.
So I stored the token in my localStorage.
I am thinking 3 options basically.
1)
Setting keycloak.token = localStorage.get("token"), and I was trying to
look for a function in that object to retrieve all the other data, but I
couldnt find any on the documentation and looking at my
console.log(keycloak)
2)
Storing the whole object keycloak in localstorage, the problem with this is
that it will only store the properties and obviously not the functions, so
I was thinking that I should manually set all the properties like this
clientId = localStorageService.get('keycloak').clientId;
idToken = localStorageService.get('keycloak').idToken;
idTokenParsed = localStorageService.get('keycloak').idTokenParsed;
realmAccess = localStorageService.get('keycloak').realmAccess;
3) Just check everything against the localstorage instead.
But I wont be able to use the functions from the object keyclaok, like
updateToken.
I am kind of new to angular, as you can see too.
Thanks,
9 years, 6 months
Keycloak 1.3.1 on JBoss EAP 6.4
by Paulo Jerônimo
I'm trying to make Keycloak 1.3.1 works on a customer. My objective, is
install it (in a development environment) with JBoss BPM Suite 6.1 (it runs
with JBoss EAP 6.4). So, I will need to access /auth/admin in the same
server with the context /business-central.
The environment is Windows 8 with Cygwin.
I'm finding errors trying to do this installation, even before install BPM
Suite, on a pure JBoss EAP 6.4 installation.
Here is my procedure and the error:
$ rm -rf jboss-eap-6.4
$ shasum jboss-eap-6.4.0.zip
9ac2979fe92040a039a3a3db8b4ce8d166e2c872 *jboss-eap-6.4.0.zip
$ unzip -q jboss-eap-6.4.0.zip
$ unzip -q -d jboss-eap-6.4 keycloak-overlay-eap6-1.3.1.Final.zip
$ JBOSS_HOME=$PWD/jboss-eap-6.4 jboss-eap-6.4/bin/standalone.sh
--server-config standalone-keycloak.xml
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: C:\desenv\projetos\stn\sigti\instalador-bpms\jboss-eap-6.4
JAVA: /cygdrive/c/Program Files/Java/jdk1.7.0_75/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -verbose:gc
-Xloggc:"C:\desenv\projetos\stn\sigti\instalador-bpms\jboss-eap-6.4\standalone\log/gc.log"
-XX:+PrintGCDetails -XX:+PrintGC
DateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m
-XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true
-Duser.language=en -Djboss.modules.system.pkgs=org.jboss.byteman
-Djava.awt.headless=true -Djboss.modules.policy-permissions=true
=========================================================================
10:52:42,978 INFO [org.jboss.modules] (main) JBoss Modules version
1.3.6.Final-redhat-1
10:52:43,125 INFO [org.jboss.msc] (main) JBoss MSC version
1.1.5.Final-redhat-1
10:52:43,183 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899:
JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) starting
10:52:43,584 ERROR [org.jboss.as.server] (Controller Boot Thread)
JBAS015956: Caught exception during boot:
org.jboss.as.controller.persistence.ConfigurationPersistenceException: J
BAS014676: Failed to parse configuration
at
org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.server.ServerService.boot(ServerService.java:330)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:263)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
Caused by: javax.xml.stream.XMLStreamException: JBAS014674: Failed to load
module org.keycloak.keycloak-server-subsystem
at
org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:154)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:435)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:145)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
[staxmapper-1.1.0.Final-redhat-3.jar:1.1.0.Final-redhat-3]
at
org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
[staxmapper-1.1.0.Final-redhat-3.jar:1.1.0.Final-redhat-3]
at
org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
... 3 more
Caused by: java.util.concurrent.ExecutionException:
javax.xml.stream.XMLStreamException: JBAS014674: Failed to load module
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
[rt.jar:1.7.0_75]
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
[rt.jar:1.7.0_75]
at
org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:146)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
... 9 more
Caused by: javax.xml.stream.XMLStreamException: JBAS014674: Failed to load
module
at
org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:195)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.controller.parsing.ExtensionXml.access$000(ExtensionXml.java:68)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:126)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at
org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:123)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[rt.jar:1.7.0_75]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[rt.jar:1.7.0_75]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[rt.jar:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
[jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: org.jboss.modules.ModuleNotFoundException:
org.keycloak.keycloak-server-subsystem:main
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:240)
[jboss-modules.jar:1.3.6.Final-redhat-1]
at
org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:177)
[jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
... 8 more
10:52:43,595 FATAL [org.jboss.as.server] (Controller Boot Thread)
JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See
previous messages for details.
11:52:43,604 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015950:
JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) stopped in 3ms
I saw the differences between the standard configuration:
$ vim -d
jboss-eap-6.4/standalone/configuration/standalone{.xml,-keycloak.xml}
And I know the module org.keycloak.keycloak-server-subsystem is present:
$ tree
jboss-eap-6.4/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/
jboss-eap-6.4/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/
`-- main
`-- module.xml
1 directory, 1 file
Maybe I'm missing some detail? I appreciate any help.
9 years, 6 months
Trouble running Fuse demo with 3.1.1.Final
by Stan Silvert
I'm trying to run the Fuse demo at
https://github.com/keycloak/keycloak/tree/master/examples/fuse
I'm using Fuse 6.1.0.redhat-379 and Keycloak 3.1.1.Final. Everything
goes fine until I try to install keycloak-fuse-example. Then I get:
JBossFuse:karaf@root> features:install keycloak-fuse-example
Error executing command: Can not resolve feature:
Unsatisfied requirement(s):
---------------------------
package:(&(package=org.apache.http.client.entity)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.apache.http.conn.ssl)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.representations.idm)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.keycloak.jose.jws)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.keycloak.jose.jws.crypto)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.impl.conn)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.apache.http.conn.scheme)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.representations.adapters.action)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.impl.conn.tsccm)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.cookie)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.apache.http.conn)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.representations)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.keycloak.representations.adapters.config)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.params)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.util.reflections)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.client)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.apache.http)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.apache.http.message)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.util)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.client.methods)(version>=4.3.6))
Keycloak Adapter Core
package:(&(package=org.keycloak.enums)(version>=1.3.1.Final))
Keycloak Adapter Core
package:(&(package=org.apache.http.impl.client)(version>=4.3.6))
Keycloak Adapter Core
9 years, 6 months
passing tokens to a servlet with cors
by Juan Diego
Hi
I have an upload servlet https://gist.github.com/jdc18/c6c8689e269e655581cb,
I tested before without keycloak and it worked. But when I activate
keycloak I get " No 'Access-Control-Allow-Origin' header is present on the
requested resource.", my rest services do work with CORS. I have my page
with angular and my backend with java.
My backend is similar to the database service example.
9 years, 6 months
Tried to update database from 1.2.0.Beta1 to 1.2.0.Final
by Dean Peterson
I receive this error:
Caused by: java.lang.RuntimeException: Failed to update database
at
org.keycloak.connections.mongo.updater.impl.DefaultMongoUpdaterProvider.update(DefaultMongoUpdaterProvider.java:93)
at
org.keycloak.connections.mongo.DefaultMongoConnectionFactoryProvider.lazyInit(DefaultMongoConnectionFactoryProvider.java:95)
... 35 more
Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "kcdb/
172.17.5.191:27017" , "nIndexesWas" : 1 , "ok" : 0.0 , "errmsg" : "index
not found with name [realmId_1_name_1]"}
at com.mongodb.CommandResult.getException(CommandResult.java:71)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:110)
9 years, 6 months
Securing backend rest methods
by Juan Diego
Hi,
I was looking in the examples but I cannot find the right one. Is there an
example that shows how to secure just a method of a rest for a certain
group, allow all groups to the rest method. Like in picketlinks you could
create your own @Admin @Mygroup annotation and add it to a function.
Thanks,
Juan diego
9 years, 6 months
Multi tenant
by Bellan Saravanan
If we are managing users for multiple customers in a single keycloak instance, is it recommended to have users from those tenants in different realms?
The problem I'm having is since we have single application which resolves to different realms based on the user's email address, I have to duplicate the Client/Application configuration under each of the realm. Is there some way to avoid these duplicate Client/Application configurations?
Thanks,
9 years, 6 months
Load bearer-only app resource to iframe
by Tair Sabirgaliev
Hi!
I have a REST resource /rest/some/pdf in bearer-only application. The client app uses angular, I have setup it according to keycloak demos.
On my angular page i have an <iframe src=“/rest/some/pdf”….>. I can’t pass auth headers to iframe url. What is the right thing to do here?
Thank you!
--
Tair Sabirgaliev
Bee Software, LLP
9 years, 6 months