[英]JAAS - How can the Subject be retrieved outside of the LoginModule?
我正在使用Tomcat 8,並且需要在LoginModule之外獲取Subject。 我已經嘗試過:
Subject subject = Subject.getSubject(AccessController.getContext());
但這每次都會返回null。 有人有想法么?
我使用了一個可以包含Subject
的自定義Principal
,並將JAAS登錄模塊設置為Principal
,然后使用request.getUserPrincipal()
將其返回到Web應用程序內部,將其轉換為我的自定義類,然后調用getSubject()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.