#1 2024-07-30 09:28:17

Kritsanapong
Member
Registered: 2024-07-17

Adding users to groups in Custom PAM

Hi,

I am looking to put ReportServer behind my company portal and have the portal forward the authenticated user's information to ReportServer for Single Sign-On without having them re-login to ReportServer.

So, I created a custom PAM and within the authenticate method, I was going to authenticate the user and assign them to their respective groups. I was able to authenticate the user but am having trouble with assigning the users to their respective groups. I am assigning the user to the groups by calling

user.setGroups(groups)

and then calling

userManagerService.persist(user)

on the user entity. However, this does not work and the user was not assigned to any groups.

Could you provide an example on how to correctly assign users to groups within a custom PAM?

Thanks,

Offline

#2 2024-07-30 10:02:18

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Adding users to groups in Custom PAM

Hi Kritsanapong,

pls try with

userManagerService.merge(user)

as your user already exists. Persist is only for creating the new user.

Regards,
Eduardo

Offline

#3 2024-07-30 11:03:30

Kritsanapong
Member
Registered: 2024-07-17

Re: Adding users to groups in Custom PAM

Hi Eduardo,

Thanks for the response. I tried calling

userManagerService.merge(user)

and tried querying the user and calling

user.getGroups()

I can see the groups I assigned.
However, the users are still not shown under the group in the Adminstration > Users and Groups page

So I tried querying the groups after calling merge on the user and calling

group.getUsers()

However, this is returning an empty array.

Do I need to call merge on the each of the Group entities that I assign to the user too?

Offline

#4 2024-08-01 10:06:07

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Adding users to groups in Custom PAM

Hi Kritsanapong,

you should be able to set the users using:
net.datenwerke.security.service.usermanager.entities.Group.setUsers(Set<User>)

for the specific group.

Merging the modified groups should be enough. You don't need to merge the users.

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB