Wednesday, February 4, 2009

getting the current Subject in oc4j

This is a copy of an email I sent.

The problem: How do you get the subject associated with the currently authenticated user.

Solution: There are two ways in oc4j.

* The standard way

http://download.oracle.com/docs/cd/E12524_01/web.1013/e12514/authoriz.htm#CHDDAFBF

1. Configure JAAS mode and
2. invoke Subject.getSubject(AccessController.getContext());

* OC4J proprietary way

Invoke oracle.oc4j.security.Security.getSubject()

This requires an oc4j patchset in 10.1.3.3 and is automatically available in 10.1.3.4

No comments: