NTLMConfigurator
----------------
Key: JBESB-1391
URL:
http://jira.jboss.com/jira/browse/JBESB-1391
Project: JBoss ESB
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Rosetta
Affects Versions: 4.2.1
Environment: JBOSS ESB 4.2.1 GA
Reporter: Faisal Azizullah
Fix For: 4.2.1
package org.jboss.soa.esb.http.configurators;
/*
*
*@ author: Faisal Azizullah
*@ company : Lewisville ISD
*
*/
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.NTCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.http.Configurator;
import java.util.Properties;
/**
* HTTP NTLM Authentication Configurator.
* <p/>
* Properties:
* <ul>
* <li><b>username</b>: See {@link NTCredentials}.
(Required)</li>
* <li><b>password</b>: See {@link NTCredentials}.
(Required)</li>
* <li><b>authscope-host</b>: See {@link AuthScope}.
(Required)</li>
* <li><b>authscope-port</b>: See {@link AuthScope}.
(Required)</li>
* <li><b>authscope-domain</b>: See {@link AuthScope}.
(Required)</li>
* <li><b>authscope-realm</b>: See {@link AuthScope}.
(Optional)</li>
* </ul>
* <p/>
* See <a
href="http://jakarta.apache.org/commons/httpclient/authentication.ht...
Authentication Guide</a>.
*
*
*/
public class AuthNTLM extends Configurator
{
public void configure(HttpClient httpClient, Properties properties) throws
ConfigurationException {
String username = properties.getProperty("ntauth-username");
String password = properties.getProperty("ntauth-password");
String authScopeHost = properties.getProperty("ntauthscope-host");
String authScopePort = properties.getProperty("ntauthscope-port");
String authScopeRealm = properties.getProperty("ntauthscope-realm");
String authScopeDomain = properties.getProperty("ntauthscope-domain");
assertPropertySetAndNotBlank(username, "ntauth-username");
assertPropertySetAndNotBlank(password, "ntauth-password");
assertPropertySetAndNotBlank(authScopeHost, "ntauthscope-host");
assertPropertyIsInteger(authScopePort, "ntauthscope-port");
assertPropertySetAndNotBlank(authScopeDomain, "ntauthscope-domain");
Credentials creds = new NTCredentials(username,
password,authScopeHost,authScopeDomain);
AuthScope authScope;
if(authScopeRealm != null && !authScopeRealm.trim().equals(""))
{
authScope = new AuthScope(authScopeHost, Integer.parseInt(authScopePort),
authScopeRealm);
} else {
authScope = new AuthScope(authScopeHost, Integer.parseInt(authScopePort));
}
httpClient.getState().setCredentials(authScope, creds);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira