FileDocCategorySizeDatePackage
WSITServerSecurityPipe.javaAPI DocExample6852Tue May 29 16:57:24 BST 2007com.sun.xml.wss.provider.wsit

WSITServerSecurityPipe

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

Fields Summary
private static final Logger
log
Map
properties
com.sun.xml.ws.api.pipe.Pipe
nextPipe
javax.security.auth.message.config.ServerAuthConfig
serverAuthConfig
javax.security.auth.message.config.ServerAuthContext
serverAuthContext
Constructors Summary
public WSITServerSecurityPipe(WSITServerSecurityPipe that)

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

        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 {
            serverAuthConfig = provider.getServerAuthConfig("SOAP", null, null);
            //initialize the serverAuthContext
            serverAuthContext = serverAuthConfig.getAuthContext(null, null, properties);
        } catch (AuthException e) {
            log.log(Level.SEVERE, 
                    LogStringsMessages.WSITPVD_0047_ERROR_CREATING_NEW_INSTANCE_WSIT_SERVER_SEC_PIPE(), e);
            throw new RuntimeException(
                    LogStringsMessages.WSITPVD_0047_ERROR_CREATING_NEW_INSTANCE_WSIT_SERVER_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 WSITServerSecurityPipe(this);
        ((WSITServerSecurityPipe)copied).setNextPipe(clonedNextPipe);
        cloner.add(this, copied);
        return copied;    
    
public voidpreDestroy()

        try {
            serverAuthContext.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);
            AuthStatus status = serverAuthContext.validateRequest(messageInfo, null,null);

            if (status == status.SEND_SUCCESS || status == status.SEND_FAILURE || status == status.FAILURE) {
                return (Packet)messageInfo.getMap().get("RES_PACKET");
            }

            Packet retPacket = nextPipe.process((Packet)messageInfo.getRequestMessage());
            messageInfo.getMap().put("RES_PACKET",retPacket);

            if (retPacket.getMessage() == null) {
                return retPacket;
            }
            //TODO: check auth status here as well
            serverAuthContext.secureResponse(messageInfo, 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;