Search in sources :

Example 1 with PacketMessageInfo

use of com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo in project Payara by payara.

the class ClientSecurityTube method preDestroy.

@Override
public void preDestroy() {
    // create a dummy request packet
    try {
        Packet request = new Packet();
        PacketMessageInfo locInfo = new PacketMapMessageInfo(request, new Packet());
        Subject subj = getClientSubject(request);
        ClientAuthContext locCAC = helper.getClientAuthContext(locInfo, subj);
        if (locCAC != null && WSIT_CLIENT_AUTH_CONTEXT.equals(locCAC.getClass().getName())) {
            locCAC.cleanSubject(locInfo, subj);
        }
    } catch (Exception ex) {
    // ignore exceptions
    }
    helper.disable();
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) PacketMapMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo) ClientAuthContext(javax.security.auth.message.config.ClientAuthContext) 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 PacketMessageInfo

use of com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo 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)

Example 3 with PacketMessageInfo

use of com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo in project Payara by payara.

the class WebServicesDelegateImpl method getAuthContextID.

@Override
public String getAuthContextID(MessageInfo messageInfo) {
    // make this more efficient by operating on packet
    String rvalue = null;
    if (messageInfo instanceof PacketMessageInfo) {
        PacketMessageInfo pmi = (PacketMessageInfo) messageInfo;
        Packet p = pmi.getRequestPacket();
        if (p != null) {
            Message m = p.getMessage();
            if (m != null) {
                WSDLPort port = (WSDLPort) messageInfo.getMap().get("WSDL_MODEL");
                if (port != null) {
                    WSDLBoundOperation w = m.getOperation(port);
                    if (w != null) {
                        QName n = w.getName();
                        if (n != null) {
                            rvalue = n.getLocalPart();
                        }
                    }
                }
            }
        }
        return rvalue;
    } else {
        // make this more efficient by operating on packet
        return getOpName((SOAPMessage) messageInfo.getRequestMessage());
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Message(com.sun.xml.ws.api.message.Message) SOAPMessage(javax.xml.soap.SOAPMessage) WSDLBoundOperation(com.sun.xml.ws.api.model.wsdl.WSDLBoundOperation) QName(javax.xml.namespace.QName) PacketMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo) WSDLPort(com.sun.xml.ws.api.model.wsdl.WSDLPort)

Example 4 with PacketMessageInfo

use of com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo 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 5 with PacketMessageInfo

use of com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo in project Payara by payara.

the class ClientSecurityPipe method preDestroy.

@Override
public void preDestroy() {
    // create a dummy request packet
    try {
        Packet request = new Packet();
        PacketMessageInfo info = new PacketMapMessageInfo(request, new Packet());
        Subject subj = getClientSubject(request);
        ClientAuthContext cAC = helper.getClientAuthContext(info, subj);
        if (cAC != null && WSIT_CLIENT_AUTH_CONTEXT.equals(cAC.getClass().getName())) {
            cAC.cleanSubject(info, subj);
        }
    } catch (Exception ex) {
    // ignore exceptions
    }
    helper.disable();
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) PacketMapMessageInfo(com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo) ClientAuthContext(javax.security.auth.message.config.ClientAuthContext) 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

PacketMessageInfo (com.sun.enterprise.security.jauth.jaspic.provider.PacketMessageInfo)8 Packet (com.sun.xml.ws.api.message.Packet)8 PacketMapMessageInfo (com.sun.enterprise.security.jauth.jaspic.provider.PacketMapMessageInfo)7 Subject (javax.security.auth.Subject)7 WebServiceException (javax.xml.ws.WebServiceException)7 WSSecureConversationException (com.sun.xml.ws.security.secconv.WSSecureConversationException)5 ClientAuthContext (javax.security.auth.message.config.ClientAuthContext)3 PrivilegedActionException (java.security.PrivilegedActionException)2 HashMap (java.util.HashMap)2 AuthException (javax.security.auth.message.AuthException)2 AuthStatus (javax.security.auth.message.AuthStatus)2 ServerAuthContext (javax.security.auth.message.config.ServerAuthContext)2 JAXBElement (javax.xml.bind.JAXBElement)2 Message (com.sun.xml.ws.api.message.Message)1 WSDLBoundOperation (com.sun.xml.ws.api.model.wsdl.WSDLBoundOperation)1 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 QName (javax.xml.namespace.QName)1 SOAPMessage (javax.xml.soap.SOAPMessage)1