What whould be the usage? I don't know what you would gain over the current getContext shortcut to the data.
I was writing a standalone testcase that would need to set a dummy subject on the thread and I could retrieve later the PolicyContext way.
I had to do:
a) Register the subjectcontexthandler in the PolicyContext.
b) Set the subject on the SecurityAssociation.
c) Sometime later, the authenticated subject is done via PolicyContext.
So instead of doing the step of associating the subject on the SecurityAssociation, I wondered if it was a good idea to get the handler for the subject_context key and see if there is a method to set the subject there. Just a thought. I know that the SA is a jboss way and also obtaining the Subject from the PolicyContext is again a JBoss way (even though it is kind of supported via the spec).
That is when, I thought retrieving the handler, that the serverside has registered with the PolicyContext, would be nice. But I was unsure of the advantages and any potential dangers of doing this. But this is a trivial doubt I had.