Search in sources :

Example 1 with WSSecureConversationException

use of com.sun.xml.ws.security.secconv.WSSecureConversationException in project Payara by payara.

the class ClientSecurityPipe method startSecureConversation.

@Override
public JAXBElement startSecureConversation(Packet packet) throws WSSecureConversationException {
    PacketMessageInfo info = new PacketMapMessageInfo(packet, new Packet());
    JAXBElement token = null;
    try {
        // gets the subject from the packet (puts one there if not found)
        Subject clientSubject = getClientSubject(packet);
        // put MessageInfo in properties map, since MessageInfo
        // is not passed to getAuthContext, key indicates function
        HashMap<String, Object> map = new HashMap<>();
        map.put(PipeConstants.SECURITY_TOKEN, info);
        helper.getSessionToken(map, info, clientSubject);
        // helper returns token in map of msgInfo, using same key
        Object o = info.getMap().get(PipeConstants.SECURITY_TOKEN);
        if (o != null && o instanceof JAXBElement) {
            token = (JAXBElement) o;
        }
    } catch (Exception e) {
        if (e instanceof WSSecureConversationException) {
            throw (WSSecureConversationException) e;
        } else {
            throw new WSSecureConversationException("Secure Conversation failure: ", e);
        }
    }
    return token;
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) PacketMapMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo) HashMap(java.util.HashMap) WSSecureConversationException(com.sun.xml.ws.security.secconv.WSSecureConversationException) JAXBElement(javax.xml.bind.JAXBElement) Subject(javax.security.auth.Subject) WSSecureConversationException(com.sun.xml.ws.security.secconv.WSSecureConversationException) WebServiceException(javax.xml.ws.WebServiceException) PacketMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo)

Example 2 with WSSecureConversationException

use of com.sun.xml.ws.security.secconv.WSSecureConversationException in project Payara by payara.

the class ClientSecurityTube method startSecureConversation.

@Override
public JAXBElement startSecureConversation(Packet packet) throws WSSecureConversationException {
    PacketMessageInfo locInfo = new PacketMapMessageInfo(packet, new Packet());
    JAXBElement token = null;
    try {
        // gets the subject from the packet (puts one there if not found)
        Subject locClientSubject = getClientSubject(packet);
        // put MessageInfo in properties map, since MessageInfo
        // is not passed to getAuthContext, key idicates function
        HashMap<String, Object> map = new HashMap<>();
        map.put(SECURITY_TOKEN, locInfo);
        helper.getSessionToken(map, locInfo, locClientSubject);
        // helper returns token in map of msgInfo, using same key
        Object o = locInfo.getMap().get(SECURITY_TOKEN);
        if (o != null && o instanceof JAXBElement) {
            token = (JAXBElement) o;
        }
    } catch (Exception e) {
        if (e instanceof WSSecureConversationException) {
            throw (WSSecureConversationException) e;
        } else {
            throw new WSSecureConversationException("Secure Conversation failure: ", e);
        }
    }
    return token;
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) PacketMapMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo) HashMap(java.util.HashMap) WSSecureConversationException(com.sun.xml.ws.security.secconv.WSSecureConversationException) JAXBElement(javax.xml.bind.JAXBElement) Subject(javax.security.auth.Subject) WSSecureConversationException(com.sun.xml.ws.security.secconv.WSSecureConversationException) WebServiceException(javax.xml.ws.WebServiceException) PacketMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo)

Aggregations

PacketMapMessageInfo (com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo)2 PacketMessageInfo (com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo)2 Packet (com.sun.xml.ws.api.message.Packet)2 WSSecureConversationException (com.sun.xml.ws.security.secconv.WSSecureConversationException)2 HashMap (java.util.HashMap)2 Subject (javax.security.auth.Subject)2 JAXBElement (javax.xml.bind.JAXBElement)2 WebServiceException (javax.xml.ws.WebServiceException)2