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 classprotected classclassclassprivate static classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ISVNAuthenticationStorageOptionsprivate java.io.Fileprivate DefaultSVNOptionsprivate ISVNHostOptionsProviderprivate booleanprivate booleanprivate booleanprivate SVNAuthenticationprivate intprivate SVNAuthenticationprivate SVNErrorMessageprivate ISVNAuthenticationProvider[]private ISVNAuthenticationStorageFields 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 ofDefaultSVNAuthenticationManagerDefaultSVNAuthenticationManager(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 TypeMethodDescriptionvoidacknowledgeAuthentication(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.voidacknowledgeTrustManager(javax.net.ssl.TrustManager manager) Acknowledges the specified trust manager.protected ISVNAuthenticationProvidercreateCacheAuthenticationProvider(java.io.File authDir, java.lang.String userName) protected ISVNAuthenticationProvidercreateDefaultAuthenticationProvider(java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase, boolean allowSave) protected ISVNAuthenticationProvidervoidDismiss cached sensitive data (e.g.private static booleanequals(byte[] b1, byte[] b2) protected ISVNAuthenticationProviderjava.util.Collection<java.lang.String>getAuthTypes(SVNURL url) protected java.io.FileintgetConnectTimeout(SVNRepository repository) Returns the connection timeout value in milliseconds whichrepositoryshould use in network connection operations.protected SVNSSHAuthenticationgetFirstAuthentication(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.intgetReadTimeout(SVNRepository repository) Returns the read timeout value in milliseconds whichrepositoryshould use in socket read operations.protected ISVNAuthenticationStoragejavax.net.ssl.TrustManagergetTrustManager(SVNURL url) Returns a manager which handles trust data for the specifiedurl.private booleanhasExplicitCredentials(java.lang.String kind) booleanChecks whether client should send authentication credentials to a repository server not waiting for the server's challenge.booleanReturns whether this authenticaiton manager dismiss sensitive data once credentials object has been used.booleanvoidsetAuthenticationForced(boolean forced) Specifies the way how credentials are to be supplied to a repository server.voidSets a custom authentication provider that will provide user credentials for authentication.voidvoidsetDismissSensitiveDataUponUse(boolean dismiss) Control whether to dismiss credentials sensitive data once credentials object has been used.protected voidsetHostOptionsProvider(ISVNHostOptionsProvider hostOptionsProvider) voidsetInMemoryConfigOptions(java.util.Map configOptions) voidsetInMemoryServersOptions(java.util.Map serversOptions) voidSets a specific runtime authentication storage manager.voidverifyHostKey(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:ISVNAuthenticationManagerSets a custom authentication provider that will provide user credentials for authentication.- Specified by:
setAuthenticationProviderin interfaceISVNAuthenticationManager- Parameters:
provider- an authentication provider
-
getConfigDirectory
protected java.io.File getConfigDirectory() -
getDefaultOptions
-
getHostOptionsProvider
-
setHostOptionsProvider
-
getAuthTypes
-
getProxyManager
Description copied from interface:ISVNAuthenticationManagerReturns 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:
getProxyManagerin 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:ISVNAuthenticationManagerReturns a manager which handles trust data for the specifiedurl. Note: in pre-1.2.0 versionsISVNAuthenticationManagerused to provideISVNSSLManagervia a methodgetSSLManager()which is now replaced by this one.ISVNSSLManageris no longer used (replaced byTrustManager).- Specified by:
getTrustManagerin 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:ISVNAuthenticationManagerRetrieves 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
kindan implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:- Specified by:
getFirstAuthenticationin 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:ISVNAuthenticationManagerRetrieves 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
kindan implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:- Specified by:
getNextAuthenticationin 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:ISVNAuthenticationManagerAccepts 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:
acknowledgeAuthenticationin interfaceISVNAuthenticationManager- Parameters:
accepted- true if the credential was accepted by the server, otherwise falsekind- a credential kind (ISVNAuthenticationManager.PASSWORDorISVNAuthenticationManager.SSHorISVNAuthenticationManager.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:ISVNAuthenticationManagerAcknowledges the specified trust manager. This method is called only when a secure connection is successfully established with the specifiedmanager.- Specified by:
acknowledgeTrustManagerin 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:ISVNAuthenticationManagerChecks 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:
isAuthenticationForcedin 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:ISVNAuthenticationManagerReturns the read timeout value in milliseconds whichrepositoryshould use in socket read operations. Socket read operations will block only for this amount of time.- Specified by:
getReadTimeoutin interfaceISVNAuthenticationManager- Parameters:
repository- a repository access driver- Returns:
- connection timeout value
-
getConnectTimeout
Description copied from interface:ISVNAuthenticationManagerReturns the connection timeout value in milliseconds whichrepositoryshould use in network connection operations.- Specified by:
getConnectTimeoutin 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:
verifyHostKeyin 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:
isSSLPassphrasePromtSupportedin interfaceISVNSSLPasspharsePromptSupport
-
DefaultSVNAuthenticationManager(File, boolean, String, char[], File, char[])