java.lang.Object
org.codelibs.jcifs.smb.impl.NtlmPasswordAuthenticator
org.codelibs.jcifs.smb.impl.Kerb5Authenticator
org.codelibs.jcifs.smb.impl.JAASAuthenticator
- All Implemented Interfaces:
Serializable,Cloneable,Principal,CallbackHandler,Credentials,CredentialsInternal,SmbRenewableCredentials
public class JAASAuthenticator
extends Kerb5Authenticator
implements CallbackHandler, SmbRenewableCredentials
JAAS kerberos authenticator
Either configure JAAS for credential caching or reuse a single instance of this authenticator -otherwise you won't
get proper ticket caching.
Be advised that short/NetBIOS name usage is not supported with this authenticator. Always specify full FQDNs/Realm.
This can be a problem if using DFS in it's default configuration as that still returns referrals in short form.
See KB-244380 for compatible server configuration.
See
Configuration.isDfsConvertToFQDN() for a workaround.- Author:
- mbechler
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codelibs.jcifs.smb.impl.NtlmPasswordAuthenticator
NtlmPasswordAuthenticator.AuthenticationType -
Constructor Summary
ConstructorsConstructorDescriptionCreate an authenticator using the JAAS serviceorg.codelibs.jcifs.smbThis will require that a keytab is configured in this service.JAASAuthenticator(String serviceName) Create an authenticator using the given JAAS service This will require that a keytab is configured in this service.JAASAuthenticator(String domain, String username, String password) Create an authenticator using the given credentials This will create a JAAS configuration that is used to obtain a TGT.JAASAuthenticator(String serviceName, String domain, String username, String password) Create an authenticator using the given JAAS service and the specified credentialsCreate an authenticator using the given credentials This will create a JAAS configuration with the specified properties that is used to obtain a TGT. -
Method Summary
Modifier and TypeMethodDescriptionclone()Create a copy of the credentials.protected static voidcloneInternal(JAASAuthenticator to, JAASAuthenticator from) Clone the contextGet theSubjectobject.voidbooleanCheck if these are anonymous credentials.booleanisGuest()Check if these are guest credentials.voidrefresh()Refresh the credentials.renew()Renew the credentialsMethods inherited from class org.codelibs.jcifs.smb.impl.Kerb5Authenticator
cloneInternal, createContext, equals, getLifeTime, getRealm, getService, getUser, getUserDomain, getUserLifeTime, hashCode, isPreferredMech, setForceFallback, setLifeTime, setRealm, setService, setSubject, setUser, setUserLifeTime, toStringMethods inherited from class org.codelibs.jcifs.smb.impl.NtlmPasswordAuthenticator
cloneInternal, getAnsiHash, getName, getNTHash, getPassword, getSigningKey, getSpecifiedUserDomain, getUnicodeHash, getUsername, getUserSessionKey, getUserSessionKey, guessAuthenticationType, unwrapMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codelibs.jcifs.smb.Credentials
getUserDomain, unwrapMethods inherited from interface org.codelibs.jcifs.smb.impl.CredentialsInternal
createContext
-
Constructor Details
-
JAASAuthenticator
public JAASAuthenticator()Create an authenticator using the JAAS serviceorg.codelibs.jcifs.smbThis will require that a keytab is configured in this service. -
JAASAuthenticator
Create an authenticator using the given JAAS service This will require that a keytab is configured in this service.- Parameters:
serviceName- JAAS configuration name
-
JAASAuthenticator
Create an authenticator using the given JAAS service and the specified credentials- Parameters:
serviceName- JAAS configuration namedomain- the domain for authenticationusername- the username for authenticationpassword- the password for authentication
-
JAASAuthenticator
Create an authenticator using the given credentials This will create a JAAS configuration that is used to obtain a TGT.- Parameters:
domain- the domain for authenticationusername- the username for authenticationpassword- the password for authentication
-
JAASAuthenticator
Create an authenticator using the given credentials This will create a JAAS configuration with the specified properties that is used to obtain a TGT.- Parameters:
properties- JAAS properties to setdomain- the domain for authenticationusername- the username for authenticationpassword- the password for authentication
-
-
Method Details
-
isAnonymous
public boolean isAnonymous()Check if these are anonymous credentials.- Specified by:
isAnonymousin interfaceCredentials- Overrides:
isAnonymousin classKerb5Authenticator- Returns:
- whether these are anonymous credentials
- See Also:
-
isGuest
public boolean isGuest()Check if these are guest credentials.- Specified by:
isGuestin interfaceCredentials- Overrides:
isGuestin classNtlmPasswordAuthenticator- Returns:
- whether these are guest credentials
- See Also:
-
clone
Description copied from interface:CredentialsInternalCreate a copy of the credentials.- Specified by:
clonein interfaceCredentialsInternal- Overrides:
clonein classKerb5Authenticator- Returns:
- a copy of the credentials
-
cloneInternal
Clone the context- Parameters:
to- the target authenticatorfrom- the source authenticator
-
refresh
Refresh the credentials.- Specified by:
refreshin interfaceCredentialsInternal- Overrides:
refreshin classKerb5Authenticator- Throws:
CIFSException- if refresh fails- See Also:
-
getSubject
Get theSubjectobject.- Specified by:
getSubjectin interfaceCredentialsInternal- Overrides:
getSubjectin classKerb5Authenticator- Returns:
- Subject represents the user who perform Kerberos authentication. It contains the tickets retrieve from KDC.
- See Also:
-
renew
Renew the credentials- Specified by:
renewin interfaceSmbRenewableCredentials- Returns:
- the renewed credentials
- See Also:
-
handle
- Specified by:
handlein interfaceCallbackHandler- Throws:
IOExceptionUnsupportedCallbackException- See Also:
-