FileDocCategorySizeDatePackage
WSITClientSecurityPipe.javaAPI DocExample6573Tue May 29 16:57:22 BST 2007com.sun.xml.wss.provider.wsit

WSITClientSecurityPipe

public class WSITClientSecurityPipe extends Object implements com.sun.xml.ws.api.pipe.Pipe
author
kumar.jayanti

Fields Summary
private static final Logger
log
com.sun.xml.ws.api.pipe.Pipe
nextPipe
Map
properties
javax.security.auth.message.config.ClientAuthConfig
clientConfig
javax.security.auth.message.config.ClientAuthContext
clientAuthContext
Constructors Summary
public WSITClientSecurityPipe(WSITClientSecurityPipe that)

    
       
        this.clientConfig = that.clientConfig;
        this.clientAuthContext = that.clientAuthContext;
        this.properties = that.properties;
    
public WSITClientSecurityPipe(Map properties, com.sun.xml.ws.api.pipe.Pipe nextPipe)
Creates a new instance of WSITClientSecurityPipe

        this.properties = properties;
        this.nextPipe = nextPipe;
        properties.put("NEXT_PIPE", nextPipe);
        //TODO: Load the Class by reflection.
        //Hack for now
        AuthConfigProvider provider = new WSITAuthConfigProvider(properties, null);
        try {
            clientConfig = provider.getClientAuthConfig("SOAP", null, null);
            //initialize the clientAuthContext
            clientAuthContext = clientConfig.getAuthContext(null, null, properties);
            properties.put("SC_INITIATOR", clientAuthContext);
        } catch (AuthException e) {
            log.log(Level.SEVERE, 
                    LogStringsMessages.WSITPVD_0038_ERROR_CREATING_NEW_INSTANCE_WSIT_CLIENT_SEC_PIPE(), e);
            throw new RuntimeException(
                    LogStringsMessages.WSITPVD_0038_ERROR_CREATING_NEW_INSTANCE_WSIT_CLIENT_SEC_PIPE(), e);
        }
    
Methods Summary
public com.sun.xml.ws.api.pipe.Pipecopy(com.sun.xml.ws.api.pipe.PipeCloner cloner)

        Pipe clonedNextPipe = cloner.copy(nextPipe);
        Pipe copied = new WSITClientSecurityPipe(this);
        ((WSITClientSecurityPipe)copied).setNextPipe(clonedNextPipe);
        cloner.add(this, copied);
        return copied;    
    
public voidpreDestroy()

        try {
            clientAuthContext.cleanSubject(null, null);
        } catch (AuthException e) {
            log.log(Level.SEVERE, 
                    LogStringsMessages.WSITPVD_0040_ERROR_CLEAN_SUBJECT(), e);            
            throw new RuntimeException(
                    LogStringsMessages.WSITPVD_0040_ERROR_CLEAN_SUBJECT(), e);
        }
        if (nextPipe != null) {
            nextPipe.preDestroy();
        }
    
public com.sun.xml.ws.api.message.Packetprocess(com.sun.xml.ws.api.message.Packet packet)

        MessageInfo messageInfo = new PacketMessageInfo();
        try {
            messageInfo.getMap().put("REQ_PACKET",packet);
            clientAuthContext.secureRequest(messageInfo, null);

            Packet retPacket = nextPipe.process((Packet)messageInfo.getMap().get("REQ_PACKET"));
            messageInfo.getMap().put("RES_PACKET", retPacket);
            if (retPacket.getMessage() == null) {
                return retPacket;
            }

            clientAuthContext.validateResponse(messageInfo, null, null);
        } catch (AuthException e) {
            log.log(Level.SEVERE, 
                    LogStringsMessages.WSITPVD_0039_ERROR_PROCESSING_INCOMING_PACKET(), e);
            throw new WebServiceException(
                    LogStringsMessages.WSITPVD_0039_ERROR_PROCESSING_INCOMING_PACKET(), e);
        }
        return (Packet)messageInfo.getMap().get("RES_PACKET");
    
public voidsetNextPipe(com.sun.xml.ws.api.pipe.Pipe next)

        this.nextPipe = next;