Set custom session attribute after successful login

Hello!

Is there a way to set custom session attribute after login?

I need this because I have app with custom User not extending CubaUser. So in order to set access group for user to have permission to view only his records I need that custom session attribute to be set for this user after login taken from his login name for example.

I am looking at documentation for some events and listeners after login with no success so far.

Thank you in advance!

Hi,

Look here: Web Login - CUBA Platform. Developer’s Manual
You probably need UserSessionStartedEvent.

Regards,
Konstantin

Or you can implement event handler for com.haulmont.cuba.security.auth.events.AuthenticationSuccessEvent on middleware and add your custom session attribute to the session.

See also login events on middleware.

Thank you both for the advises! I fixed the issue.