1 22 package org.jboss.test.jmx.interceptors; 23 24 import org.jboss.mx.interceptor.AbstractInterceptor; 25 import org.jboss.mx.interceptor.Interceptor; 26 import org.jboss.mx.server.Invocation; 27 import org.jboss.logging.Logger; 28 29 33 public final class SecurityInterceptor 34 extends AbstractInterceptor 35 { 36 private static Logger log = Logger.getLogger(SecurityInterceptor.class); 37 38 private String securityDomain; 39 40 public String getSecurityDomain() 41 { 42 return securityDomain; 43 } 44 45 public void setSecurityDomain(String securityDomain) 46 { 47 log.info("setSecurityDomain: " + securityDomain); 48 this.securityDomain = securityDomain; 49 } 50 51 public Object invoke(Invocation invocation) throws Throwable 53 { 54 String opName = invocation.getName(); 55 log.info("invoke, opName=" + opName); 56 if (opName != null && opName.startsWith("secret")) 57 { 58 throw new SecurityException ("No secret methods are invocable"); 59 } 60 Interceptor i = invocation.nextInterceptor(); 61 return i.invoke(invocation); 62 } 63 } 64 | Popular Tags |