Re: [keycloak-user] Logging out
by Peterson, Dean (MNIT)
Ok, that makes sense. I am still trying to figure out how k_logout should work on my end. I do have the keycloak modules installed on the server running my app. However, I still get a value of false in logoutApplication:
Response response = client.target(managementUrl).path(AdapterConstants.K_LOGOUT).request().post(Entity.text(token));
boolean success = response.getStatus() == 204;
The success Boolean is false. I set the Admin url to some path with "admin" but I do not have a REST service at any location for .../admin/.../k_logout. Am I supposed to do something on my end or should the keycloak modules have automatically set something up that understands how to handle a request to something like .../admin/.../k_logout?
I just would have liked to make all of this a bit easier. Why can't I create some REST service on my end that calls something like: KeycloakSecurityContext.logout(); Under the covers KeycloakSecurityContext.logout() builds the logout uri, sends the request to the keycloak server and finally logs me out of the local application?
10 years, 9 months
Logging out
by Dean Peterson
Logging out seems unnecessarily complicated. I need to have a management
url located in my application?
I use KeycloakUriBuilder to build the logout url and end up in the
logoutApplication method of ResourceAdminManager. That is where I am at a
loss. The application is expecting I have something in my app with a path
that contains "k_logout". What should happen at that location? What code
goes in the REST service at that location on my end?
Also, if I do not fill out the "Admin" url inside keycloak, the
managementUrl parameter comes back as an empty string instead of null.
That causes an error because the if statement in the logoutApplication
method only checks for null.
Thanks,
Dean
10 years, 9 months
Spring Keycloak Security integration? (I can't go back)
by Dean Peterson
I am currently using Keycloak for a proof of concept at my job working on
the unemployment insurance application for the State of MN. I love it, it
is great. There I am using Wildfly and everything is easy. However, every
second of my free time is spent writing www.metroseattlegamers.com (soon to
be abecorn.com). I have been working on that a long time. It is three
separate Spring applications tied together with REST and spring security
for single sign on. The main site is an oauth2 authorization provider; I
use a combination of spring social, spring oauth/oauth 2 to let users share
credentials between the apps of the site. I spend a lot of time just
keeping it all straight. I very much want to use Keycloak for my own
Spring project too. Any suggestions how I might get that to work? Do you
have plans to make Keycloak compatible with Spring applications running on
Tomcat?
10 years, 9 months
That did the trick (JPA transaction errors)
by Dean Peterson
Setting the idle timeout to 1 minute worked.
On Mon, Mar 17, 2014 at 9:19 AM, Stian Thorgersen <stian(a)redhat.com> wrote:
> You should still be able to use Azure, you just need to configure your
> datasource to do validation, or to timeout idle connections.
>
> Have a look at:
>
> https://docs.jboss.org/author/display/WFLY8/DataSource+configuration
>
> http://www.ironjacamar.org/doc/userguide/1.1/en-US/html_single/index.html...
>
> https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Appli...
>
> ----- Original Message -----
> > From: "Dean Peterson" <peterson.dean(a)gmail.com>
> > To: "Stian Thorgersen" <stian(a)redhat.com>
> > Cc: keycloak-user(a)lists.jboss.org
> > Sent: Monday, 17 March, 2014 2:02:53 PM
> > Subject: I think I know the cause of my JPA transaction errors
> >
> > I have mentioned it before but I am trying to get things to work using an
> > Azure MS-SQL database. Yes, I remember being told you will not support
> > that. Just in case it will spark some ideas I want to mention that I
> found
> > Azure closes database connections after one minute and end users have no
> > control over that:
> >
> http://blogs.msdn.com/b/avkashchauhan/archive/2011/11/12/windows-azure-lo...
> >
> > This is the behavior I am seeing. I log in, let the application sit
> until
> > I am automatically logged out and I always get this timeout error (sql
> > error: 0, SQLState: 08S01) when the JpaKeycloakSession.close() method is
> > called. I will probably have to switch to a local database.
> >
> >
> >
> > >
> >
>
10 years, 9 months
I think I know the cause of my JPA transaction errors
by Dean Peterson
I have mentioned it before but I am trying to get things to work using an
Azure MS-SQL database. Yes, I remember being told you will not support
that. Just in case it will spark some ideas I want to mention that I found
Azure closes database connections after one minute and end users have no
control over that:
http://blogs.msdn.com/b/avkashchauhan/archive/2011/11/12/windows-azure-lo...
This is the behavior I am seeing. I log in, let the application sit until
I am automatically logged out and I always get this timeout error (sql
error: 0, SQLState: 08S01) when the JpaKeycloakSession.close() method is
called. I will probably have to switch to a local database.
>
10 years, 9 months
External JS AJAX client for jax-rs backend API
by Rodrigo Del Canto
Hello guys,
Congrats on the release of project! I think this is the most useful project
for developers in the whole history of internet :D
I would like to know if you have any example on how to perform a login from
an external JavaScript client?
How would you recommend to do this. I heard you have a JS/jQuery lib to do
this, where can it be found?
Thanks,
delkant
10 years, 9 months
Tomcat / Jetty adapter
by Davide Ungari
Hi everybody,
I'm evaluating keycloak to be adopted in one of my projects.
At the moment I'm very satisfied, but I can not manage the dependency from
JBoss.
In our infrastructure we use tomcat and jetty. As you know is not only a
technical issue, for example out team members have a lot of experience on
tomcat and few of them barely know jboss.
Are there any adapter for tomcat? or even any documentation to write our
adapter?
--
Davide
10 years, 9 months
Trying to use JTA transactions for JPA causes errors
by Dean Peterson
I get transaction rollback errors frequently. Every time I leave the
application idle for a few minutes and come back, the system has
transaction errors. I have to refresh multiple times for the keycloak
admun-ui to start responding again. I realized my settings were using
local database transactions and that does not work well. I am using JBOSS
and J2EE so I definitely want to use the container managed transactions. I
switched the settings in my management console and changed my
persistence.xml to this:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="jpa-keycloak-identity-store"
transaction-type="JTA">
<jta-data-source>java:jboss/datasources/ui_users</jta-data-source>
<class>org.keycloak.models.jpa.entities.ApplicationEntity</class>
<class>org.keycloak.models.jpa.entities.CredentialEntity</class>
<class>org.keycloak.models.jpa.entities.OAuthClientEntity</class>
<class>org.keycloak.models.jpa.entities.RealmEntity</class>
<class>org.keycloak.models.jpa.entities.RequiredCredentialEntity</class>
<class>org.keycloak.models.jpa.entities.ApplicationRoleEntity</class>
<class>org.keycloak.models.jpa.entities.RealmRoleEntity</class>
<class>org.keycloak.models.jpa.entities.SocialLinkEntity</class>
<class>org.keycloak.models.jpa.entities.UserEntity</class>
<class>org.keycloak.models.jpa.entities.UserRoleMappingEntity</class>
<class>org.keycloak.models.jpa.entities.ScopeMappingEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServer2008Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
*Now when I start the server I get the following error:*
java.lang.NullPointerException
at
org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:76)
at
.
.
.
org.keycloak.models.jpa.JpaKeycloakSessionFactory.createSession(JpaKeycloakSessionFactory.java:21)
at
.
.
.
jboss.undertow.deployment.default-server.default-host./auth: Failed to
start service
Caused by: java.lang.RuntimeException: Failed to construct public
org.keycloak.server.KeycloakServerApplication(javax.servlet.ServletContext)
throws java.io.FileNotFoundException
Any ideas why this is happening?
Thanks,
Dean Peterson
10 years, 9 months
Maven compile Alpha 1.3
by Davide Ungari
Hi everybody,
I did checkout of the 1.0-alpha-3.
I'm trying to do a mvn compile war:war and it fails for:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile
(default-compile) on project keycloak-model-api: Compilation failure:
Compilation failure:
[ERROR]
/home/davide/projects/keycloak/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java:[14,24]
error: package org.keycloak.util does not exist
[ERROR]
[ERROR]
/home/davide/projects/keycloak/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java:[35,23]
error: cannot find symbol
[ERROR]
[ERROR] class KeycloakModelUtils
[ERROR]
/home/davide/projects/keycloak/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java:[47,23]
error: cannot find symbol
[ERROR]
[ERROR] class KeycloakModelUtils
[ERROR]
/home/davide/projects/keycloak/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java:[65,15]
error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
Any help?
--
Davide
10 years, 9 months