@Override public SecurityRoleDescriptor getDescriptor() { if (descriptor == null) descriptor = new SecurityRoleDescriptor(); return descriptor; }
/** * Adds a role to the authorization constraint * @param the role name to be added */ public void addSecurityRole(String roleName) { SecurityRoleDescriptor sr = new SecurityRoleDescriptor(); sr.setName(roleName); addSecurityRole(sr); }
public void addAppRole(SecurityRoleDescriptor descriptor) { Role role = new Role(descriptor.getName()); role.setDescription(descriptor.getDescription()); getAppRoles().add(role); }
public void addAppRole(SecurityRoleDescriptor descriptor) { Role role = new Role(descriptor.getName()); role.setDescription(descriptor.getDescription()); getAppRoles().add(role); }
@Override public Node writeDescriptor(Node parent, String nodeName, SecurityRoleDescriptor descriptor) { Node roleNode = appendChild(parent, nodeName); appendTextChild(roleNode, TagNames.DESCRIPTION, descriptor.getDescription()); appendTextChild(roleNode, TagNames.ROLE_NAME, descriptor.getName()); return roleNode; } }
/** * Returns an Enumeration of my SecurityRole objects. */ public Enumeration<SecurityRoleDescriptor> getSecurityRoles() { Vector<SecurityRoleDescriptor> securityRoles = new Vector<SecurityRoleDescriptor>(); for (Iterator itr = super.getRoles().iterator(); itr.hasNext();) { Role r = (Role) itr.next(); SecurityRoleDescriptor srd = new SecurityRoleDescriptor(r); securityRoles.add(srd); } return securityRoles.elements(); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, SecurityRoleDescriptor descriptor) { Node roleNode = appendChild(parent, nodeName); appendTextChild(roleNode, TagNames.DESCRIPTION, descriptor.getDescription()); appendTextChild(roleNode, TagNames.ROLE_NAME, descriptor.getName()); return roleNode; } }
/** * My hashcode. */ public int hashCode() { return this.getName().hashCode(); }
/** * Return the rolename. * @return the role name. */ public SecurityRole getSecurityRoleLink() { return new SecurityRoleDescriptor(super.getValue(), ""); }
/** * Adds a Role object based on the supplied SecurityRoleDescriptor. * <p/> * A change in SecurityRoleNode to fix bug 4933385 causes the DOL to use SecurityRoleDescriptor, rather * than Role, to contain information about security roles. To minimize the impact on BundleDescriptor, * this method has been added for use by the DOL as it processes security-role elements. * <p/> * This method creates a new Role object based on the characteristics of the SecurityRoleDescriptor * and then delegates to addRole(Role) to preserve the rest of the behavior of this class. * * @param descriptor SecurityRoleDescriptor that describes the username and description of the role */ public void addRole(SecurityRoleDescriptor descriptor) { Role role = new Role(descriptor.getName()); role.setDescription(descriptor.getDescription()); this.addRole(role); }
/** * My hashcode. */ public int hashCode() { return this.getName().hashCode(); }
/** * Return the rolename. * @return the role name. */ public SecurityRole getSecurityRoleLink() { return new SecurityRoleDescriptor(super.getValue(), ""); }
/** * Adds a Role object based on the supplied SecurityRoleDescriptor. * <p/> * A change in SecurityRoleNode to fix bug 4933385 causes the DOL to use SecurityRoleDescriptor, rather * than Role, to contain information about security roles. To minimize the impact on BundleDescriptor, * this method has been added for use by the DOL as it processes security-role elements. * <p/> * This method creates a new Role object based on the characteristics of the SecurityRoleDescriptor * and then delegates to addRole(Role) to preserve the rest of the behavior of this class. * * @param descriptor SecurityRoleDescriptor that describes the username and description of the role */ public void addRole(SecurityRoleDescriptor descriptor) { Role role = new Role(descriptor.getName()); role.setDescription(descriptor.getDescription()); this.addRole(role); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, AuthorizationConstraintImpl descriptor) { Node myNode = appendChild(parent, nodeName); writeLocalizedDescriptions(myNode, descriptor); // role-name* for (Enumeration roles = descriptor.getSecurityRoles();roles.hasMoreElements();) { SecurityRoleDescriptor role = (SecurityRoleDescriptor) roles.nextElement(); appendTextChild(myNode, WebTagNames.ROLE_NAME, role.getName()); } return myNode; } }
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, "")); ejbDescriptor.addRoleReference(roleRef); } Role role = new Role(roleName); ejbDescriptor.getEjbBundleDescriptor().addRole(role); } } return getDefaultProcessedResult(); }
void setOutcome(Set<Role> roleSet, AuthorizationConstraint ac, UserDataConstraint udc) { if (ac == null) { setPredefinedOutcome(true); } else { Enumeration eroles = ac.getSecurityRoles(); if (!eroles.hasMoreElements()) { setPredefinedOutcome(false); } else while (eroles.hasMoreElements()) { SecurityRoleDescriptor srd = (SecurityRoleDescriptor)eroles.nextElement(); String roleName = srd.getName(); if ("*".equals(roleName)) { Iterator it = roleSet.iterator(); while(it.hasNext()) { setRole(((Role)it.next()).getName()); } } else { setRole(roleName); } } } addConnectType(udc == null? null : udc.getTransportGuarantee()); if (WebPermissionUtil.logger.isLoggable(Level.FINE)){ WebPermissionUtil.logger.log (Level.FINE,"JACC: setOutcome yields: " + toString()); } }
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, "")); ejbDescriptor.addRoleReference(roleRef); } Role role = new Role(roleName); ejbDescriptor.getEjbBundleDescriptor().addRole(role); } } return getDefaultProcessedResult(); }
SecurityRoleDescriptor srd = (SecurityRoleDescriptor)eroles.nextElement(); String roleName = srd.getName(); if ("*".equals(roleName)) { containsAllRoles = true;