private boolean shouldBypassSecurity(Invocation mi) throws Exception { // If there is not a security manager then there is no authentication required Method m = mi.getMethod(); boolean containerMethod = m == null || m.equals(ejbTimeout); if (containerMethod == true || securityManager == null || container == null) { // Allow for the propagation of caller info to other beans SecurityActions.createAndSetSecurityContext(mi.getPrincipal(), mi.getCredential(), "BYPASSED-SECURITY"); if (this.runAsIdentity != null) SecurityActions.pushRunAsIdentity(runAsIdentity); return true; } return false; }
public Object invoke(Invocation mi) throws Exception { EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext(); if(ctx == null) throw new IllegalStateException("EJBContext is null"); //Set the current security information ctx.setPrincipal(mi.getPrincipal()); try { // Invoke through interceptors return getNext().invoke(mi); } finally { } }
/** * Store the required information from this invocation: principal, * transaction, method, time. * * @param begin invocation begin time in ms * @param end invocation end time in ms */ private final void addEntry(Invocation mi, long begin, long end) { /* this gets called by the interceptor */ Transaction tx = mi.getTransaction(); Principal princ = mi.getPrincipal(); Method method = mi.getMethod(); Entry start = new Entry(princ, method, tx, begin, "START"); Entry stop = new Entry(princ, method, tx, end, "STOP"); // add both entries, order is guaranteed, synchronized to prevent // publisher from touching the queue while working on it synchronized (msgQueue) { // Two entries for now, one should suffice but requires changes in // the client. msgQueue.add(start); msgQueue.add(stop); } }
public Object invokeHome(Invocation mi) throws Exception { Method getEJBObject = Handle.class.getMethod("getEJBObject", new Class[0]); //Invocation on the handle, we don't need a bean instance if (getEJBObject.equals(mi.getMethod())) return getNext().invokeHome(mi); EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext(); if(ctx == null) throw new IllegalStateException("EJBContext is null"); //Set the current security information ctx.setPrincipal(mi.getPrincipal()); try { // Invoke through interceptors return getNext().invokeHome(mi); } finally { } } }
/** * Return loaded Security Context to be passed on the invocation * @param invocation invocation instance * @return */ private SecurityContext createSecurityContext(Invocation invocation) throws Exception { //There may be principal set on the invocation Principal p = invocation.getPrincipal(); Object cred = invocation.getCredential(); //Create a new SecurityContext String domain = (String) invocation.getInvocationContext().getValue(InvocationKey.SECURITY_DOMAIN); if(domain == null) domain = "CLIENT_PROXY"; return SecurityActions.createSecurityContext(p,cred, domain); }
throws Exception Principal principal = mi.getPrincipal(); boolean trace = log.isTraceEnabled();
org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0]; Principal caller = inv.getPrincipal();
public Object invokeHome(Invocation mi) throws Exception { // Apply any custom security checks if( securityProxy != null ) { EJBContext ctx = null; EnterpriseContext ectx = (EnterpriseContext)mi.getEnterpriseContext(); if( ectx != null ) ctx = ectx.getEJBContext(); Object[] args = mi.getArguments(); securityProxy.setEJBContext(ctx); try { securityProxy.invokeHome(mi.getMethod(), args); } catch(SecurityException e) { Principal principal = mi.getPrincipal(); String msg = "SecurityProxy.invokeHome exception, principal=" + principal; log.error(msg, e); throw e; } } return getNext().invokeHome(mi); }
public Object invoke(Invocation mi) throws Exception { // Apply any custom security checks if( securityProxy != null ) { EnterpriseContext ectx = (EnterpriseContext)mi.getEnterpriseContext(); Object bean = ectx.getInstance(); EJBContext ctx = ectx.getEJBContext(); Object[] args = mi.getArguments(); securityProxy.setEJBContext(ctx); try { securityProxy.invoke(mi.getMethod(), args, bean); } catch(SecurityException e) { Principal principal = mi.getPrincipal(); String msg = "SecurityProxy.invoke exception, principal="+principal; log.error(msg, e); throw e; } } return getNext().invoke(mi); } }
Principal principal = invocation.getPrincipal(); Object credential = invocation.getCredential(); Object value = null;
SecurityActions.createAndSetSecurityContext(mi.getPrincipal(), mi.getCredential(), securityDomain);
Principal principal = mi.getPrincipal(); Object credential = mi.getCredential(); authorizationHelper.setPolicyRegistration(container.getPolicyRegistration()); isAuthorized = SecurityActions.authorize(authorizationHelper, ejbName, ejbMethod, mi.getPrincipal(), mi.getType().toInterfaceString(), ejbCS, caller, callerRunAsIdentity, container.getJaccContextID(), new SimpleRoleGroup(methodRoles));
org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0]; Principal caller = inv.getPrincipal(); Object credential = inv.getCredential(); subject = new Subject();
ctx.setPrincipal(mi.getPrincipal());
ctx.setPrincipal(mi.getPrincipal());
ctx.setPrincipal(mi.getPrincipal());
ctx.setPrincipal(mi.getPrincipal());
ctx.setPrincipal(mi.getPrincipal());
if(am != null) securityDomain = am.getSecurityDomain(); SecurityActions.createAndSetSecurityContext(mi.getPrincipal(), mi.getCredential(), securityDomain , null);
ctx.setPrincipal(mi.getPrincipal());