Examples of SecurityContext


Examples of org.jboss.security.SecurityContext

   private void establishSecurityContext(Invocation mi) throws Exception
   {
      //For Local EJB invocations, the security context needs
      //to be obtained from the thread local. For remote ejb
      //invocations, the SC is obtained in the invocation
      SecurityContext sc = mi.getSecurityContext();
      SecurityContext newSC = SecurityActions.createAndSetSecurityContext(securityDomain,
            container.getSecurityContextClassName())
     
      if(sc != null)
      {  
         //Get the run-as, principal, cred etc from the invocation and set it on the context
View Full Code Here

Examples of org.jboss.security.SecurityContext

   {
      return AccessController.doPrivileged(new PrivilegedExceptionAction<SecurityContext>()
      {
         public SecurityContext run() throws Exception
         {
            SecurityContext sc =  SecurityContextFactory.createSecurityContext(domain, fqnClassName);
            setSecurityContext(sc);
            return sc;
         }}
      );
   }
View Full Code Here

Examples of org.jboss.security.SecurityContext

   static void pushCallerRunAsIdentity(final RunAs ra)
   {
      AccessController.doPrivileged(new PrivilegedAction<Object>(){
         public Object run()
         {
            SecurityContext sc = SecurityContextAssociation.getSecurityContext();
            if(sc == null)
               throw new IllegalStateException("Security Context is null");
            sc.setIncomingRunAs(ra);
            return null;
         }
      });
   }
View Full Code Here

Examples of org.jboss.security.SecurityContext

   static void popCallerRunAsIdentity()
   {
      AccessController.doPrivileged(new PrivilegedAction<Object>(){
         public Object run()
         {
            SecurityContext sc = SecurityContextAssociation.getSecurityContext();
            if(sc == null)
               throw new IllegalStateException("Security Context is null");
            sc.setIncomingRunAs(null);
            return null;
         }
      });
   }
View Full Code Here

Examples of org.jboss.security.SecurityContext

      return new InvocationResponse(names[0]);
   }
  
   private void establishSecurityContext(InvocationRequest invocation) throws Exception
   {
      SecurityContext newSC = SecurityActions.createAndSetSecurityContext(securityDomain)

      // Set the SecurityManagement on the context
      SecurityActions.setSecurityManagement(newSC, securityManagement);
      log.trace("establishSecurityIdentity:SecCtx="+SecurityActions.trace(newSC));
   }
View Full Code Here

Examples of org.jboss.security.SecurityContext

   {
      return AccessController.doPrivileged(new PrivilegedExceptionAction<SecurityContext>()
      {
         public SecurityContext run() throws Exception
         {
            SecurityContext sc =  SecurityContextFactory.createSecurityContext(domain);
            setSecurityContext(sc);
            return sc;
         }}
      );
   }
View Full Code Here

Examples of org.jboss.security.SecurityContext

    * retrieves the instance from an object table, and invokes the method
    * on the particular instance
    */
   public Object internalInvoke(Invocation mi) throws Exception
   {
      SecurityContext cachedContext = null;
      try
      {
         cachedContext = SecurityActions.getSecurityContext();
         //For message driven beans, there is no security context
         SecurityActions.setSecurityContext(null);
View Full Code Here

Examples of org.jboss.security.SecurityContext

         if (newCL != null && newCL != oldCL)
            SecurityActions.setContextClassLoader(newCL);

         //JBAS-6449: Cache the incoming security context to be retained on exit
         SecurityContext previousSecurityContext = SecurityActions.getSecurityContext();

         try
         {
            // Set the method hash to Method mapping
            if (invocation instanceof MarshalledInvocation)
            {
               MarshalledInvocation mi = (MarshalledInvocation) invocation;
               mi.setMethodMap(marshalledInvocationMapping);
            }
            // Invoke the MBeanServer method via reflection
            Method method = invocation.getMethod();
            Object[] args = invocation.getArguments();
            Principal principal = invocation.getPrincipal();
            Object credential = invocation.getCredential();
            Object value = null;
            SecurityContext sc = SecurityActions.createSecurityContext(SecurityConstants.DEFAULT_APPLICATION_POLICY);
            SecurityActions.setSecurityContext(sc);
            // Associate the method
            SecurityActions.pushSubjectContext(principal, credential, null);

            try
View Full Code Here

Examples of org.jboss.security.SecurityContext

    * @return
    * @throws Throwable
    */
   public Object invoke(Invocation invocation) throws Throwable
   {
    SecurityContext previousSC = null;
      String type = invocation.getType();
      Subject subject = null;
      if (!initialized)
         initialize();
      if (type == Invocation.OP_INVOKE && securityMgr != null)
      {
         String opName = invocation.getName();
         if (opName.equals("invoke"))
         {
            Object[] args = invocation.getArgs();
            org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
            // Authenticate the caller based on the security association
            Principal caller = inv.getPrincipal();
            Object credential = inv.getCredential();
            subject = new Subject();
            boolean isValid = securityMgr.isValid(caller, credential, subject);
            if (isValid == false)
            {
               String msg = "Failed to authenticate principal=" + caller + ", securityDomain="
                     + securityMgr.getSecurityDomain();
               throw new SecurityException(msg);

            }
            String securityDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
            if (securityMgr != null)
               securityDomain = securityMgr.getSecurityDomain();
            // store current security context
            previousSC = SecurityActions.getSecurityContext();
            SecurityContext sc = SecurityActions.createSecurityContext(securityDomain);
            SecurityActions.setSecurityContext(sc);
            // Push the caller security context
            SecurityActions.pushSubjectContext(caller, credential, subject);
         }
      }
View Full Code Here

Examples of org.jboss.security.SecurityContext

  
   @Override
   public void invoke(Request request, Response response)
   throws IOException, ServletException
   {
      SecurityContext cachedContext = null;
     
      boolean createdSecurityContext = false;
      //Set the security context if one is unavailable
      SecurityContext sc = SecurityAssociationActions.getSecurityContext();
      if(sc != null &&
            sc.getSecurityDomain().equals(configuredSecurityDomainName) == false)
      {
         cachedContext = sc;
         SecurityContext newSC = createSecurityContext();
         SecurityAssociationActions.setSecurityContext(newSC);
         createdSecurityContext = true;
      }
     
      if(sc == null)
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.