[keycloak-user] Last Login Time of User

Marek Posolda mposolda at redhat.com
Wed May 11 03:23:12 EDT 2016


Another possibility is to look at userSession (this info is available in 
admin console). When user authenticates, the new userSession is created 
for him with the "started" attribute containing the time of 
authentication. In admin console (and also via REST endpoints) there is 
possibility to look at all userSessions of particular user, so you can 
chose the one with last "started" attribute.

This requires some additional work for parse userSessions and also there 
is corner case when this info is not accurate (as new userSession is 
also created when "verify-email" is requested for particular user, which 
is not the time of successful authentication of particular user).

On the other hand, you don't need the custom Authenticator 
implementation. And there is also performance penalty in store the info 
in DB in user attributes, because you need to write to DB and update 
user during each login.

Marek


On 10/05/16 17:10, Thomas Darimont wrote:
> Would be great to store some additional information like:
> - count of failed logins
> - last failed login date
>
> Cheers,
> Thomas
>
> 2016-05-10 14:38 GMT+02:00 Thomas Darimont 
> <thomas.darimont at googlemail.com <mailto:thomas.darimont at googlemail.com>>:
>
>     Hello,
>
>     I implemented a custom RequiredAction that maintains stuff like:
>     - first login time
>     - most recent login time
>     - login count
>     in user attributes.
>
>     Cheers,
>     Thomas
>
>     2016-05-10 14:35 GMT+02:00 Lohitha Chiranjeewa <kalc04 at gmail.com
>     <mailto:kalc04 at gmail.com>>:
>
>         Hi,
>
>         Is there a way to retrieve the last login time of a given user?
>
>         I checked the Admin Console, Rest specification and the mysql
>         DB structure but couldn't find a place where that bit of
>         information could be stored and retrieved from. Have I missed
>         a place or is that feature not available (yet)?
>
>
>         Regards,
>         Lohitha.
>
>         _______________________________________________
>         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
>
>
>
>
>
> _______________________________________________
> keycloak-user mailing list
> 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/20160511/ac956142/attachment.html 


More information about the keycloak-user mailing list