Package javax.annotation.security

Examples of javax.annotation.security.RunAs


        return getDefaultProcessedResult();
    }

    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            WebComponentContext[] webCompContexts) throws AnnotationProcessorException {
        RunAs runAsAn = (RunAs)ainfo.getAnnotation();

        for (WebComponentContext webCompContext : webCompContexts) {
            WebComponentDescriptor webDesc = webCompContext.getDescriptor();
            // override by xml
            if (webDesc.getRunAsIdentity() != null) {
                continue;
            }
            String roleName = runAsAn.value();
            Role role = new Role(roleName);
            // add Role if not exists
            webDesc.getWebBundleDescriptor().addRole(role);
            RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor();
            runAsDesc.setRoleName(roleName);
View Full Code Here


                }

                /*
                 * @RunAs
                 */
                final RunAs runAs = clazz.getAnnotation(RunAs.class);
                if (runAs != null && bean.getSecurityIdentity() == null) {
                    final SecurityIdentity securityIdentity = new SecurityIdentity();
                    securityIdentity.setRunAs(runAs.value());
                    bean.setSecurityIdentity(securityIdentity);
                }

                /*
                 * @DeclareRoles
 
View Full Code Here

                for (Method method : classFinder.findAnnotatedMethods(DenyAll.class)) {
                    ExcludeList excludeList = assemblyDescriptor.getExcludeList();
                    excludeList.addMethod(new org.apache.openejb.jee.Method(ejbName, method));
                }

                RunAs runAs = clazz.getAnnotation(RunAs.class);
                if (runAs != null && bean.getSecurityIdentity() == null) {
                    SecurityIdentity securityIdentity = new SecurityIdentity();
                    securityIdentity.setRunAs(runAs.value());
                    bean.setSecurityIdentity(securityIdentity);
                }

                DeclareRoles declareRoles = clazz.getAnnotation(DeclareRoles.class);
                if (declareRoles != null && bean instanceof RemoteBean){
View Full Code Here

                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here

                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here

        List<Class> classesWithRunAs = classFinder.findAnnotatedClasses(RunAs.class);

        // Class-level annotation
        for (Class cls : classesWithRunAs) {
            RunAs runAs = (RunAs) cls.getAnnotation(RunAs.class);
            if (runAs != null && Servlet.class.isAssignableFrom(cls)) {
                addRunAs(webApp, runAs, cls);
            }
        }
View Full Code Here

                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                RunAs annotation = classClass.getAnnotation(RunAs.class);
                if (annotation != null) {
                    wrapper.setRunAs(annotation.value());
                }
            }
        }

    }
View Full Code Here

            }
            final MultipartConfig multipartConfig = servletInfo.getServletClass().getAnnotation(MultipartConfig.class);
            if (multipartConfig != null) {
                servletInfo.setMultipartConfig(new MultipartConfigElement(multipartConfig.location(), multipartConfig.maxFileSize(), multipartConfig.maxRequestSize(), multipartConfig.fileSizeThreshold()));
            }
            final RunAs runAs = servletInfo.getServletClass().getAnnotation(RunAs.class);
            if (runAs != null) {
                servletInfo.setRunAs(runAs.value());
            }
            final DeclareRoles declareRoles = servletInfo.getServletClass().getAnnotation(DeclareRoles.class);
            if (declareRoles != null) {
                deploymentInfo.addSecurityRoles(declareRoles.value());
            }
View Full Code Here

                }

                /*
                 * @RunAs
                 */
                final RunAs runAs = clazz.getAnnotation(RunAs.class);
                if (runAs != null && bean.getSecurityIdentity() == null) {
                    final SecurityIdentity securityIdentity = new SecurityIdentity();
                    securityIdentity.setRunAs(runAs.value());
                    bean.setSecurityIdentity(securityIdentity);
                }

                /*
                 * @DeclareRoles
 
View Full Code Here

   @SuppressWarnings("unused")
   private static final Logger log = Logger.getLogger(RunAsSecurityInterceptorFactory.class);
 
   protected RunAsIdentity getRunAsIdentity(EJBContainer container)
   {
      RunAs runAs = (RunAs) container.resolveAnnotation(RunAs.class);
      if (runAs == null)
         return null;
     
      String runAsPrincipal = runAs.value();
      Set<String> extraRoles = new HashSet<String>();
     
      JBossAssemblyDescriptorMetaData ad = container.getAssemblyDescriptor();
      if(ad != null && runAsPrincipal != null)
      {
         extraRoles.addAll(ad.getSecurityRoleNamesByPrincipal(runAsPrincipal));
      }
     
      return new RunAsIdentity(runAs.value(), runAsPrincipal, extraRoles);
   }
View Full Code Here

TOP

Related Classes of javax.annotation.security.RunAs

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.