Custom principal with elytron

88 views
Skip to first unread message

Radek Zikmund

unread,
Oct 10, 2022, 6:42:10 PM10/10/22
to WildFly
Hello,

I am trying to migrate our legacy JAAS login modules into elytron. So far I found out that there is no way to use custom principal object with elytron (I tried that with JAAS realm first, than with custom realm, no luck).
I also tried another way to get my custom principal to the application through session attribute, but the way to get the request object inside login module, which was possible earlier with:
PolicyContext.getContext("javax.servlet.http.HttpServletRequest")
is no longer working.
I found here how to populate security identity with attributes, which would be some kind of a workaround, but can I get this security identity inside JSP application? The examples I found were using EJB and I didn´t find any way to get it from JSP.

So for it seems to me, that there is no way to migrate our legacy security solution without complete rewrite of our application.

Thanks for any suggestions.

Radek Zikmund

unread,
Oct 11, 2022, 8:38:09 AM10/11/22
to WildFly
I found it in the end. The way to obtain security identity in application is to add elytron to the dependencies a than call:
SecurityDomain.getCurrent().getIdentity(Principal principal);
Reply all
Reply to author
Forward
0 new messages