1 22 package org.jboss.web.tomcat.security; 23 24 import javax.security.jacc.PolicyContextException ; 25 import javax.security.jacc.PolicyContextHandler ; 26 import javax.servlet.http.HttpServletRequest ; 27 28 32 public class HttpServletRequestPolicyContextHandler implements PolicyContextHandler 33 { 34 public static final String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest"; 35 private static ThreadLocal requestContext = new ThreadLocal (); 36 37 static void setRequest(HttpServletRequest bean) 38 { 39 requestContext.set(bean); 40 } 41 42 48 public Object getContext(String key, Object data) 49 throws PolicyContextException 50 { 51 Object context = null; 52 if( key.equalsIgnoreCase(WEB_REQUEST_KEY) == true ) 53 context = requestContext.get(); 54 return context; 55 } 56 57 public String [] getKeys() 58 throws PolicyContextException 59 { 60 String [] keys = {WEB_REQUEST_KEY}; 61 return keys; 62 } 63 64 public boolean supports(String key) 65 throws PolicyContextException 66 { 67 return key.equalsIgnoreCase(WEB_REQUEST_KEY); 68 } 69 70 } 71 | Popular Tags |