Package waffle.windows.auth.impl
Class WindowsAuthProviderImpl
- java.lang.Object
-
- waffle.windows.auth.impl.WindowsAuthProviderImpl
-
- All Implemented Interfaces:
IWindowsAuthProvider
public class WindowsAuthProviderImpl extends Object implements IWindowsAuthProvider
Windows Auth Provider.- Author:
- dblock[at]dblock[dot]org
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTINUE_CONTEXT_TIMEOUTThe Continue Context Timeout.
-
Constructor Summary
Constructors Constructor Description WindowsAuthProviderImpl()Instantiates a new windows auth provider impl.WindowsAuthProviderImpl(int continueContextsTimeout)A Windows authentication provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IWindowsSecurityContextacceptSecurityToken(String connectionId, byte[] token, String securityPackage)Attempts to validate the user using an SSPI token.intgetContinueContextsSize()Number of elements in the continue contexts map.IWindowsComputergetCurrentComputer()Retrieve the current computer information.IWindowsDomain[]getDomains()Retrieve a list of domains (Active Directory) on the local server.IWindowsIdentitylogonDomainUser(String username, String domain, String password)The LogonDomainUser function attempts to log a user on to the local computer using a network logon type and the default authentication provider.IWindowsIdentitylogonDomainUserEx(String username, String domain, String password, int logonType, int logonProvider)The LogonDomainUserEx function attempts to log a user on to the local computer.IWindowsIdentitylogonUser(String username, String password)The LogonUser function attempts to log a user on to the local computer using a network logon type and the default authentication provider.IWindowsAccountlookupAccount(String username)Retrieve a security identifier (SID) for the account and the name of the domain or local computer on which the account was found.voidresetSecurityToken(String connectionId)Reset a previously saved continuation security token for a given connection id.
-
-
-
Field Detail
-
CONTINUE_CONTEXT_TIMEOUT
public static final int CONTINUE_CONTEXT_TIMEOUT
The Continue Context Timeout.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WindowsAuthProviderImpl
public WindowsAuthProviderImpl()
Instantiates a new windows auth provider impl.
-
WindowsAuthProviderImpl
public WindowsAuthProviderImpl(int continueContextsTimeout)
A Windows authentication provider.- Parameters:
continueContextsTimeout- Timeout for security contexts in seconds.
-
-
Method Detail
-
acceptSecurityToken
public IWindowsSecurityContext acceptSecurityToken(String connectionId, byte[] token, String securityPackage)
Description copied from interface:IWindowsAuthProviderAttempts to validate the user using an SSPI token. This token is generated by the client via the InitializeSecurityContext(package) method described in https://msdn.microsoft.com/en-us/library/aa375509(VS.85).aspx- Specified by:
acceptSecurityTokenin interfaceIWindowsAuthProvider- Parameters:
connectionId- A unique connection id.token- The security token generated by the client wishing to logon.securityPackage- The name of the security package to use. Can be any security package supported by both the client and the server. This is usually set to "Negotiate" which will use SPNEGO to determine which security package to use. Other common values are "Kerberos" and "NTLM".- Returns:
- Windows account.
-
getCurrentComputer
public IWindowsComputer getCurrentComputer()
Description copied from interface:IWindowsAuthProviderRetrieve the current computer information.- Specified by:
getCurrentComputerin interfaceIWindowsAuthProvider- Returns:
- Current computer information.
-
getDomains
public IWindowsDomain[] getDomains()
Description copied from interface:IWindowsAuthProviderRetrieve a list of domains (Active Directory) on the local server.- Specified by:
getDomainsin interfaceIWindowsAuthProvider- Returns:
- A list of domains.
-
logonDomainUser
public IWindowsIdentity logonDomainUser(String username, String domain, String password)
Description copied from interface:IWindowsAuthProviderThe LogonDomainUser function attempts to log a user on to the local computer using a network logon type and the default authentication provider.- Specified by:
logonDomainUserin interfaceIWindowsAuthProvider- Parameters:
username- A string that specifies the name of the user. This is the name of the user account to log on to. If you use the user principal name (UPN) format, user@DNS_domain_name, the domain parameter must be NULL.domain- A string that specifies the name of the domain or server whose account database contains the username account. If this parameter is NULL, the user name must be specified in UPN format. If this parameter is ".", the function validates the account by using only the local account database.password- A string that specifies the plaintext password for the user account specified by username.- Returns:
- Windows identity.
-
logonDomainUserEx
public IWindowsIdentity logonDomainUserEx(String username, String domain, String password, int logonType, int logonProvider)
Description copied from interface:IWindowsAuthProviderThe LogonDomainUserEx function attempts to log a user on to the local computer. The local computer is the computer from which LogonUser was called. You cannot use LogonUser to log on to a remote computer. You specify the user with a user name and domain and authenticate the user with a plaintext password.- Specified by:
logonDomainUserExin interfaceIWindowsAuthProvider- Parameters:
username- A string that specifies the name of the user. This is the name of the user account to log on to. If you use the user principal name (UPN) format, user@DNS_domain_name, the domain parameter must be NULL.domain- A string that specifies the name of the domain or server whose account database contains the username account. If this parameter is NULL, the user name must be specified in UPN format. If this parameter is ".", the function validates the account by using only the local account database.password- A string that specifies the plaintext password for the user account specified by username.logonType- The type of logon operation to perform.logonProvider- Specifies the logon provider.- Returns:
- Windows identity.
-
logonUser
public IWindowsIdentity logonUser(String username, String password)
Description copied from interface:IWindowsAuthProviderThe LogonUser function attempts to log a user on to the local computer using a network logon type and the default authentication provider.- Specified by:
logonUserin interfaceIWindowsAuthProvider- Parameters:
username- A string that specifies the name of the user in the UPN format.password- A string that specifies the plaintext password for the user account specified by username.- Returns:
- Windows identity.
-
lookupAccount
public IWindowsAccount lookupAccount(String username)
Description copied from interface:IWindowsAuthProviderRetrieve a security identifier (SID) for the account and the name of the domain or local computer on which the account was found.- Specified by:
lookupAccountin interfaceIWindowsAuthProvider- Parameters:
username- Fully qualified or partial username.- Returns:
- Windows account.
-
resetSecurityToken
public void resetSecurityToken(String connectionId)
Description copied from interface:IWindowsAuthProviderReset a previously saved continuation security token for a given connection id.- Specified by:
resetSecurityTokenin interfaceIWindowsAuthProvider- Parameters:
connectionId- Connection id.
-
getContinueContextsSize
public int getContinueContextsSize()
Number of elements in the continue contexts map.- Returns:
- Number of elements in the hash map.
-
-