Package org.jboss.ejb3.annotation

Examples of org.jboss.ejb3.annotation.SecurityDomain


/* 158 */       RealmMapping rm = (RealmMapping)this.container.getSecurityManager(RealmMapping.class);
/*     */
/* 160 */       SecurityContext sc = SecurityContextAssociation.getSecurityContext();
/* 161 */       if (sc == null)
/*     */       {
/* 163 */         SecurityDomain domain = (SecurityDomain)ec.resolveAnnotation(SecurityDomain.class);
/* 164 */         String unauth = domain.unauthenticatedPrincipal();
/* 165 */         if ((unauth != null) && (unauth.length() > 0) &&
/* 166 */           (domain.unauthenticatedPrincipal() != null))
/* 167 */           callerPrincipal = new SimplePrincipal(unauth);
/*     */       }
/*     */       else
/*     */       {
/* 171 */         EJBAuthorizationHelper helper = new EJBAuthorizationHelper(sc);
/* 172 */         callerPrincipal = helper.getCallerPrincipal(rm);
/*     */       }
/*     */
/* 175 */       if (callerPrincipal == null)
/*     */       {
/* 178 */         callerPrincipal = sc.getUtil().getUserPrincipal();
/* 179 */         if (rm != null) {
/* 180 */           callerPrincipal = rm.getPrincipal(callerPrincipal);
/*     */         }
/*     */       }
/* 183 */       if (callerPrincipal == null)
/*     */       {
/* 185 */         SecurityDomain domain = (SecurityDomain)ec.resolveAnnotation(SecurityDomain.class);
/* 186 */         String unauth = domain.unauthenticatedPrincipal();
/* 187 */         if ((unauth != null) && (unauth.length() > 0) &&
/* 188 */           (domain.unauthenticatedPrincipal() != null)) {
/* 189 */           callerPrincipal = new SimplePrincipal(unauth);
/*     */         }
/*     */       }
/*     */
/* 193 */       if (callerPrincipal == null) {
View Full Code Here


/*     */   {
/* 210 */     EJBContainer ejbc = (EJBContainer)this.container;
/* 211 */     SecurityContext sc = SecurityContextAssociation.getSecurityContext();
/* 212 */     if (sc == null)
/*     */     {
/* 214 */       SecurityDomain domain = (SecurityDomain)ejbc.resolveAnnotation(SecurityDomain.class);
/*     */       try
/*     */       {
/* 217 */         sc = SecurityActions.createSecurityContext(domain.value());
/*     */       }
/*     */       catch (PrivilegedActionException e)
/*     */       {
/* 221 */         throw new RuntimeException(e);
/*     */       }
View Full Code Here

/*     */     {
/* 132 */       return invocation.invokeNext();
/*     */     }
/*     */     try
/*     */     {
/* 136 */       SecurityDomain domain = (SecurityDomain)this.container.resolveAnnotation(SecurityDomain.class);
/*     */
/* 138 */       boolean domainExists = (domain != null) && (domain.value() != null) && (domain.value().length() > 0);
/*     */
/* 141 */       if (domainExists)
/*     */       {
/* 143 */         sc = SecurityActions.getSecurityContext();
/* 144 */         if (sc == null)
View Full Code Here

/* 50 */     Object domain = null;
/* 51 */     Container container = (Container)advisor;
/*    */     try
/*    */     {
/* 54 */       InitialContext ctx = container.getInitialContext();
/* 55 */       SecurityDomain securityAnnotation = (SecurityDomain)advisor.resolveAnnotation(SecurityDomain.class);
/*    */
/* 58 */       if (securityAnnotation == null) {
/* 59 */         return new NullInterceptor();
/*    */       }
/* 61 */       domain = SecurityDomainManager.getSecurityManager(securityAnnotation.value(), ctx);
/*    */     }
/*    */     catch (NamingException e)
/*    */     {
/* 65 */       throw new RuntimeException(e);
/*    */     }
View Full Code Here

/*     */     }
/*     */   }
/*     */
/*     */   private static void addPermissions(EJBContainer container, PolicyConfiguration pc)
/*     */   {
/* 169 */     SecurityDomain sd = (SecurityDomain)container.resolveAnnotation(SecurityDomain.class);
/*     */
/* 171 */     PermitAll beanUnchecked = (PermitAll)container.resolveAnnotation(PermitAll.class);
/* 172 */     RolesAllowed beanPermissions = (RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
/*     */
/* 174 */     DeclareRoles beanDeclareRolesPerms = (DeclareRoles)container.resolveAnnotation(DeclareRoles.class);
View Full Code Here

/*  95 */     throw new EJBAccessException("Authentication failure");
/*     */   }
/*     */
/*     */   public Object invoke(Invocation invocation) throws Throwable
/*     */   {
/* 100 */     SecurityDomain domain = (SecurityDomain)this.container.resolveAnnotation(SecurityDomain.class);
/*     */
/* 102 */     if ((domain != null) && (domain.unauthenticatedPrincipal() != null) && (domain.unauthenticatedPrincipal().length() != 0))
/*     */     {
/* 104 */       Principal principal = (Principal)invocation.getMetaData("security", "principal");
/* 105 */       if (principal == null) {
/* 106 */         principal = SecurityAssociation.getPrincipal();
/*     */       }
/* 108 */       if (principal == null)
/*     */       {
/* 111 */         principal = new TrustedPrincipal(domain.unauthenticatedPrincipal());
/*     */
/* 114 */         invocation.getMetaData().addMetaData("security", "principal", principal);
/*     */       }
/*     */
/* 118 */       if ((principal != null) && ((principal instanceof TrustedPrincipal)))
View Full Code Here

/*     */     }
/*  78 */     SecurityIdentity si = null;
/*  79 */     SecurityContext sc = SecurityActions.getSecurityContext();
/*  80 */     SecurityContext invSC = (SecurityContext)invocation.getMetaData("security", "context");
/*     */
/*  82 */     SecurityDomain domain = (SecurityDomain)this.container.resolveAnnotation(SecurityDomain.class);
/*     */
/*  84 */     boolean domainExists = (domain != null) && (domain.value() != null) && (domain.value().length() > 0);
/*     */     Principal p;
/*  91 */     if (domainExists)
/*     */     {
/*  93 */       p = null;
/*  94 */       Object cred = null;
/*     */
/*  97 */       if ((sc == null) && (invSC == null))
/*     */       {
/*  99 */         sc = SecurityActions.createSecurityContext(domain.value());
/* 100 */         SecurityActions.setSecurityContext(sc);
/*     */       }
/*     */
/* 103 */       if (shelper.isLocalCall(mi))
/*     */       {
/* 105 */         if (sc == null)
/* 106 */           throw new IllegalStateException("Security Context null on Local call");
/* 107 */         si = sc.getUtil().getSecurityIdentity();
/*     */       }
/*     */       else
/*     */       {
/* 111 */         if ((invSC == null) && (sc == null)) {
/* 112 */           throw new IllegalStateException("Security Context is not available");
/*     */         }
/*     */
/* 115 */         if (invSC != null)
/*     */         {
/* 117 */           sc = invSC;
/* 118 */           p = sc.getUtil().getUserPrincipal();
/* 119 */           cred = sc.getUtil().getCredential();
/* 120 */           String unprefixed = SecurityUtil.unprefixSecurityDomain(domain.value());
/* 121 */           sc = SecurityActions.createSecurityContext(p, cred, null, unprefixed);
/*     */
/* 125 */           SecurityActions.setSecurityContext(sc);
/* 126 */           sc.getUtil().setSecurityIdentity(invSC.getUtil().getSecurityIdentity());
/*     */         }
View Full Code Here

/*     */
/*  83 */     Object domain = null;
/*     */     try
/*     */     {
/*  86 */       InitialContext ctx = container.getInitialContext();
/*  87 */       SecurityDomain securityDomain = (SecurityDomain)advisor.resolveAnnotation(SecurityDomain.class);
/*  88 */       if (securityDomain != null)
/*     */       {
/*  90 */         String domainName = securityDomain.value();
/*  91 */         domain = SecurityDomainManager.getSecurityManager(domainName, ctx);
/*     */       }
/*     */     }
/*     */     catch (NamingException e)
/*     */     {
View Full Code Here

/*  92 */     SecurityHelper shelper = new SecurityHelper();
/*  93 */     if (shelper.isEJBTimeOutCallback(((MethodInvocation)invocation).getMethod())) {
/*  94 */       return invocation.invokeNext();
/*     */     }
/*  96 */     SecurityContext sc = SecurityActions.getSecurityContext();
/*     */     SecurityDomain domain;
/* 102 */     if (sc == null)
/*     */     {
/* 104 */       domain = (SecurityDomain)this.container.resolveAnnotation(SecurityDomain.class);
/* 105 */       if (domain != null)
/*     */       {
/* 107 */         sc = SecurityActions.createSecurityContext(domain.value());
/* 108 */         SecurityContextAssociation.setSecurityContext(sc);
/*     */       }
/*     */     }
/*     */
/* 112 */     if (sc != null)
View Full Code Here

   public <T> T getSecurityManager(Class<T> type)
   {
      try
      {
         InitialContext ctx = getInitialContext();
         SecurityDomain securityAnnotation = (SecurityDomain) resolveAnnotation(SecurityDomain.class);
         if (securityAnnotation != null && securityAnnotation.value().length() > 0)
         {
            return (T) SecurityDomainManager.getSecurityManager(securityAnnotation.value(),ctx);
         }
         return null;
      }
      catch (NamingException e)
      {
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.annotation.SecurityDomain

Copyright © 2018 www.massapicom. 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.