/** * Copy constructor. */ public AuthorizationConstraintImpl(AuthorizationConstraintImpl other) { this.securityRoles = new HashSet(other.getSecurityRoleSet()); }
ac = new AuthorizationConstraintImpl(); for (String roleName : rolesAllowed) { Role role = new Role(roleName); webBundleDesc.addRole(role); ac.addSecurityRole(roleName); ac = new AuthorizationConstraintImpl();
/** * 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; } }
/** * 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); }
/** Copy constructor.*/ public SecurityConstraintImpl(SecurityConstraintImpl other) { if (other.webResourceCollections != null) { this.webResourceCollections = new HashSet<WebResourceCollection>(); for (WebResourceCollection wrc : other.webResourceCollections) { webResourceCollections.add(new WebResourceCollectionImpl((WebResourceCollectionImpl)wrc)); } } if (other.authorizationConstraint != null) { this.authorizationConstraint = new AuthorizationConstraintImpl((AuthorizationConstraintImpl) other.authorizationConstraint); } if (other.userDataConstraint != null) { this.userDataConstraint = new UserDataConstraintImpl(); this.userDataConstraint.setTransportGuarantee(other.userDataConstraint.getTransportGuarantee()); } }
ac = new AuthorizationConstraintImpl(); for (String roleName : sc.getAuthConstraint()) { Role role = new Role(roleName); getWebBundleDescriptor().addRole(role); ac.addSecurityRole(roleName); ac = new AuthorizationConstraintImpl();
Enumeration rolesEnum = authCons.getSecurityRoles(); StringBuffer rsb = new StringBuffer(); rsb.append(" Accessible by roles: ");
/** * Adds a role to the authorization constraint. * @param the role to be added. */ public void addSecurityRole(SecurityRole securityRole) { this.getSecurityRoleSet().add(securityRole); }
/** * Removes the given role from the autrhorization constraint. * @param the role to be removed. */ public void removeSecurityRole(SecurityRole securityRole) { this.getSecurityRoleSet().remove(securityRole); }
/** * Return the security roles involved in this constraint. The * enumeration is empty if there are none. * @return the enumeration of security roles in this constraint. */ public Enumeration getSecurityRoles() { if (this.securityRoles == null) { this.securityRoles = new HashSet(); } return (new Vector(this.getSecurityRoleSet())).elements(); }