1 /**
2 This file is part of GoldenGate Project (named also GoldenGate or GG).
3
4 Copyright 2009, Frederic Bregier, and individual contributors by the @author
5 tags. See the COPYRIGHT.txt in the distribution for a full listing of
6 individual contributors.
7
8 All GoldenGate Project is free software: you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as published
10 by the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 GoldenGate is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GoldenGate . If not, see <http://www.gnu.org/licenses/>.
20 */
21 package goldengate.common.file;
22
23 import goldengate.common.command.NextCommandReply;
24 import goldengate.common.command.exception.Reply421Exception;
25 import goldengate.common.command.exception.Reply530Exception;
26
27 /**
28 * Interface for Authentication
29 *
30 * @author Frederic Bregier
31 *
32 */
33 public interface AuthInterface {
34 /**
35 *
36 * @return the Ftp SessionInterface
37 */
38 public SessionInterface getSession();
39
40 /**
41 * @param user
42 * the user to set
43 * @return (NOOP,230) if the user is OK, else return the following command
44 * that must follow (usually PASS) and the associated reply
45 * @throws Reply421Exception
46 * if there is a problem during the authentication
47 * @throws Reply530Exception
48 * if there is a problem during the authentication
49 */
50 public NextCommandReply setUser(String user) throws Reply421Exception,
51 Reply530Exception;
52
53 /**
54 * @return the user
55 */
56 public String getUser();
57
58 /**
59 * @param password
60 * the password to set
61 * @return (NOOP,230) if the Password is OK, else return the following
62 * command that must follow (usually ACCT) and the associated reply
63 * @throws Reply421Exception
64 * if there is a problem during the authentication
65 * @throws Reply530Exception
66 * if there is a problem during the authentication
67 */
68 public NextCommandReply setPassword(String password)
69 throws Reply421Exception, Reply530Exception;
70
71 /**
72 * Is the current Authentication OK for full identification. It must be true
73 * after a correct sequence of identification: At most, it is true when
74 * setAccount is OK. It could be positive before (user name only,
75 * user+password only).<br>
76 * In the current implementation, as USER+PASS+ACCT are needed, it will be
77 * true only after a correct ACCT.
78 *
79 * @return True if the user has a positive login, else False
80 */
81 public boolean isIdentified();
82
83 /**
84 *
85 * @return True if the current authentication has an admin right (shutdown,
86 * bandwidth limitation)
87 */
88 public abstract boolean isAdmin();
89
90 /**
91 * Is the given complete relative Path valid from Authentication/Business
92 * point of view.
93 *
94 * @param newPath
95 * @return True if it is Valid
96 */
97 public abstract boolean isBusinessPathValid(String newPath);
98
99 /**
100 * Return the relative path for this account according to the Business
101 * (without true root of mount).<br>
102 *
103 * @return Return the relative path for this account
104 */
105 public abstract String getBusinessPath();
106
107 /**
108 * Return the mount point
109 *
110 * @return the mount point
111 */
112 public abstract String getBaseDirectory();
113 /**
114 * Return the relative path from a file (without mount point)
115 *
116 * @param file
117 * (full path with mount point)
118 * @return the relative path from a file
119 */
120 public abstract String getRelativePath(String file);
121 /**
122 * Clean object
123 *
124 */
125 public void clear();
126 }