<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>postLoginEvent - liferay6.2</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119708784" />
  <subtitle>postLoginEvent - liferay6.2</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119708784</id>
  <updated>2026-04-04T17:39:58Z</updated>
  <dc:date>2026-04-04T17:39:58Z</dc:date>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119718498" />
    <author>
      <name>Mic Izy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119718498</id>
    <updated>2020-08-06T13:32:23Z</updated>
    <published>2020-08-06T13:32:23Z</published>
    <summary type="html">Hello,&lt;br /&gt;I was able to add custom field in keycloack, and get it in LibAutoLogin:39. Thank you for your help.</summary>
    <dc:creator>Mic Izy</dc:creator>
    <dc:date>2020-08-06T13:32:23Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715856" />
    <author>
      <name>Jack Bakker</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715856</id>
    <updated>2020-08-06T01:07:34Z</updated>
    <published>2020-08-06T01:07:34Z</published>
    <summary type="html">Now that you have source for the plugin, you can debug. Add breakpoint at:&lt;br /&gt;&lt;br /&gt;oidc-lib/src/main/java/nl/finalist/liferay/oidc/LibAutoLogin.java:41&lt;br /&gt;&lt;br /&gt;and see if you are getting back a token claim name like &amp;#39;groups&amp;#39; (or &amp;#39;roles&amp;#39; or ...) in the userInfo&lt;br /&gt;&lt;br /&gt;if not then you&amp;#39;ll need to go into Keycloak and configure it till you do&lt;br /&gt;&lt;br /&gt;In my case:  &lt;br /&gt;- in keycloak under &amp;#34;User Federation : Openldap : LDAP Mappers&amp;#34; I added a group-ldap-mapper&lt;br /&gt;- under &amp;#34;Clients : MyClientId : Mappers : Create Protocol Mappers&amp;#34; I added a Mapper Type = Group Membership.&lt;br /&gt;&lt;br /&gt;Once you see the groups (or another token claim name) in userInfo, then there is additional code to add to extract it in Java (like in oidc-lib/src/main/java/nl/finalist/liferay/oidc/providers/UserInfoProvider.java) </summary>
    <dc:creator>Jack Bakker</dc:creator>
    <dc:date>2020-08-06T01:07:34Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715154" />
    <author>
      <name>Mic Izy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715154</id>
    <updated>2020-08-05T23:38:09Z</updated>
    <published>2020-08-05T23:38:09Z</published>
    <summary type="html">That tip was very helpful, I didn&amp;#39;t find way to extract info from token yet, but I did find way to modify group. &lt;br /&gt;Thank you so much!</summary>
    <dc:creator>Mic Izy</dc:creator>
    <dc:date>2020-08-05T23:38:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715492" />
    <author>
      <name>Jack Bakker</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119715492</id>
    <updated>2020-08-05T19:13:09Z</updated>
    <published>2020-08-05T19:13:09Z</published>
    <summary type="html">Hi again, so you possibly have at least the following two challenges: 1) writing a post login action and 2) extracting the roles from a token. Note that the code you gave is for a Pre not PostLogin. But, given the oidc-hook already has a Liferay62Adapter.createOrUpdateUser which adds or updates the Liferay user, why would you not also do the group association add/update in that same method ? You&amp;#39;d need to grab the source for the plugin.   </summary>
    <dc:creator>Jack Bakker</dc:creator>
    <dc:date>2020-08-05T19:13:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119714005" />
    <author>
      <name>Mic Izy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119714005</id>
    <updated>2020-08-05T15:54:54Z</updated>
    <published>2020-08-05T15:54:54Z</published>
    <summary type="html">Yes, the problem is the groups from keycloack users are not imported by oidc plugin. So what i am trying to do is add additional field in token. Question is, is it possible to get the token field in post login event and assing group according to it.&lt;br /&gt;&lt;br /&gt;Another way ( i belive it should be easier)  is to assing group according to email address, but still I am stack with trying to write post login action. </summary>
    <dc:creator>Mic Izy</dc:creator>
    <dc:date>2020-08-05T15:54:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119712775" />
    <author>
      <name>Jack Bakker</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119712775</id>
    <updated>2020-08-05T15:09:22Z</updated>
    <published>2020-08-05T15:09:22Z</published>
    <summary type="html">What I did in a devtest Liferay v6.2.5 was override the Liferay62Adapter.createOrUpdateUser to import from LDAP based on username or email address with:&lt;br /&gt;&lt;br /&gt;user = PortalLDAPImporterUtil.importLDAPUser(...&lt;br /&gt;&lt;br /&gt;but you may not be using LDAP, and from what you write it looks like you want to use roles from token</summary>
    <dc:creator>Jack Bakker</dc:creator>
    <dc:date>2020-08-05T15:09:22Z</dc:date>
  </entry>
  <entry>
    <title>RE: postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119711737" />
    <author>
      <name>Jack Bakker</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119711737</id>
    <updated>2020-08-05T14:13:19Z</updated>
    <published>2020-08-05T14:13:19Z</published>
    <summary type="html">In Liferay v6.2, you are using the &amp;#34;OpenID Connect plugin from the marketplace. (&lt;a href="https://web.liferay.com/marketplace/-/mp/application/78695724"&gt;https://web.liferay.com/marketplace/-/mp/application/78695724&lt;/a&gt;). &lt;br /&gt;You want to associate Liferay usergroups with the user where the usergroups to be associated have the same name as roles associated with the user, roles that are returned by keycloak. You are using the add/update user feature that is built into the plugin.--Is what I write true ?</summary>
    <dc:creator>Jack Bakker</dc:creator>
    <dc:date>2020-08-05T14:13:19Z</dc:date>
  </entry>
  <entry>
    <title>postLoginEvent - liferay6.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119708783" />
    <author>
      <name>Mic Izy</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119708783</id>
    <updated>2020-08-05T11:28:45Z</updated>
    <published>2020-08-05T11:28:45Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hello,&lt;br&gt;&lt;br&gt;I used oidc hook, and now i'm able to login to liferay through oidc provider (keycloack). Now I need to set group of user according to property i get in token. So i thought I will get the property in post login event, and set user group there.&amp;nbsp;&lt;br&gt;I'm stuck with trying to print&amp;nbsp; test&amp;nbsp; pre login. What i did is:&lt;br&gt;&lt;br&gt;Added login.events.pre = com.proliferay.demo.CustomPreLoginAction in portal-ext.properties&lt;br&gt;Added&amp;nbsp;CustomPreLoginAction&amp;nbsp;class in my war file &lt;br&gt;Now after i get&amp;nbsp;CustomPreLoginAction .&lt;br&gt;&lt;br&gt;My&amp;nbsp;CustomPreLoginAction&amp;nbsp; class :&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;public class CustomPreLoginAction extends Action{

    @Override
    public void run(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
            throws ActionException {
        /**
         * Write your custom code here
         */
       System.out.println("Invoking this line before Login");

    }

}&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Can you please help me?&lt;br&gt;​​​​​​​Thank you&amp;nbsp;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Mic Izy</dc:creator>
    <dc:date>2020-08-05T11:28:45Z</dc:date>
  </entry>
</feed>
