FileDocCategorySizeDatePackage
ClientAuthConfig.javaAPI DocGlassfish v2 API5810Fri May 04 22:35:36 BST 2007com.sun.enterprise.security.jauth

ClientAuthConfig

public class ClientAuthConfig extends BaseAuthConfig
This class is the client container's interface to the AuthConfig subsystem to get AuthContext objects on which to invoke message layer authentication providers. It is not intended to be layer or web services specific (see getMechanisms method at end).

Fields Summary
private static Logger
logger
Constructors Summary
private ClientAuthConfig(com.sun.enterprise.security.jauth.ClientAuthContext defaultContext)


       
	super(defaultContext);
    
private ClientAuthConfig(ArrayList descriptors, ArrayList authContexts)

	super(descriptors,authContexts);
    
Methods Summary
private static com.sun.enterprise.security.jauth.ClientAuthContextgetAuthContext(java.lang.String layer, java.lang.String provider, com.sun.enterprise.security.jauth.AuthPolicy requestPolicy, com.sun.enterprise.security.jauth.AuthPolicy responsePolicy, javax.security.auth.callback.CallbackHandler cbh)

	AuthConfig authConfig = AuthConfig.getAuthConfig();
	return authConfig.getClientAuthContext
	    (layer,provider,requestPolicy,responsePolicy,cbh);
    
public com.sun.enterprise.security.jauth.ClientAuthContextgetAuthContext(com.sun.xml.rpc.spi.runtime.StreamingHandler handler, javax.xml.soap.SOAPMessage message)

	return (ClientAuthContext) getContext(handler,message);
    
public com.sun.enterprise.security.jauth.ClientAuthContextgetAuthContext(javax.xml.ws.handler.soap.SOAPMessageContext context)

	return (ClientAuthContext) getContext(context);
    
public com.sun.enterprise.security.jauth.ClientAuthContextgetAuthContextForOpCode(com.sun.xml.rpc.spi.runtime.StreamingHandler handler, int opcode)

	return (ClientAuthContext) getContextForOpCode(handler,opcode);
    
public static com.sun.enterprise.security.jauth.ClientAuthConfiggetConfig(java.lang.String authLayer, com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor binding, javax.security.auth.callback.CallbackHandler cbh)

	ClientAuthConfig rvalue = null;
	String provider = null;
	ArrayList descriptors = null;
	ClientAuthContext defaultContext = null;
	if (binding != null) {
	    String layer = binding.getAttributeValue
		(MessageSecurityBindingDescriptor.AUTH_LAYER);
	    if (authLayer != null && layer.equals(authLayer)) {
		provider = binding.getAttributeValue
		    (MessageSecurityBindingDescriptor.PROVIDER_ID);
		descriptors = binding.getMessageSecurityDescriptors();
	    }
	}
	if (descriptors == null || descriptors.size() == 0) {
	    defaultContext = getAuthContext(authLayer,provider,null,null,cbh);
	    if (defaultContext != null) {
		rvalue = new ClientAuthConfig(defaultContext);
	    }
	} else {
	    boolean hasPolicy = false;
	    ArrayList authContexts = new ArrayList();
	    for (int i = 0; i < descriptors.size(); i++) {
		MessageSecurityDescriptor msd = 
		    (MessageSecurityDescriptor) descriptors.get(i);
		AuthPolicy requestPolicy = 
		    getAuthPolicy(msd.getRequestProtectionDescriptor());
		AuthPolicy responsePolicy = 
		    getAuthPolicy(msd.getResponseProtectionDescriptor());
 		if (requestPolicy.authRequired()||responsePolicy.authRequired()) {
		    authContexts.add
			(getAuthContext
			 (authLayer,provider,requestPolicy,responsePolicy,cbh));
		    hasPolicy = true;
		} else {
		    authContexts.add(null);
		}
	    }
	    if (hasPolicy) {
		rvalue = new ClientAuthConfig(descriptors,authContexts);
	    }
	}
	return rvalue;