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

WSITServerAuthConfig

public class WSITServerAuthConfig extends Object implements javax.security.auth.message.config.ServerAuthConfig
author
kumar jayanti

Fields Summary
private String
layer
private String
appContext
private WSITServerAuthContext
serverAuthContext
private com.sun.xml.ws.policy.PolicyMap
policyMap
private String
secDisabled
private ReentrantReadWriteLock
rwLock
private ReentrantReadWriteLock$ReadLock
rLock
private ReentrantReadWriteLock$WriteLock
wLock
private static final String
TRUE
private static final String
FALSE
Constructors Summary
public WSITServerAuthConfig(String layer, String appContext, CallbackHandler callbackHandler)
Creates a new instance of WSITServerAuthConfig

    
           
           
        this.layer = layer;
        this.appContext = appContext;
        //this.cbh = callbackHandler;
        this.rwLock = new ReentrantReadWriteLock(true);
        this.rLock = rwLock.readLock();
        this.wLock = rwLock.writeLock();
    
Methods Summary
public java.lang.StringgetAppContext()

        return appContext;
    
public javax.security.auth.message.config.ServerAuthContextgetAuthContext(java.lang.String operation, javax.security.auth.Subject subject, java.util.Map map)

         PolicyMap  pMap = (PolicyMap)map.get("POLICY");
         WSDLPort port =(WSDLPort)map.get("WSDL_MODEL");
         if (pMap == null || pMap.isEmpty()) {
             //TODO: log warning here if pMap == null
             return null;
         }
         
         //check if security is enabled
         //if policy has changed due to redeploy, check if security is enabled
         if (this.secDisabled == null || (policyMap != pMap)) {
             try {
                 this.wLock.lock();
                 if (this.secDisabled == null || (policyMap != pMap)) {
                     if (!WSITAuthConfigProvider.isSecurityEnabled(pMap,port)) {
                         this.secDisabled = TRUE;
                         return null;
                     } else {
                         this.secDisabled = FALSE;
                     }
                 }
             } finally {
                 this.wLock.unlock();
             }
         }
         
         if (this.secDisabled == TRUE) {
             return null;
         }
         
         try {
             this.rLock.lock();
             if (serverAuthContext != null) {
                 //return the cached one only if the same policyMap was passed in
                 if (policyMap == pMap) {
                     return serverAuthContext;
                 }
             }
         } finally {
             this.rLock.unlock();
         }
        // make sure you don't hold the rlock when you request the wlock
        // or you will encounter dealock
         
         try {
             this.wLock.lock();
             // recheck the precondition, since the rlock was released.
             if ((serverAuthContext == null) || (policyMap != pMap)) {
                 serverAuthContext = new WSITServerAuthContext(operation, subject, map);
                 policyMap = pMap;
             }
             return serverAuthContext;
         } finally {
             this.wLock.unlock();
         }
    
public java.lang.StringgetAuthContextID(javax.security.auth.message.MessageInfo messageInfo)

        return null;
    
public java.lang.StringgetMessageLayer()

        return layer;
    
public java.lang.StringgetOperation(javax.security.auth.message.MessageInfo messageInfo)

        return null;
    
public booleanisProtected()

        return true;
    
public voidrefresh()