____________________
import com.sun.security.auth.module.NTSystem;
public final class SunNTSystemLogin implements ISystemLogin
{
private static SunNTSystemLogin singleton = null;private String _domainNT; private String _username;
private SunNTSystemLogin()
{
NTSystem ntSystem = new NTSystem();
_domainNT = ntSystem.getDomain();
_username = ntSystem.getName();
}public static SunNTSystemLogin getInstance()
{
if (singleton == null)
{
singleton = new SunNTSystemLogin();
}
return singleton;
}public String getDomain()
{
return _domainNT;
}public String getUser()
{
return _username;
}
}
____________________The class imported above comes from Sun's NT implementation of JAAS.
- Chris
From: Oleg Kalnichevski <[EMAIL PROTECTED]> Reply-To: "HttpClient Project" <[email protected]> To: HttpClient Project <[email protected]> Subject: RE: NTLM help -- how to get domain? Date: Thu, 20 Jan 2005 20:44:55 +0100
Dave,
The user _should_ explicitly specify her domain as a part of Windows authentication process, because it may not necessarily be that of the host. One _could_ dynamically retrieve the logon credentials using Win32 API or Active Directory API, assuming this is the set of credentials user wants to be authenticating with, but that would imply the use of platform dependent code in your application
Oleg
On Thu, 2005-01-20 at 14:27 -0500, Dave Seidel wrote:
> So what I'm really trying to figure out is what value to use for the domain
> name when constructing an instance of NTCredentials. I'd been using the
> client's hostname. This works on our LAN, which has no domain controller
> and just uses a workgroup. But I'm guessing that in an environment with a
> domain controller, I need to use the real domain name. Is that correct?
> And if so, is %USERDOMAIN% a valid way to get that name?
>
> - Dave
>
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 20, 2005 2:10 PM
> To: HttpClient Project
> Subject: Re: NTLM help -- how to get domain?
>
>
> > I guess a machine can be in more than one domain.
>
> Not really. A host can be member of one domain only, but the domain in
> question may trust (and be trusted by) other domains, in which case the
> domain controller delegates authentication to a domain controller of the
> trusted domain
>
> Sorry for being pedantic. I used to be an MCSD in pre .NET times ;-)
>
> Evil Comrade Oleg
>
>
> > You must provide the
> > domain you are authenticating against (which is not necessarily the same
> > as the machine is in). I see the domain name as a name space, in which a
> > set of credentials is valid. I don't know of a way to retrieve the NT
> > domains of a machine. Maybe ask MS.
> >
> > Ortwin Gl�ck
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
MSN Messenger : dialoguez en temps r�el avec vos amis ! http://g.msn.fr/FR1001/866
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
