Package javax.annotation.security

Examples of javax.annotation.security.DeclareRoles


    }
   
    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {
       
        DeclareRoles rolesRefAn = (DeclareRoles)ainfo.getAnnotation();

        for (EjbContext ejbContext : ejbContexts) {
            EjbDescriptor ejbDescriptor = ejbContext.getDescriptor();
            for (String roleName : rolesRefAn.value()) {
                if (ejbDescriptor.getRoleReferenceByName(roleName) == null) {
                    RoleReference roleRef = new RoleReference(roleName, "");
                    roleRef.setRoleName(roleName);
                    roleRef.setSecurityRoleLink(
                           new SecurityRoleDescriptor(roleName, ""));
View Full Code Here


        return processAnnotation(ainfo, webBundleDesc);
    }

    private HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
             WebBundleDescriptor webBundleDesc) {
        DeclareRoles rolesRefAn = (DeclareRoles)ainfo.getAnnotation();
        for (String roleName : rolesRefAn.value()) {
            Role role = new Role(roleName);
            webBundleDesc.addRole(role);
        }
        return getDefaultProcessedResult();
    }
View Full Code Here

            WebBundleDescriptor webBundleDescriptor,
            WebComponentDescriptor wcd, StandardWrapper wrapper) {

        // Process DeclareRoles annotation
        if (clazz.isAnnotationPresent(DeclareRoles.class)) {
            DeclareRoles declareRoles = (DeclareRoles)
                clazz.getAnnotation(DeclareRoles.class);
            for (String roleName : declareRoles.value()) {
                webBundleDescriptor.addRole(new Role(roleName));
                webModule.declareRoles(roleName);
            }
        }
        // Process MultipartConfig annotation
View Full Code Here

            WebBundleDescriptor webBundleDescriptor,
            WebComponentDescriptor wcd, StandardWrapper wrapper) {

        // Process DeclareRoles annotation
        if (clazz.isAnnotationPresent(DeclareRoles.class)) {
            DeclareRoles declareRoles = (DeclareRoles)
                clazz.getAnnotation(DeclareRoles.class);
            for (String roleName : declareRoles.value()) {
                webBundleDescriptor.addRole(new Role(roleName));
                webModule.declareRoles(roleName);
            }
        }
        // Process MultipartConfig annotation
View Full Code Here

            }
            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());
            }
            return null;
        }
View Full Code Here

            }
            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());
            }
            return null;
        }
View Full Code Here

                }

                /*
                 * @DeclareRoles
                 */
                DeclareRoles declareRoles = clazz.getAnnotation(DeclareRoles.class);
                if (declareRoles != null && bean instanceof RemoteBean) {
                    RemoteBean remoteBean = (RemoteBean) bean;
                    List<SecurityRoleRef> securityRoleRefs = remoteBean.getSecurityRoleRef();
                    for (String role : declareRoles.value()) {
                        securityRoleRefs.add(new SecurityRoleRef(role));
                    }
                }
            }

View Full Code Here

/* 45 */     super(finder);
/*    */   }
/*    */
/*    */   public void process(SecurityRolesMetaData metaData, Class element)
/*    */   {
/* 50 */     DeclareRoles roles = (DeclareRoles)this.finder.getAnnotation(element, DeclareRoles.class);
/* 51 */     if (roles == null) {
/* 52 */       return;
/*    */     }
/* 54 */     for (String role : roles.value())
/*    */     {
/* 56 */       SecurityRoleMetaData sr = new SecurityRoleMetaData();
/* 57 */       sr.setRoleName(role);
/* 58 */       Descriptions descriptions = ProcessorUtils.getDescription("DeclareRoles(" + roles.value() + ") on class: " + element.getName());
/* 59 */       sr.setDescriptions(descriptions);
/* 60 */       metaData.add(sr);
/*    */     }
/*    */   }
View Full Code Here

/* 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);
/*     */
/* 176 */     if ((beanUnchecked != null) && (beanPermissions != null))
/*     */     {
/* 178 */       throw new RuntimeException("Cannot annotate a bean with both @Unchecked and @MethodPermissions");
/*     */     }
/*     */
/* 181 */     String ejbName = container.getEjbName();
/*     */
/* 184 */     if (beanDeclareRolesPerms != null)
/*     */     {
/* 186 */       String[] rolerefs = beanDeclareRolesPerms.value();
/* 187 */       int len = rolerefs != null ? rolerefs.length : 0;
/* 188 */       for (int i = 0; i < len; i++)
/*     */       {
/*     */         try
/*     */         {
View Full Code Here

        /* Process DeclareRoles annotation.
         * Ref JSR 250, equivalent to the security-role element in
         * the deployment descriptor
         */
        if (classClass.isAnnotationPresent(DeclareRoles.class)) {
            DeclareRoles annotation = (DeclareRoles)
                classClass.getAnnotation(DeclareRoles.class);
            for (int i = 0; annotation.value() != null && i < annotation.value().length; i++) {
                context.addSecurityRole(annotation.value()[i]);
            }
        }
       
       
    }
View Full Code Here

TOP

Related Classes of javax.annotation.security.DeclareRoles

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.