Class DefaultSVNAuthenticationManager
java.lang.Object
org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager
- All Implemented Interfaces:
ISVNAuthenticationManager
,ISVNSSHHostVerifier
,ISVNSSLPasspharsePromptSupport
public class DefaultSVNAuthenticationManager
extends java.lang.Object
implements ISVNAuthenticationManager, ISVNSSLPasspharsePromptSupport, ISVNSSHHostVerifier
- Version:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
protected class
class
class
private static class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ISVNAuthenticationStorageOptions
private java.io.File
private DefaultSVNOptions
private ISVNHostOptionsProvider
private boolean
private boolean
private boolean
private SVNAuthentication
private int
private SVNAuthentication
private SVNErrorMessage
private ISVNAuthenticationProvider[]
private ISVNAuthenticationStorage
Fields inherited from interface org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
PASSWORD, SSH, SSL, USERNAME
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSVNAuthenticationManager
(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase) Creates an instance ofDefaultSVNAuthenticationManager
DefaultSVNAuthenticationManager
(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, java.lang.String password) Deprecated.DefaultSVNAuthenticationManager
(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, java.lang.String password, java.io.File privateKey, java.lang.String passphrase) -
Method Summary
Modifier and TypeMethodDescriptionvoid
acknowledgeAuthentication
(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication) Accepts the given authentication if it was successfully accepted by a repository server, or not if authentication failed.void
acknowledgeTrustManager
(javax.net.ssl.TrustManager manager) Acknowledges the specified trust manager.protected ISVNAuthenticationProvider
createCacheAuthenticationProvider
(java.io.File authDir, java.lang.String userName) protected ISVNAuthenticationProvider
createDefaultAuthenticationProvider
(java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase, boolean allowSave) protected ISVNAuthenticationProvider
void
Dismiss cached sensitive data (e.g.private static boolean
equals
(byte[] b1, byte[] b2) protected ISVNAuthenticationProvider
java.util.Collection<java.lang.String>
getAuthTypes
(SVNURL url) protected java.io.File
int
getConnectTimeout
(SVNRepository repository) Returns the connection timeout value in milliseconds whichrepository
should use in network connection operations.protected SVNSSHAuthentication
getFirstAuthentication
(java.lang.String kind, java.lang.String realm, SVNURL url) Retrieves the first user credential.getNextAuthentication
(java.lang.String kind, java.lang.String realm, SVNURL url) Retrieves the next user credential if the first try failed.getProxyManager
(SVNURL url) Returns a proxy manager that keeps settings for that proxy server over which HTTP requests are send to a repository server.int
getReadTimeout
(SVNRepository repository) Returns the read timeout value in milliseconds whichrepository
should use in socket read operations.protected ISVNAuthenticationStorage
javax.net.ssl.TrustManager
getTrustManager
(SVNURL url) Returns a manager which handles trust data for the specifiedurl
.private boolean
hasExplicitCredentials
(java.lang.String kind) boolean
Checks whether client should send authentication credentials to a repository server not waiting for the server's challenge.boolean
Returns whether this authenticaiton manager dismiss sensitive data once credentials object has been used.boolean
void
setAuthenticationForced
(boolean forced) Specifies the way how credentials are to be supplied to a repository server.void
Sets a custom authentication provider that will provide user credentials for authentication.void
void
setDismissSensitiveDataUponUse
(boolean dismiss) Control whether to dismiss credentials sensitive data once credentials object has been used.protected void
setHostOptionsProvider
(ISVNHostOptionsProvider hostOptionsProvider) void
setInMemoryConfigOptions
(java.util.Map configOptions) void
setInMemoryServersOptions
(java.util.Map serversOptions) void
Sets a specific runtime authentication storage manager.void
verifyHostKey
(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
myIsStoreAuth
private boolean myIsStoreAuth -
myConfigDirectory
private java.io.File myConfigDirectory -
myAuthOptions
-
myDefaultOptions
-
myHostOptionsProvider
-
myRuntimeAuthStorage
-
myProviders
-
myPreviousAuthentication
-
myPreviousErrorMessage
-
myLastProviderIndex
private int myLastProviderIndex -
myLastLoadedAuth
-
myIsAuthenticationForced
private boolean myIsAuthenticationForced -
myIsAutoDismissSensitiveData
private boolean myIsAutoDismissSensitiveData
-
-
Constructor Details
-
DefaultSVNAuthenticationManager
public DefaultSVNAuthenticationManager(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, java.lang.String password) -
DefaultSVNAuthenticationManager
public DefaultSVNAuthenticationManager(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, java.lang.String password, java.io.File privateKey, java.lang.String passphrase) -
DefaultSVNAuthenticationManager
public DefaultSVNAuthenticationManager(java.io.File configDirectory, boolean storeAuth, java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase) Creates an instance ofDefaultSVNAuthenticationManager
- Since:
- 1.8.9
-
-
Method Details
-
setInMemoryServersOptions
public void setInMemoryServersOptions(java.util.Map serversOptions) -
setInMemoryConfigOptions
public void setInMemoryConfigOptions(java.util.Map configOptions) -
getAuthenticationStorageOptions
-
setAuthenticationStorageOptions
-
setAuthenticationProvider
Description copied from interface:ISVNAuthenticationManager
Sets a custom authentication provider that will provide user credentials for authentication.- Specified by:
setAuthenticationProvider
in interfaceISVNAuthenticationManager
- Parameters:
provider
- an authentication provider
-
getConfigDirectory
protected java.io.File getConfigDirectory() -
getDefaultOptions
-
getHostOptionsProvider
-
setHostOptionsProvider
-
getAuthTypes
-
getProxyManager
Description copied from interface:ISVNAuthenticationManager
Returns a proxy manager that keeps settings for that proxy server over which HTTP requests are send to a repository server.A default auth manager uses proxy settings from the standard servers file.
- Specified by:
getProxyManager
in interfaceISVNAuthenticationManager
- Parameters:
url
- a repository location that will be accessed over the proxy server for which a manager is needed- Returns:
- a proxy manager
- Throws:
SVNException
-
getTrustManager
Description copied from interface:ISVNAuthenticationManager
Returns a manager which handles trust data for the specifiedurl
. Note: in pre-1.2.0 versionsISVNAuthenticationManager
used to provideISVNSSLManager
via a methodgetSSLManager()
which is now replaced by this one.ISVNSSLManager
is no longer used (replaced byTrustManager
).- Specified by:
getTrustManager
in interfaceISVNAuthenticationManager
- Parameters:
url
- repository url- Returns:
- trust manager
- Throws:
SVNException
-
getFirstAuthentication
public SVNAuthentication getFirstAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException Description copied from interface:ISVNAuthenticationManager
Retrieves the first user credential. The scheme of retrieving credentials:- For the first try to authenticate a user to a repository (using the specifed realm) an SVNRepository driver calls getFirstAuthentication() and sends the retrieved credential.
- If the credential is accepted, it may be stored. If not, the driver
calls
getNextAuthentication()
and sends the next credential. - If the last credential was not accepted, the driver still tries to get the next credential for the same realm.
For each credential
kind
an implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:- Specified by:
getFirstAuthentication
in interfaceISVNAuthenticationManager
- Parameters:
kind
- a credential kindrealm
- a repository authentication realmurl
- a repository location that is to be accessed- Returns:
- the first try user credential
- Throws:
SVNException
-
getNextAuthentication
public SVNAuthentication getNextAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException Description copied from interface:ISVNAuthenticationManager
Retrieves the next user credential if the first try failed. The scheme of retrieving credentials:- For the first try to authenticate a user to a repository (using the
specifed realm) an SVNRepository driver calls
getFirstAuthentication()
and sends the retrieved credential. - If the credential is accepted, it may be stored. If not, the driver calls getNextAuthentication() and sends the next credential.
- If the last credential was not accepted, the driver still tries to get the next credential for the same realm.
For each credential
kind
an implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:- Specified by:
getNextAuthentication
in interfaceISVNAuthenticationManager
- Parameters:
kind
- a credential kindrealm
- a repository authentication realmurl
- a repository location that is to be accessed- Returns:
- the next try user credential
- Throws:
SVNException
- For the first try to authenticate a user to a repository (using the
specifed realm) an SVNRepository driver calls
-
setDismissSensitiveDataUponUse
public void setDismissSensitiveDataUponUse(boolean dismiss) Control whether to dismiss credentials sensitive data once credentials object has been used. Default is not to dismiss.- Parameters:
dismiss
- whether to dismiss data.- Since:
- 1.8.9
-
isDismissSensitiveDataUponUse
public boolean isDismissSensitiveDataUponUse()Returns whether this authenticaiton manager dismiss sensitive data once credentials object has been used. Default is not to dismiss.- Returns:
- Since:
- 1.8.9
-
acknowledgeAuthentication
public void acknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication) throws SVNException Description copied from interface:ISVNAuthenticationManager
Accepts the given authentication if it was successfully accepted by a repository server, or not if authentication failed. As a result the provided credential may be cached (authentication succeeded) or deleted from the cache (authentication failed).- Specified by:
acknowledgeAuthentication
in interfaceISVNAuthenticationManager
- Parameters:
accepted
- true if the credential was accepted by the server, otherwise falsekind
- a credential kind (ISVNAuthenticationManager.PASSWORD
orISVNAuthenticationManager.SSH
orISVNAuthenticationManager.USERNAME
)realm
- a repository authentication realmerrorMessage
- the reason of the authentication failureauthentication
- a user credential to accept/drop- Throws:
SVNException
-
acknowledgeTrustManager
public void acknowledgeTrustManager(javax.net.ssl.TrustManager manager) Description copied from interface:ISVNAuthenticationManager
Acknowledges the specified trust manager. This method is called only when a secure connection is successfully established with the specifiedmanager
.- Specified by:
acknowledgeTrustManager
in interfaceISVNAuthenticationManager
- Parameters:
manager
- trust manager to acknowledge (one returned byISVNAuthenticationManager.getTrustManager(SVNURL)
)
-
hasExplicitCredentials
private boolean hasExplicitCredentials(java.lang.String kind) -
setRuntimeStorage
Sets a specific runtime authentication storage manager. This storage manager will be asked by this auth manager for cached credentials as well as used to cache new ones accepted recently.- Parameters:
storage
- a custom auth storage manager
-
getRuntimeAuthStorage
-
getAuthenticationProvider
-
getDefaultSSHAuthentication
-
createDefaultAuthenticationProvider
protected ISVNAuthenticationProvider createDefaultAuthenticationProvider(java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase, boolean allowSave) -
createRuntimeAuthenticationProvider
-
createCacheAuthenticationProvider
protected ISVNAuthenticationProvider createCacheAuthenticationProvider(java.io.File authDir, java.lang.String userName) -
createAuthenticationStorageOptions
-
isAuthenticationForced
public boolean isAuthenticationForced()Description copied from interface:ISVNAuthenticationManager
Checks whether client should send authentication credentials to a repository server not waiting for the server's challenge.In some cases it may be necessary to send credentials beforehand, not waiting until the server asks to do it itself. To achieve such behaviour an implementor should return true from this routine.
- Specified by:
isAuthenticationForced
in interfaceISVNAuthenticationManager
- Returns:
- true if authentication credentials are forced to be sent;false when credentials are to be sent only in response to a server challenge
-
setAuthenticationForced
public void setAuthenticationForced(boolean forced) Specifies the way how credentials are to be supplied to a repository server.- Parameters:
forced
- true to force credentials sending; false to put off sending credentials till a server challenge- See Also:
-
getReadTimeout
Description copied from interface:ISVNAuthenticationManager
Returns the read timeout value in milliseconds whichrepository
should use in socket read operations. Socket read operations will block only for this amount of time.- Specified by:
getReadTimeout
in interfaceISVNAuthenticationManager
- Parameters:
repository
- a repository access driver- Returns:
- connection timeout value
-
getConnectTimeout
Description copied from interface:ISVNAuthenticationManager
Returns the connection timeout value in milliseconds whichrepository
should use in network connection operations.- Specified by:
getConnectTimeout
in interfaceISVNAuthenticationManager
- Parameters:
repository
- repository access object- Returns:
- connection timeout value in milliseconds which will be set to a socket
-
verifyHostKey
public void verifyHostKey(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey) throws SVNException - Specified by:
verifyHostKey
in interfaceISVNSSHHostVerifier
- Throws:
SVNException
-
equals
private static boolean equals(byte[] b1, byte[] b2) -
dismissSensitiveData
public void dismissSensitiveData()Dismiss cached sensitive data (e.g. password) Calling this method clears explicit and cached credentials stored in this authentication manager.- Since:
- 1.8.9
-
isSSLPassphrasePromtSupported
public boolean isSSLPassphrasePromtSupported()- Specified by:
isSSLPassphrasePromtSupported
in interfaceISVNSSLPasspharsePromptSupport
-
DefaultSVNAuthenticationManager(File, boolean, String, char[], File, char[])