XFire

Missing NTLM support for dynamic client

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: None
  • Component/s: Core
  • Labels:
    None
  • Number of attachments :
    1

Description

org.codehaus.xfire.transport.http.CommonsHttpMessageSender does not support NTLM authentication.

Here is snippet from XFire 1.1 about authorization:

String username = (String) context.getContextualProperty(Channel.USERNAME);
if (username != null)
{
String password = (String) context.getContextualProperty(Channel.PASSWORD);
client.getParams().setAuthenticationPreemptive(true);
state.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
}

There should be a way to plug custom credentials to the transport stack. To workaround this I had to reimplement
whole http handling stack as subsequent layers are created as local variables instead of access by dependency.

Activity

Hide
Tomasz Sztelak added a comment -

Can attach this patch or at least some code sample ? This will make our work easier

Show
Tomasz Sztelak added a comment - Can attach this patch or at least some code sample ? This will make our work easier
Hide
Sara added a comment -

Can you post your client code as well?

Show
Sara added a comment - Can you post your client code as well?
Hide
Piotr Smolinski added a comment -

Approach similar to Axis 1.x:

int domainIndex = username.indexOf('
');
if (domainIndex > 0 && username.length() > domainIndex + 1) { state.setCredentials( AuthScope.ANY, new NTCredentials( username.substring(0, domainIndex), password, "localhost", // TODO: resolve local host name username.substring(domainIndex+1))); } else { state.setCredentials( AuthScope.ANY, new UsernamePasswordCredentials( username, password)); }

Other possible solution:

Add service parameter Channel.AUTHTYPE /"Basic", "NTLM"/ to distinguish between types of authentication schemes and Channel.DOMAIN to avoid parsing username.

Piotr

Show
Piotr Smolinski added a comment - Approach similar to Axis 1.x: int domainIndex = username.indexOf('
'); if (domainIndex > 0 && username.length() > domainIndex + 1) { state.setCredentials( AuthScope.ANY, new NTCredentials( username.substring(0, domainIndex), password, "localhost", // TODO: resolve local host name username.substring(domainIndex+1))); } else { state.setCredentials( AuthScope.ANY, new UsernamePasswordCredentials( username, password)); } Other possible solution: Add service parameter Channel.AUTHTYPE /"Basic", "NTLM"/ to distinguish between types of authentication schemes and Channel.DOMAIN to avoid parsing username. Piotr
Hide
Tomasz Sztelak added a comment -

Code added to svn

Show
Tomasz Sztelak added a comment - Code added to svn

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: