1 45 package org.openejb.ri.sp; 46 47 import java.security.Principal ; 48 import org.openejb.spi.SecurityService; 49 import org.openejb.util.FastThreadLocal; 50 51 public class PseudoSecurityService implements SecurityService { 52 53 private FastThreadLocal threadStorage = new FastThreadLocal( ); 54 55 public void init(java.util.Properties props ) { 56 props = props; 57 } 58 59 public Object getSecurityIdentity(){ 60 return threadStorage.get(); 61 } 62 public void setSecurityIdentity(Object securityIdentity){ 63 threadStorage.set(securityIdentity); 64 } 65 66 public boolean isCallerAuthorized(Object securityIdentity,String [] roleNames){ 67 return true; 69 } 70 71 public Object translateTo(Object securityIdentity, Class type){ 72 if(type == java.security.Principal .class){ 73 return new java.security.Principal (){ 74 public String getName(){return "TestRole";} 75 }; 76 }else if(type == javax.security.auth.Subject .class){ 77 return new javax.security.auth.Subject (); 78 }else{ 79 return null; 80 } 81 } 82 } | Popular Tags |