01: /*
02: * ====================================================================
03: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
04: *
05: * This software is licensed as described in the file COPYING, which
06: * you should have received as part of this distribution. The terms
07: * are also available at http://svnkit.com/license.html
08: * If newer versions of this license are posted there, you may use a
09: * newer version instead, at your option.
10: * ====================================================================
11: */
12: package org.tmatesoft.svn.core.auth;
13:
14: /**
15: * The <b>SVNAuthentication</b> is the base class that represents user
16: * credentials. <b>SVNAuthentication</b> provides only a username. Other
17: * kinds of user credentials extend this base class and add their own specific
18: * information.
19: *
20: * <p>
21: * User credentials used by <b>SVNRepository</b> drivers to authenticate
22: * a user to a repository server, are provided to those drivers by
23: * <b>ISVNAuthenticationManager</b> implementations.
24: *
25: * @version 1.1.1
26: * @author TMate Software Ltd.
27: * @see SVNPasswordAuthentication
28: * @see SVNSSHAuthentication
29: * @see ISVNAuthenticationManager
30: * @see org.tmatesoft.svn.core.io.SVNRepository
31: */
32: public class SVNAuthentication {
33:
34: private String myUserName;
35: private boolean myIsStorageAllowed;
36: private String myKind;
37:
38: /**
39: * Creates a username user credential object given a username.
40: *
41: * @param kind a credential kind
42: * @param userName a repository account username
43: * @param storageAllowed if <span class="javakeyword">true</span> then
44: * this credential is allowed to be stored in the
45: * global auth cache, otherwise not
46: */
47: public SVNAuthentication(String kind, String userName,
48: boolean storageAllowed) {
49: myUserName = userName;
50: myIsStorageAllowed = storageAllowed;
51: myKind = kind;
52: }
53:
54: /**
55: * Reurns the username.
56: *
57: * @return a repository account username
58: */
59: public String getUserName() {
60: return myUserName;
61: }
62:
63: /**
64: * Says if this credential may be cached in the global auth cache.
65: *
66: * @return <span class="javakeyword">true</span> if this credential
67: * may be stored, <span class="javakeyword">false</span> if may not
68: */
69: public boolean isStorageAllowed() {
70: return myIsStorageAllowed;
71: }
72:
73: /**
74: * Returns a credential kind for which this authentication
75: * credential is used.
76: *
77: * @return a credential kind
78: */
79: public String getKind() {
80: return myKind;
81: }
82:
83: }
|