Skanda Prasad wrote:
> Hi All,
>
> I'm clearing the SecurityContext on server shutdown using the following
> code:
>
> com.sun.enterprise.security.SecurityContext.setCurrent(null);
> com.sun.enterprise.security.SecurityContext sc =
> com.sun.enterprise.security.SecurityContext.getCurrent();
> sc.getSubject().getPrincipals().clear();
> sc.getSubject().getPrivateCredentials().clear();
> sc.getSubject().getPublicCredentials().clear();
>
> But after the domain/server restart, i find that all the Principals still
> exist in the SecurityContext....
>
> Could someone please let me know how to clear the SecurityContext???
>
>
Not sure what you mean by : "i find that all the Principals still
exist" (i mean can you give us a testcase of what you are trying to
do). Clearing SecurityContext during shutdown does not seem to make
sense (unless i am missing your point) since it is not a Persistent entity.
Note : SecurityContext.getCurrent() will always return a Non-Null value
(even if there was a preceeding call to
SecurityContext.setCurrent(null)) and the getSubject() call on it may
have a default empty subject.
regards,
kumar
> Regards,
> Skanda
>