WSITAuthConfigProviderpublic class WSITAuthConfigProvider extends Object implements javax.security.auth.message.config.AuthConfigProvider
Fields Summary |
---|
private static final String | SECURITY_POLICY_NAMESPACE_URI | String | id | String | description | WeakHashMap | clientConfigMap | WeakHashMap | serverConfigMap | private ReentrantReadWriteLock | rwLock | private ReentrantReadWriteLock$ReadLock | rLock | private ReentrantReadWriteLock$WriteLock | wLock |
Constructors Summary |
---|
public WSITAuthConfigProvider(Map props, javax.security.auth.message.config.AuthConfigFactory factory)Creates a new instance of WSITAuthConfigProvider
//properties = props;
//this.factory = factory;
if (factory != null) {
factory.registerConfigProvider(this, "SOAP", null,description);
}
this.rwLock = new ReentrantReadWriteLock(true);
this.rLock = rwLock.readLock();
this.wLock = rwLock.writeLock();
|
Methods Summary |
---|
public javax.security.auth.message.config.ClientAuthConfig | getClientAuthConfig(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler callbackHandler)
ClientAuthConfig clientConfig = null;
try {
this.rLock.lock();
clientConfig = (ClientAuthConfig)this.clientConfigMap.get(appContext);
if (clientConfig != null) {
return clientConfig;
}
} 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 (clientConfig == null) {
clientConfig = new WSITClientAuthConfig(layer, appContext, callbackHandler);
this.clientConfigMap.put(appContext, clientConfig);
}
return clientConfig;
} finally {
this.wLock.unlock();
}
| public javax.security.auth.message.config.ServerAuthConfig | getServerAuthConfig(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler callbackHandler)
ServerAuthConfig serverConfig = null;
try {
this.rLock.lock();
serverConfig = (ServerAuthConfig)this.serverConfigMap.get(appContext);
if (serverConfig != null) {
return serverConfig;
}
} 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 (serverConfig == null) {
serverConfig = new WSITServerAuthConfig(layer, appContext, callbackHandler);
this.serverConfigMap.put(appContext,serverConfig);
}
return serverConfig;
} finally {
this.wLock.unlock();
}
| public static boolean | isSecurityEnabled(com.sun.xml.ws.policy.PolicyMap policyMap, com.sun.xml.ws.api.model.wsdl.WSDLPort wsdlPort)Checks to see whether WS-Security is enabled or not.
if (policyMap == null || wsdlPort == null)
return false;
try {
PolicyMapKey endpointKey = policyMap.createWsdlEndpointScopeKey(wsdlPort.getOwner().getName(),
wsdlPort.getName());
Policy policy = policyMap.getEndpointEffectivePolicy(endpointKey);
if ((policy != null) && policy.contains(SECURITY_POLICY_NAMESPACE_URI)) {
return true;
}
for (WSDLBoundOperation wbo : wsdlPort.getBinding().getBindingOperations()) {
PolicyMapKey operationKey = policyMap.createWsdlOperationScopeKey(wsdlPort.getOwner().getName(),
wsdlPort.getName(),
wbo.getName());
policy = policyMap.getOperationEffectivePolicy(operationKey);
if ((policy != null) && policy.contains(SECURITY_POLICY_NAMESPACE_URI))
return true;
policy = policyMap.getInputMessageEffectivePolicy(operationKey);
if ((policy != null) && policy.contains(SECURITY_POLICY_NAMESPACE_URI))
return true;
policy = policyMap.getOutputMessageEffectivePolicy(operationKey);
if ((policy != null) && policy.contains(SECURITY_POLICY_NAMESPACE_URI))
return true;
policy = policyMap.getFaultMessageEffectivePolicy(operationKey);
if ((policy != null) && policy.contains(SECURITY_POLICY_NAMESPACE_URI))
return true;
}
} catch (PolicyException e) {
throw new WebServiceException(e);
}
return false;
| public void | refresh()
|
|