1 22 package org.jboss.ejb.plugins.jms; 23 24 import java.security.PrivilegedAction ; 25 import java.security.AccessController ; 26 27 import org.jboss.security.SecurityAssociation; 28 29 34 class SecurityActions 35 { 36 interface SubjectActions 37 { 38 SubjectActions PRIVILEGED = new SubjectActions() 39 { 40 private final PrivilegedAction clearAction = new PrivilegedAction () 41 { 42 public Object run() 43 { 44 SecurityAssociation.clear(); 45 return null; 46 } 47 }; 48 49 public void clear() 50 { 51 AccessController.doPrivileged(clearAction); 52 } 53 }; 54 55 SubjectActions NON_PRIVILEGED = new SubjectActions() 56 { 57 public void clear() 58 { 59 SecurityAssociation.clear(); 60 } 61 }; 62 63 void clear(); 64 } 65 66 static void clear() 67 { 68 if(System.getSecurityManager() == null) 69 { 70 SubjectActions.NON_PRIVILEGED.clear(); 71 } 72 else 73 { 74 SubjectActions.PRIVILEGED.clear(); 75 } 76 } 77 } 78 | Popular Tags |