Search in sources :

Example 6 with MessageDescriptor

use of com.sun.enterprise.deployment.runtime.common.MessageDescriptor in project Payara by payara.

the class MessageNode method getDescriptor.

/**
 * @return the descriptor instance to associate with this XMLNode
 */
public MessageDescriptor getDescriptor() {
    if (descriptor == null) {
        descriptor = new MessageDescriptor();
        setMiscDescriptors();
    }
    return descriptor;
}
Also used : MessageDescriptor(com.sun.enterprise.deployment.runtime.common.MessageDescriptor)

Example 7 with MessageDescriptor

use of com.sun.enterprise.deployment.runtime.common.MessageDescriptor in project Payara by payara.

the class MessageSecurityNode method writeDescriptor.

/**
 * Write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param node name for
 * @param the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, MessageSecurityDescriptor messageSecurityDesc) {
    Node messageSecurityNode = super.writeDescriptor(parent, nodeName, messageSecurityDesc);
    List<MessageDescriptor> messageDescriptors = messageSecurityDesc.getMessageDescriptors();
    if (!messageDescriptors.isEmpty()) {
        MessageNode messageNode = new MessageNode();
        for (MessageDescriptor messageDesc : messageDescriptors) {
            messageNode.writeDescriptor(messageSecurityNode, MESSAGE, messageDesc);
        }
    }
    // request-protection
    ProtectionDescriptor requestProtectionDesc = messageSecurityDesc.getRequestProtectionDescriptor();
    if (requestProtectionDesc != null) {
        new ProtectionNode().writeDescriptor(messageSecurityNode, REQUEST_PROTECTION, requestProtectionDesc);
    }
    // response-protection
    ProtectionDescriptor responseProtectionDesc = messageSecurityDesc.getResponseProtectionDescriptor();
    if (responseProtectionDesc != null) {
        new ProtectionNode().writeDescriptor(messageSecurityNode, RESPONSE_PROTECTION, responseProtectionDesc);
    }
    return messageSecurityNode;
}
Also used : MessageDescriptor(com.sun.enterprise.deployment.runtime.common.MessageDescriptor) Node(org.w3c.dom.Node) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ProtectionDescriptor(com.sun.enterprise.deployment.runtime.common.ProtectionDescriptor)

Example 8 with MessageDescriptor

use of com.sun.enterprise.deployment.runtime.common.MessageDescriptor in project Payara by payara.

the class BaseAuthConfig method getContextForOpName.

private Object getContextForOpName(String operation) {
    synchronized (contextLock) {
        if (contextsForOpNames_ == null) {
            // one time initialization of the opName to authContext array.
            contextsForOpNames_ = new HashMap();
            for (int i = 0; messageSecurityDescriptors_ != null && i < messageSecurityDescriptors_.size(); i++) {
                MessageSecurityDescriptor mSD = (MessageSecurityDescriptor) messageSecurityDescriptors_.get(i);
                List<MessageDescriptor> mDs = mSD.getMessageDescriptors();
                for (int j = 0; mDs != null && j < mDs.size(); j++) {
                    MessageDescriptor mD = (MessageDescriptor) mDs.get(j);
                    String opName = mD.getOperationName();
                    if (opName != null) {
                        if (contextsForOpNames_.containsKey(opName)) {
                            Integer k = (Integer) contextsForOpNames_.get(opName);
                            if (k != null) {
                                MessageSecurityDescriptor other = (MessageSecurityDescriptor) messageSecurityDescriptors_.get(k.intValue());
                                if (!policiesAreEqual(mSD, other)) {
                                    contextsForOpNames_.put(opName, null);
                                }
                            }
                        } else if (superMSD_ != null && !policiesAreEqual(mSD, superMSD_)) {
                            // set to null if operation policy differs from superPolicy
                            contextsForOpNames_.put(opName, null);
                        } else {
                            contextsForOpNames_.put(opName, Integer.valueOf(i));
                        }
                    }
                }
            }
        }
    }
    Object rvalue = null;
    if (operation != null) {
        if (contextsForOpNames_.containsKey(operation)) {
            Integer k = (Integer) contextsForOpNames_.get(operation);
            if (k != null) {
                rvalue = contexts_.get(k.intValue());
            }
        } else if (superIndex_ >= 0) {
            // if there is a msb that matches all methods, use the
            // associatedContext
            rvalue = contexts_.get(superIndex_);
        }
        if (rvalue == null) {
            // else return explicitNull under the assumption
            // that methodName was known, and no match was found
            rvalue = explicitNull;
        }
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "WSS: ForOpName={0} context: {1}", new Object[] { operation, rvalue });
        }
    }
    return rvalue;
}
Also used : MessageDescriptor(com.sun.enterprise.deployment.runtime.common.MessageDescriptor) HashMap(java.util.HashMap) MessageSecurityDescriptor(com.sun.enterprise.deployment.runtime.common.MessageSecurityDescriptor)

Aggregations

MessageDescriptor (com.sun.enterprise.deployment.runtime.common.MessageDescriptor)8 MessageSecurityDescriptor (com.sun.enterprise.deployment.runtime.common.MessageSecurityDescriptor)4 ArrayList (java.util.ArrayList)3 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)2 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)2 HashMap (java.util.HashMap)2 MessagePolicy (javax.security.auth.message.MessagePolicy)2 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)1 ProtectionDescriptor (com.sun.enterprise.deployment.runtime.common.ProtectionDescriptor)1 Node (org.w3c.dom.Node)1