Package org.tmatesoft.svn.cli
Class SVNConsoleAuthenticationProvider
- java.lang.Object
-
- org.tmatesoft.svn.cli.SVNConsoleAuthenticationProvider
-
- All Implemented Interfaces:
ISVNAuthenticationProvider,ISVNAuthStoreHandler,ISVNGnomeKeyringPasswordProvider,ISVNSSLPasspharsePromptSupport
public class SVNConsoleAuthenticationProvider extends java.lang.Object implements ISVNAuthenticationProvider, ISVNSSLPasspharsePromptSupport, ISVNAuthStoreHandler, ISVNGnomeKeyringPasswordProvider
- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private static intMAX_PROMPT_COUNTprivate booleanmyIsTrustServerCertificateprivate java.util.Map<java.lang.String,java.lang.Integer>myRequestsCountprivate static java.lang.StringOUR_HOST_KEY_PROMPT_TEXTprivate static java.lang.StringOUR_PASSPHRASE_PROMPT_STRINGprivate static java.lang.StringOUR_PASSPHRASE_PROMPT_TEXTprivate static java.lang.StringOUR_PASSWORD_PROMPT_STRINGprivate static java.lang.StringOUR_PASSWORD_PROMPT_TEXTprivate java.util.EnumSet<SVNCertificateFailureKind>trustServerCertificateFailureKinds-
Fields inherited from interface org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider
ACCEPTED, ACCEPTED_TEMPORARY, REJECTED
-
-
Constructor Summary
Constructors Constructor Description SVNConsoleAuthenticationProvider(boolean trustServerCertificate)SVNConsoleAuthenticationProvider(java.util.EnumSet<SVNCertificateFailureKind> trustServerCertificateFailureKinds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intacceptServerAuthentication(SVNURL url, java.lang.String realm, java.lang.Object certificate, boolean resultMayBeStored)Checks a server authentication certificate and whether accepts it (if the client trusts it) or not.booleancanStorePlainTextPassphrases(java.lang.String realm, SVNAuthentication auth)booleancanStorePlainTextPasswords(java.lang.String realm, SVNAuthentication auth)char[]getKeyringPassword(java.lang.String keyringName)private booleanisPlainTextAllowed(java.lang.String realm, java.lang.String promptText, java.lang.String promptString)booleanisSSLPassphrasePromtSupported()private static voidprintRealm(java.lang.String realm)private static java.lang.Stringprompt(java.lang.String label)private static char[]promptPassword(java.lang.String label)private static java.lang.StringreadLine()SVNAuthenticationrequestClientAuthentication(java.lang.String kind, SVNURL url, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored)Returns a next user credential of the specified kind for the given authentication realm.
-
-
-
Field Detail
-
OUR_PASSPHRASE_PROMPT_TEXT
private static final java.lang.String OUR_PASSPHRASE_PROMPT_TEXT
- See Also:
- Constant Field Values
-
OUR_PASSWORD_PROMPT_TEXT
private static final java.lang.String OUR_PASSWORD_PROMPT_TEXT
- See Also:
- Constant Field Values
-
OUR_HOST_KEY_PROMPT_TEXT
private static final java.lang.String OUR_HOST_KEY_PROMPT_TEXT
- See Also:
- Constant Field Values
-
OUR_PASSWORD_PROMPT_STRING
private static final java.lang.String OUR_PASSWORD_PROMPT_STRING
- See Also:
- Constant Field Values
-
OUR_PASSPHRASE_PROMPT_STRING
private static final java.lang.String OUR_PASSPHRASE_PROMPT_STRING
- See Also:
- Constant Field Values
-
MAX_PROMPT_COUNT
private static final int MAX_PROMPT_COUNT
- See Also:
- Constant Field Values
-
myRequestsCount
private java.util.Map<java.lang.String,java.lang.Integer> myRequestsCount
-
myIsTrustServerCertificate
private final boolean myIsTrustServerCertificate
-
trustServerCertificateFailureKinds
private final java.util.EnumSet<SVNCertificateFailureKind> trustServerCertificateFailureKinds
-
-
Constructor Detail
-
SVNConsoleAuthenticationProvider
public SVNConsoleAuthenticationProvider(java.util.EnumSet<SVNCertificateFailureKind> trustServerCertificateFailureKinds)
-
SVNConsoleAuthenticationProvider
public SVNConsoleAuthenticationProvider(boolean trustServerCertificate)
-
-
Method Detail
-
acceptServerAuthentication
public int acceptServerAuthentication(SVNURL url, java.lang.String realm, java.lang.Object certificate, boolean resultMayBeStored)
Description copied from interface:ISVNAuthenticationProviderChecks a server authentication certificate and whether accepts it (if the client trusts it) or not.This method is used by an SSL manager (see
DefaultSVNSSLTrustManager).- Specified by:
acceptServerAuthenticationin interfaceISVNAuthenticationProvider- Parameters:
url- a repository location that is accessedrealm- a repository authentication realm (host, port, realm string)certificate- a server certificate objectresultMayBeStored- if true then the server certificate can be cached, otherwise not- Returns:
- the result of the certificate check (
ISVNAuthenticationProvider.REJECTED,ISVNAuthenticationProvider.ACCEPTED_TEMPORARY, orISVNAuthenticationProvider.ACCEPTED)
-
requestClientAuthentication
public SVNAuthentication requestClientAuthentication(java.lang.String kind, SVNURL url, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored)
Description copied from interface:ISVNAuthenticationProviderReturns a next user credential of the specified kind for the given authentication realm.If this provider has got more than one credentials (say, a list of credentials), to get the first one of them
previousAuthis set to null.- Specified by:
requestClientAuthenticationin interfaceISVNAuthenticationProvider- Parameters:
kind- a credential kind (for example, like those defined inISVNAuthenticationManager)url- a repository location that is to be accessedrealm- a repository authentication realm (host, port, realm string)errorMessage- the recent authentication failure error messagepreviousAuth- the credential that was previously retrieved (to tell if it's not accepted)authMayBeStored- if true then the returned credential can be cached, otherwise it won't be cached anyway- Returns:
- a next user credential
-
canStorePlainTextPasswords
public boolean canStorePlainTextPasswords(java.lang.String realm, SVNAuthentication auth) throws SVNException- Specified by:
canStorePlainTextPasswordsin interfaceISVNAuthStoreHandler- Throws:
SVNException
-
canStorePlainTextPassphrases
public boolean canStorePlainTextPassphrases(java.lang.String realm, SVNAuthentication auth) throws SVNException- Specified by:
canStorePlainTextPassphrasesin interfaceISVNAuthStoreHandler- Throws:
SVNException
-
isPlainTextAllowed
private boolean isPlainTextAllowed(java.lang.String realm, java.lang.String promptText, java.lang.String promptString)
-
printRealm
private static void printRealm(java.lang.String realm)
-
prompt
private static java.lang.String prompt(java.lang.String label)
-
promptPassword
private static char[] promptPassword(java.lang.String label)
-
readLine
private static java.lang.String readLine()
-
isSSLPassphrasePromtSupported
public boolean isSSLPassphrasePromtSupported()
- Specified by:
isSSLPassphrasePromtSupportedin interfaceISVNSSLPasspharsePromptSupport
-
getKeyringPassword
public char[] getKeyringPassword(java.lang.String keyringName) throws SVNException- Specified by:
getKeyringPasswordin interfaceISVNGnomeKeyringPasswordProvider- Throws:
SVNException
-
-