Package org.tmatesoft.svn.core.auth
Class BasicAuthenticationManager
- java.lang.Object
-
- org.tmatesoft.svn.core.auth.BasicAuthenticationManager
-
- All Implemented Interfaces:
ISVNAuthenticationManager,ISVNProxyManager,ISVNProxyManagerEx,ISVNSSHHostVerifier
public class BasicAuthenticationManager extends java.lang.Object implements ISVNAuthenticationManager, ISVNProxyManagerEx, ISVNSSHHostVerifier
The BasicAuthenticationManager is a simple implementation of ISVNAuthenticationManager for storing and providing credentials without using auth providers. A basic manager simply keeps the user credentials provided. Also this manager may store a single proxy server options context (for HHTP requests to go through a particular proxy server).This manager does not use authentication providers (ISVNAuthenticationProvider) but only those credentials that was supplied to its constructor. Also this manager never caches credentials.
This manager is not used in SVNKit internals. You may use a default manager (how to get it read javadoc for
ISVNAuthenticationManager), this basic manager or implement your own one.- Since:
- 1.2
- Version:
- 1.3
- Author:
- TMate Software Ltd.
- See Also:
ISVNAuthenticationProvider
-
-
Field Summary
-
Fields inherited from interface org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
PASSWORD, SSH, SSL, USERNAME
-
-
Constructor Summary
Constructors Constructor Description BasicAuthenticationManager(java.lang.String userName, java.io.File keyFile, java.lang.String passphrase, int portNumber)Deprecated.UsenewInstance(String, File, char[], int)methodBasicAuthenticationManager(java.lang.String userName, java.lang.String password)Deprecated.UsenewInstance(String, char[])methodBasicAuthenticationManager(SVNAuthentication[] authentications)Creates an auth manager given user credentials to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidacknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication)Does nothing.static voidacknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication, SVNURL accessedURL, ISVNAuthenticationManager authManager)Utility method to acknowledge successful or failed authentication attemptvoidacknowledgeProxyContext(boolean accepted, SVNErrorMessage errorMessage)Does nothing.voidacknowledgeTrustManager(javax.net.ssl.TrustManager manager)Does nothing.voiddismissSensitiveData()Dismiss cached sensitive data (e.g. password) Calling this method clears and removes all credentials stored in this authentication manager.intgetConnectTimeout(SVNRepository repository)Returns connection timeout value.SVNAuthenticationgetFirstAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url)Returns the first user's authentication credentials.SVNAuthenticationgetNextAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url)Returns next user authentication credentials.java.lang.StringgetProxyHost()Returns the proxy host name.ISVNProxyManagergetProxyManager(SVNURL url)Returns itself as a proxy manager.java.lang.StringgetProxyPassword()Deprecated.char[]getProxyPasswordValue()Returns the password to authenticate against the proxy server.intgetProxyPort()Returns the proxy port number.java.lang.StringgetProxyUserName()Returns the proxy user name.intgetReadTimeout(SVNRepository repository)Returns connection timeout value.javax.net.ssl.TrustManagergetTrustManager(SVNURL url)Returns null.booleanisAuthenticationForced()Tells whether authentication should be tried despite not being challenged from the server yet.static BasicAuthenticationManagernewInstance(java.lang.String userName, char[] password)Creates an auth manager given a user credential - a username and password.static BasicAuthenticationManagernewInstance(java.lang.String userName, java.io.File keyFile, char[] passphrase, int portNumber)Creates an auth manager given a user credential - a username and an ssh private key.static BasicAuthenticationManagernewInstance(SVNAuthentication[] credentials)Creates an auth manager given user credentials to use.voidsetAuthenticationForced(boolean forced)Sets whether authentication should be forced or not.voidsetAuthenticationProvider(ISVNAuthenticationProvider provider)Does nothing.voidsetAuthentications(SVNAuthentication[] authentications)Sets the given user credentials to this manager.voidsetProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUserName, char[] proxyPassword)Sets a proxy server context to this manager.voidsetProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword)Deprecated.voidverifyHostKey(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey)
-
-
-
Constructor Detail
-
BasicAuthenticationManager
public BasicAuthenticationManager(java.lang.String userName, java.lang.String password)Deprecated.UsenewInstance(String, char[])methodCreates an auth manager given a user credential - a username and password.- Parameters:
userName- a usernamepassword- a password
-
BasicAuthenticationManager
public BasicAuthenticationManager(java.lang.String userName, java.io.File keyFile, java.lang.String passphrase, int portNumber)Deprecated.UsenewInstance(String, File, char[], int)methodCreates an auth manager given a user credential - a username and an ssh private key.- Parameters:
userName- a usernamekeyFile- a private key filepassphrase- a password to the private keyportNumber- a port number over which an ssh tunnel is established
-
BasicAuthenticationManager
public BasicAuthenticationManager(SVNAuthentication[] authentications)
Creates an auth manager given user credentials to use.- Parameters:
authentications- user credentials
-
-
Method Detail
-
newInstance
public static BasicAuthenticationManager newInstance(java.lang.String userName, char[] password)
Creates an auth manager given a user credential - a username and password.- Parameters:
userName- a usernamepassword- a password- Since:
- 1.8.9
-
newInstance
public static BasicAuthenticationManager newInstance(java.lang.String userName, java.io.File keyFile, char[] passphrase, int portNumber)
Creates an auth manager given a user credential - a username and an ssh private key.- Parameters:
userName- a usernamekeyFile- a private key filepassphrase- a password to the private keyportNumber- a port number over which an ssh tunnel is established- Since:
- 1.8.9
-
newInstance
public static BasicAuthenticationManager newInstance(SVNAuthentication[] credentials)
Creates an auth manager given user credentials to use.- Parameters:
credentials- user credentials- Since:
- 1.8.9
-
acknowledgeAuthentication
public static void acknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication, SVNURL accessedURL, ISVNAuthenticationManager authManager) throws SVNExceptionUtility method to acknowledge successful or failed authentication attempt- Throws:
SVNException
-
setAuthentications
public void setAuthentications(SVNAuthentication[] authentications)
Sets the given user credentials to this manager.- Parameters:
authentications- user credentials
-
setProxy
public void setProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUserName, java.lang.String proxyPassword)Deprecated.Sets a proxy server context to this manager.- Parameters:
proxyHost- a proxy server hostnameproxyPort- a proxy server portproxyUserName- a username to supply to a proxy machineproxyPassword- a password to supply to a proxy machine
-
setProxy
public void setProxy(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUserName, char[] proxyPassword)Sets a proxy server context to this manager.- Parameters:
proxyHost- a proxy server hostnameproxyPort- a proxy server portproxyUserName- a username to supply to a proxy machineproxyPassword- a password to supply to a proxy machine
-
getFirstAuthentication
public SVNAuthentication getFirstAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException
Returns the first user's authentication credentials.- Specified by:
getFirstAuthenticationin interfaceISVNAuthenticationManager- Parameters:
kind- credentials kind; valid kinds areISVNAuthenticationManager.SSH,ISVNAuthenticationManager.PASSWORD,ISVNAuthenticationManager.USERNAME,ISVNAuthenticationManager.SSL,ISVNAuthenticationManager.USERNAMErealm- authentication realmurl- repository url- Returns:
- first user's credentials
- Throws:
SVNException- exception withSVNErrorCode.RA_NOT_AUTHORIZEDerror code - in case of invalidkind
-
getNextAuthentication
public SVNAuthentication getNextAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException
Returns next user authentication credentials. This method is called whenever the first credentials returned bygetFirstAuthentication(String, String, SVNURL)failed to authenticate the user.- Specified by:
getNextAuthenticationin interfaceISVNAuthenticationManager- Parameters:
kind- credentials kind; valid kinds areISVNAuthenticationManager.SSH,ISVNAuthenticationManager.PASSWORD,ISVNAuthenticationManager.USERNAME,ISVNAuthenticationManager.SSL,ISVNAuthenticationManager.USERNAMErealm- authentication realmurl- repository url- Returns:
- next user's authentication credentials
- Throws:
SVNException- exception withSVNErrorCode.RA_NOT_AUTHORIZEDerror code - in case of invalidkind
-
setAuthenticationProvider
public void setAuthenticationProvider(ISVNAuthenticationProvider provider)
Does nothing.- Specified by:
setAuthenticationProviderin interfaceISVNAuthenticationManager- Parameters:
provider-
-
getProxyManager
public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException
Returns itself as a proxy manager.- 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
public javax.net.ssl.TrustManager getTrustManager(SVNURL url) throws SVNException
Returns null.- Specified by:
getTrustManagerin interfaceISVNAuthenticationManager- Parameters:
url- repository url- Returns:
- null
- Throws:
SVNException- Since:
- 1.2.0
-
acknowledgeAuthentication
public void acknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication)Does nothing.- Specified by:
acknowledgeAuthenticationin interfaceISVNAuthenticationManager- Parameters:
accepted-kind-realm-errorMessage-authentication-
-
acknowledgeTrustManager
public void acknowledgeTrustManager(javax.net.ssl.TrustManager manager)
Does nothing.- Specified by:
acknowledgeTrustManagerin interfaceISVNAuthenticationManager- Parameters:
manager-- Since:
- 1.2.0
-
isAuthenticationForced
public boolean isAuthenticationForced()
Tells whether authentication should be tried despite not being challenged from the server yet. By default the return value is always false until this behavior is changed via a call tosetAuthenticationForced(boolean).- Specified by:
isAuthenticationForcedin interfaceISVNAuthenticationManager- Returns:
- authentication force flag
-
setAuthenticationForced
public void setAuthenticationForced(boolean forced)
Sets whether authentication should be forced or not.- Parameters:
forced- authentication force flag- See Also:
isAuthenticationForced()
-
getProxyHost
public java.lang.String getProxyHost()
Returns the proxy host name.- Specified by:
getProxyHostin interfaceISVNProxyManager- Returns:
- the proxy host argument value specified via the
setProxy(String, int, String, String)method
-
getProxyPort
public int getProxyPort()
Returns the proxy port number.- Specified by:
getProxyPortin interfaceISVNProxyManager- Returns:
- the proxy port argument value specified via the
setProxy(String, int, String, String)method
-
getProxyUserName
public java.lang.String getProxyUserName()
Returns the proxy user name.- Specified by:
getProxyUserNamein interfaceISVNProxyManager- Returns:
- the proxy user name argument value specified via the
setProxy(String, int, String, String)method
-
getProxyPassword
public java.lang.String getProxyPassword()
Deprecated.Returns the password to authenticate against the proxy server.- Specified by:
getProxyPasswordin interfaceISVNProxyManager- Returns:
- the proxy password argument value specified via the
setProxy(String, int, String, String)method
-
getProxyPasswordValue
public char[] getProxyPasswordValue()
Returns the password to authenticate against the proxy server.- Specified by:
getProxyPasswordValuein interfaceISVNProxyManagerEx- Returns:
- the proxy password argument value specified via the
setProxy(String, int, String, String)method - Since:
- 1.8.9
-
acknowledgeProxyContext
public void acknowledgeProxyContext(boolean accepted, SVNErrorMessage errorMessage)Does nothing.- Specified by:
acknowledgeProxyContextin interfaceISVNProxyManager- Parameters:
accepted-errorMessage-
-
getReadTimeout
public int getReadTimeout(SVNRepository repository)
Returns connection timeout value. This implementation returns a read timeout value equal to 3600 seconds forhttporhttpsaccess operations. Ifrepositoryuses a different access protocol, the return value will be 0.- Specified by:
getReadTimeoutin interfaceISVNAuthenticationManager- Parameters:
repository- repository access object- Returns:
- read timeout value in milliseconds
- Since:
- 1.2.0
-
getConnectTimeout
public int getConnectTimeout(SVNRepository repository)
Returns connection timeout value. This implementation returns a connection timeout value equal to 60 seconds forhttporhttpsaccess operations. Ifrepositoryuses a different access protocol, the return value will be 0.- Specified by:
getConnectTimeoutin interfaceISVNAuthenticationManager- Parameters:
repository- repository access object- Returns:
- connection timeout value in milliseconds
- Since:
- 1.2.0
-
verifyHostKey
public void verifyHostKey(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey) throws SVNException- Specified by:
verifyHostKeyin interfaceISVNSSHHostVerifier- Throws:
SVNException
-
dismissSensitiveData
public void dismissSensitiveData()
Dismiss cached sensitive data (e.g. password) Calling this method clears and removes all credentials stored in this authentication manager.- Since:
- 1.8.9
-
-