1

In my application, I would need to obtain my custom principal object when I call request.getUserPrincipal(). Application is deployed in wildfly 26 server. So far I tried to use custom login module with JAAS-realm, than I tried to implement custom security realm. In both ways, when I call request.getUserPrincipal(), instance of NamedPrincipal is returned back.

Is there any possible way to get custom principal object out of request in elytron security?

Mono
  • 206
  • 1
  • 21
  • Is the object itself custom? Or do you mean the getter is returning null? – Will Tatam Oct 11 '22 at 08:14
  • The object of a principal is custom one. Its defined in my login module / security domain. I got a bit further and now I know, that from elytron subsystem there is no way to get custom principal object out :( The way to get similar functionality is to define custom secuirty identity. – Mono Oct 12 '22 at 07:26

1 Answers1

0

I think you are running into this unresolved issue https://issues.redhat.com/browse/WFCORE-5809 . You can upvote it or write a specific comment there.

Depending on why you need a custom principal class, you can maybe utilize attributes of SecurityIdentity if you need to obtain a specific information about the principal.

diavil
  • 81
  • 4
  • Yes, this was actually the only way to get user information out of security domain. Bit downgrade in comparison with legacy security subsystem with custom principals, because attributes of security identity are just string to string pairs. – Mono Nov 09 '22 at 16:09