Search in sources :

Example 1 with SecurityRoleDescriptor

use of com.sun.enterprise.deployment.SecurityRoleDescriptor in project Payara by payara.

the class WebBundleDescriptorImpl method getSecurityRoles.

/**
 * Returns an Enumeration of my SecurityRole objects.
 * @return
 */
@Override
public Enumeration<SecurityRoleDescriptor> getSecurityRoles() {
    Vector<SecurityRoleDescriptor> securityRoles = new Vector<SecurityRoleDescriptor>();
    for (Role r : super.getRoles()) {
        SecurityRoleDescriptor srd = new SecurityRoleDescriptor(r);
        securityRoles.add(srd);
    }
    return securityRoles.elements();
}
Also used : SecurityRole(com.sun.enterprise.deployment.web.SecurityRole) Role(org.glassfish.security.common.Role) SecurityRoleDescriptor(com.sun.enterprise.deployment.SecurityRoleDescriptor) Vector(java.util.Vector)

Example 2 with SecurityRoleDescriptor

use of com.sun.enterprise.deployment.SecurityRoleDescriptor in project Payara by payara.

the class AuthConstraintNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node in the DOM tree
 * @param nodeName node name for the root element of this xml fragment
 * @param descriptor the descriptor to write
 * @return the DOM tree top node
 */
@Override
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;
}
Also used : Enumeration(java.util.Enumeration) SecurityRoleDescriptor(com.sun.enterprise.deployment.SecurityRoleDescriptor) Node(org.w3c.dom.Node) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode)

Example 3 with SecurityRoleDescriptor

use of com.sun.enterprise.deployment.SecurityRoleDescriptor in project Payara by payara.

the class AuthorizationConstraintImpl method addSecurityRole.

/**
 * 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);
}
Also used : SecurityRoleDescriptor(com.sun.enterprise.deployment.SecurityRoleDescriptor)

Aggregations

SecurityRoleDescriptor (com.sun.enterprise.deployment.SecurityRoleDescriptor)3 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)1 SecurityRole (com.sun.enterprise.deployment.web.SecurityRole)1 Enumeration (java.util.Enumeration)1 Vector (java.util.Vector)1 Role (org.glassfish.security.common.Role)1 Node (org.w3c.dom.Node)1