I would like to access the JAAS subject for an authenticated user. The JAAS approach
Subject subject = Subject.getSubject(AccessController.getContext());
returns null. What is the correct method to access the subject?
Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
I have just solved this problem myself.
The method is:
Subject subject = SecurityContext.getCurrent().getSubject();
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.