Java API documentation
by Alexander Chriztopher
Hi All,
Am using Keycloak 1.0.2.Final and am getting this error when using the rest
API :
Caused by:
*com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException*:
Unrecognized field "access_token" (class
org.keycloak.representations.AccessTokenResponse), not marked as ignorable
(7 known properties: "tokenType", "notBeforePolicy", "token", "expiresIn",
"sessionState", "refreshToken", "idToken"])
at [Source: org.apache.http.conn.EofSensorInputStream@11b8a95d; line: 1,
column: 18] (through reference chain:
org.keycloak.representations.AccessTokenResponse["access_token"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(
*UnrecognizedPropertyException.java:51*) [jackson-databind-2.3.2.jar:2.3.2]
at
com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(
*DeserializationContext.java:671*) [jackson-databind-2.3.2.jar:2.3.2]
at
com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(
*StdDeserializer.java:771*) [jackson-databind-2.3.2.jar:2.3.2]
at
com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(
*BeanDeserializerBase.java:1297*) [jackson-databind-2.3.2.jar:2.3.2]
at
com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(
*BeanDeserializerBase.java:1275*) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(
*BeanDeserializer.java:247*) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
*BeanDeserializer.java:118*) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.ObjectReader._bind(
*ObjectReader.java:1233*) [jackson-databind-2.3.2.jar:2.3.2]
at com.fasterxml.jackson.databind.ObjectReader.readValue(
*ObjectReader.java:677*) [jackson-databind-2.3.2.jar:2.3.2]
at
org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(
*ResteasyJackson2Provider.java:120*)
[resteasy-jackson2-provider-3.0.8.Final.jar:]
at
org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(
*AbstractReaderInterceptorContext.java:59*)
[resteasy-jaxrs-3.0.8.Final.jar:]
at
org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(
*AbstractReaderInterceptorContext.java:51*)
[resteasy-jaxrs-3.0.8.Final.jar:]
at
org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.aroundReadFrom(
*DigitalVerificationInterceptor.java:32*) [resteasy-crypto-3.0.8.Final.jar:]
at
org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(
*AbstractReaderInterceptorContext.java:53*)
[resteasy-jaxrs-3.0.8.Final.jar:]
at
org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(
*GZIPDecodingInterceptor.java:59*) [resteasy-jaxrs-3.0.8.Final.jar:]
at
org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(
*AbstractReaderInterceptorContext.java:53*)
[resteasy-jaxrs-3.0.8.Final.jar:]
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(
*ClientResponse.java:248*) [resteasy-client-3.0.8.Final.jar:]
... 164 more
Was wondering where this comes from as am using the 1.0.2.Final admin api
and have updated my Wildfly Server accordingly.
10 years, 12 months
Getting the current user name in EJB
by Alexander Chriztopher
Hi All,
Am trying to get the name and surname of the currently connected user by
doing this :
import java.io.Serializable;
import java.security.Principal;
import javax.annotation.Resource;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJBContext;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import org.jboss.ejb3.annotation.SecurityDomain;
@Stateless(name="myEJB")
@LocalBean
@SecurityDomain("keycloak")
public class MyEJB implements Serializable {
private static final long serialVersionUID = 1L;
@Resource
private EJBContext ejbContext;
@RolesAllowed("ADMIN")
public void test() {
Principal principal = ejbContext.getCallerPrincipal();
System.out.println("principal.getName() = " + principal.getName());
}
}
This works nicely as i get a 403 if my currently connected user does have
the role : ADMIN.
My question is : does keycloak propagate the username or any other
information that would help me get the first name and last name of the
currently connected user ? Unfortunately, principal.getName() returns a
string like this : edd42240-85bf-4724-8d79-5374338506b7 which i don't know
the interpretation !
Thanks for any help.
10 years, 12 months
Problems Authenticating with OpenLDAP
by robinfernandes .
Hi guys,
I am using *Keycloak 1.0.1* final and I have integrated it with *OpenLDAP*.
When I try to authenticate the user which is in LDAP, it is not able to
authenticate it and the exception that comes up is "
*org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "USER_ENTITY" ;
"*
Is there anyone who has faced this problem? Is there a way to set the lock
table timeout to be more than what it is by default?
The other thing is, I tried authenticating with *Active Directory *and it
works just fine. So I am guessing the problem is limited to OpenLDAP.
Any help would be appreciated.
Thanks,
Robin
11 years
updateToken method not working
by Dean Peterson
I use the following code to make sure I have a valid token before making a
request. Even though I am logged in, if I wait until the token expires
then make a request, the error function is called most of the time when I
try to update the token using the updateToken method. I have the page
reload, and I have a valid token again. However, I did not have to log in
again because the session had not expired. I am using
1.1.0-Alpha1-SNAPSHOT I have read the documentation. Am I missing
something?
keycloak.updateToken().success(function() {
if (data) {
$http({
url: 'http://localhost:8080' + url,
method: method,
data: data,
headers: {
'Content-Type': contentType,
'Accept': acceptType,
'Authorization': 'Bearer ' + service.auth.token
},
transformRequest: angular.identity
}).success(success).error(error);
} else {
$http({
url: 'http://localhost:8080' + url,
method: method,
headers: {
'Content-Type': contentType,
'Accept': acceptType,
'Authorization': 'Bearer ' + service.auth.token
}
}).success(success).error(error);
}
}).error(function() {
alert("Token could not be refreshed!");
location.reload();
});
11 years
Openid connect end points
by Raghuram
Does key cloak fully support open ID connect specification? I failed to figure out the following end points -
1. /authorize
2. /userinfo
3. /well-known/webfinger (optional as per spec)
Can you please guide me to an example that shows the above calls? Any help would be appreciated.
Thanks
Sent from my iPhone
11 years
Mongo DB Connections Issue
by prab rrrr
I configured Keycloak 1.0.3 to use Mongodb and created a new realm, added a user and deleted the user. While doing so I noticed that Keycloak opens 1 connection each for almost any update/insert/delete and it doesn't close them. 24 Connections were opened for 1 user performing those operations and they remained open even after 3 hrs of inactivity.
Can a fix be put in for this issue?
11 years
CORPS support enabled for JBoss EAP- Version 6.1.1.GA
by Vikash, Abhijit
??
Hi,
We need CORPS support enabled for JBoss Enterprise Application Platform - Version 6.1.1.GA
environment.
Please let know from where we can get the latest version of keycloak-eap6-adapter-dist.zip file.
Tried to configure from the below instructions but unable to make the call to the server.
http://docs.jboss.org/keycloak/docs/1.0-alpha-3/userguide/html/ch06.html#....
Please let know what we need to configure in standalone-full.xml
Also, we need to build CLI script to enable CORPS support from a command line.
Thanks,
Abhijit
Regards
Abhijit Vikash
Tata Consultancy Services
No 42, Think campus
Electronic City phase II
Bangalore - 560100,Karnataka
India
11 years