Examples of EJBContextHelper


Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

public class SecuredBean
{
   public Principal getCallerPrincipal() throws Exception
   {
      SecurityContext prevSC = SecurityContextAssociation.getSecurityContext();
      EJBContextHelper helper = new EJBContextHelper();
      final SecurityContext sc = SecurityContextFactory.createSecurityContext("TestApp");
      if(prevSC != null)
         sc.setSubjectInfo(prevSC.getSubjectInfo());
      sc.setSecurityManagement(new ISecurityManagement()
      {
         public AuthenticationManager getAuthenticationManager(String securityDomain)
         {
            return lookup("java:AuthenticationManager", AuthenticationManager.class);
         }

         public AuthorizationManager getAuthorizationManager(String securityDomain)
         {
            throw new RuntimeException("NYI");
         }

         public MappingManager getMappingManager(String securityDomain)
         {
            throw new RuntimeException("NYI");
         }

         public AuditManager getAuditManager(String securityDomain)
         {
            return null;
         }

         public IdentityTrustManager getIdentityTrustManager(String securityDomain)
         {
            throw new RuntimeException("NYI");
         }
      });
      SecurityContextAssociation.setSecurityContext(sc);
      try
      {
         EJBAuthenticationHelper authenticationHelper = SecurityHelperFactory.getEJBAuthenticationHelper(sc);
         Subject subject = new Subject();
         boolean isValid = authenticationHelper.isValid(subject, "getCallerPrincipal");
         if(!isValid)
         {
            Exception cause = (Exception) sc.getData().get("org.jboss.security.exception");
            throw new RuntimeException("no valid principal", cause);
         }
         authenticationHelper.pushSubjectContext(subject);
         //RealmMapping rm = (RealmMapping) sc.getAuthenticationManager();
         RealmMapping rm = lookup("java:AuthenticationManager", RealmMapping.class);
         SecurityDomain domain = null;
         return helper.getCallerPrincipal(sc, rm, domain);
      }
      finally
      {
         SecurityContextAssociation.clearSecurityContext();
      }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here

Examples of org.jboss.ejb3.security.helpers.EJBContextHelper

      assert beanContext != null : "beanContext is null";
     
      this.beanContext = beanContext;
      this.container = beanContext.getContainer();
      this.rm = container.getSecurityManager(RealmMapping.class);
      this.ejbContextHelper = new EJBContextHelper();
     
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.