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

ServerAuthConfig

public class ServerAuthConfig 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 ServerAuthConfig(com.sun.enterprise.security.jauth.ServerAuthContext defaultContext)


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

	super(descriptors,authContexts);
    
Methods Summary
private static com.sun.enterprise.security.jauth.ServerAuthContextgetAuthContext(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.getServerAuthContext
	    (layer,provider,requestPolicy,responsePolicy,cbh);
    
public com.sun.enterprise.security.jauth.ServerAuthContextgetAuthContext(com.sun.xml.rpc.spi.runtime.StreamingHandler handler, javax.xml.soap.SOAPMessage message)

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

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

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

	ServerAuthConfig rvalue = null;
	String provider = null;
	ArrayList descriptors = null;
	ServerAuthContext 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 ServerAuthConfig(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 ServerAuthConfig(descriptors,authContexts);
	    }
	}
	return rvalue;