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
- Author:
- TMate Software Ltd.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultSVNAuthenticationManager.DumbAuthenticationProvider
class
DefaultSVNAuthenticationManager.ExtendedHostOptions
class
DefaultSVNAuthenticationManager.ExtendedHostOptionsProvider
-
Field Summary
-
Fields inherited from interface org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
PASSWORD, SSH, SSL, USERNAME
-
-
Constructor Summary
Constructors Constructor Description DefaultSVNAuthenticationManager(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)
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.ISVNAuthenticationStorageOptions
createAuthenticationStorageOptions()
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
createRuntimeAuthenticationProvider()
void
dismissSensitiveData()
Dismiss cached sensitive data (e.g.protected ISVNAuthenticationProvider
getAuthenticationProvider()
ISVNAuthenticationStorageOptions
getAuthenticationStorageOptions()
java.util.Collection<java.lang.String>
getAuthTypes(SVNURL url)
protected java.io.File
getConfigDirectory()
int
getConnectTimeout(SVNRepository repository)
Returns the connection timeout value in milliseconds whichrepository
should use in network connection operations.DefaultSVNOptions
getDefaultOptions()
protected SVNSSHAuthentication
getDefaultSSHAuthentication(SVNURL url)
SVNAuthentication
getFirstAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url)
Retrieves the first user credential.ISVNHostOptionsProvider
getHostOptionsProvider()
SVNAuthentication
getNextAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url)
Retrieves the next user credential if the first try failed.ISVNProxyManager
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
getRuntimeAuthStorage()
javax.net.ssl.TrustManager
getTrustManager(SVNURL url)
Returns a manager which handles trust data for the specifiedurl
.boolean
isAuthenticationForced()
Checks whether client should send authentication credentials to a repository server not waiting for the server's challenge.boolean
isDismissSensitiveDataUponUse()
Returns whether this authenticaiton manager dismiss sensitive data once credentials object has been used.boolean
isSSLPassphrasePromtSupported()
void
setAuthenticationForced(boolean forced)
Specifies the way how credentials are to be supplied to a repository server.void
setAuthenticationProvider(ISVNAuthenticationProvider provider)
Sets a custom authentication provider that will provide user credentials for authentication.void
setAuthenticationStorageOptions(ISVNAuthenticationStorageOptions authOptions)
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
setRuntimeStorage(ISVNAuthenticationStorage storage)
Sets a specific runtime authentication storage manager.void
verifyHostKey(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey)
-
-
-
Constructor Detail
-
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 Detail
-
setInMemoryServersOptions
public void setInMemoryServersOptions(java.util.Map serversOptions)
-
setInMemoryConfigOptions
public void setInMemoryConfigOptions(java.util.Map configOptions)
-
getAuthenticationStorageOptions
public ISVNAuthenticationStorageOptions getAuthenticationStorageOptions()
-
setAuthenticationStorageOptions
public void setAuthenticationStorageOptions(ISVNAuthenticationStorageOptions authOptions)
-
setAuthenticationProvider
public void setAuthenticationProvider(ISVNAuthenticationProvider provider)
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
public DefaultSVNOptions getDefaultOptions()
-
getHostOptionsProvider
public ISVNHostOptionsProvider getHostOptionsProvider()
-
setHostOptionsProvider
protected void setHostOptionsProvider(ISVNHostOptionsProvider hostOptionsProvider)
-
getAuthTypes
public java.util.Collection<java.lang.String> getAuthTypes(SVNURL url)
-
getProxyManager
public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException
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
public javax.net.ssl.TrustManager getTrustManager(SVNURL url) throws SVNException
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)
)
-
setRuntimeStorage
public void setRuntimeStorage(ISVNAuthenticationStorage storage)
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
protected ISVNAuthenticationStorage getRuntimeAuthStorage()
-
getAuthenticationProvider
protected ISVNAuthenticationProvider getAuthenticationProvider()
-
getDefaultSSHAuthentication
protected SVNSSHAuthentication getDefaultSSHAuthentication(SVNURL url)
-
createDefaultAuthenticationProvider
protected ISVNAuthenticationProvider createDefaultAuthenticationProvider(java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase, boolean allowSave)
-
createRuntimeAuthenticationProvider
protected ISVNAuthenticationProvider createRuntimeAuthenticationProvider()
-
createCacheAuthenticationProvider
protected ISVNAuthenticationProvider createCacheAuthenticationProvider(java.io.File authDir, java.lang.String userName)
-
createAuthenticationStorageOptions
public ISVNAuthenticationStorageOptions 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:
isAuthenticationForced()
-
getReadTimeout
public int getReadTimeout(SVNRepository repository)
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
public int getConnectTimeout(SVNRepository repository)
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
-
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
-
-