Clean all unused and redundant imports in controller.
[controller.git] / opendaylight / usermanager / api / src / main / java / org / opendaylight / controller / usermanager / IUserManager.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.usermanager;
10
11 import java.util.List;
12 import java.util.Map;
13 import java.util.Set;
14
15 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
16 import org.opendaylight.controller.sal.authorization.UserLevel;
17 import org.opendaylight.controller.sal.utils.Status;
18 import org.springframework.security.core.userdetails.UserDetailsService;
19 import org.springframework.security.web.context.SecurityContextRepository;
20
21 /**
22  * The Interface which describes the methods exposed by User Manager.
23  */
24 public interface IUserManager extends UserDetailsService {
25
26     /**
27      * Returns the list of roles associated to the passed user name
28      *
29      * @param userName
30      * @return the role associated to the user name
31      */
32     public List<String> getUserRoles(String userName);
33
34     /**
35      * Authenticate user with AAA server and return authentication and
36      * authorization info
37      *
38      * @param username
39      *            the username
40      * @param password
41      *            the password
42      * @return {@link org.opendaylight.controller.sal.authorization.AuthResultEnum}
43      *         authentication result
44      */
45     public AuthResultEnum authenticate(String username, String password);
46
47     /**
48      * Add/remove AAA server
49      *
50      * @param configObject
51      *            {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
52      *            Server Configuration
53      * @return {@link org.opendaylight.controller.sal.utils.Status}
54      *         status of this action
55      */
56     public Status addAAAServer(ServerConfig configObject);
57
58     /**
59      * Remove AAA server
60      *
61      * @param configObject
62      *            refer to
63      *            {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
64      *            Server Configuration
65      * @return {@link org.opendaylight.controller.sal.utils.Status}
66      *         status of this action
67      */
68     public Status removeAAAServer(ServerConfig configObject);
69
70     /**
71      * Add a local user
72      *
73      * @param configObject
74      *            {@link org.opendaylight.controller.usermanager.internal.UserConfig}
75      *            User Configuration
76      * @return refer to {@link org.opendaylight.controller.sal.utils.Status}
77      *         status code
78      */
79     public Status addLocalUser(UserConfig configObject);
80
81     /**
82      * Remove a local user
83      *
84      * @param configObject
85      *            {@link org.opendaylight.controller.usermanager.internal.UserConfig}
86      *            UserConfig
87      * @return {@link org.opendaylight.controller.sal.utils.Status}
88      *         status of this action
89      */
90     public Status removeLocalUser(UserConfig configObject);
91
92     /**
93      * Remove a local user
94      *
95      * @param userName
96      *            the user name
97      * @return {@link org.opendaylight.controller.sal.utils.Status}
98      *         status of this action
99      */
100     public Status removeLocalUser(String userName);
101
102     /**
103      * Add the authorization information for a user that gets authenticated
104      * remotely
105      *
106      * @param AAAconf
107      *            {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
108      *            Authorization Resources
109      * @return {@link org.opendaylight.controller.sal.utils.Status}
110      *         status of this action
111      */
112     public Status addAuthInfo(AuthorizationConfig AAAconf);
113
114     /**
115      * Remove the authorization information for a user that gets authenticated
116      * remotely
117      *
118      * @param AAAconf
119      *            {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
120      *            Authorization Resource
121      * @return {@link org.opendaylight.controller.sal.utils.Status}
122      *         status of this action
123      */
124     public Status removeAuthInfo(AuthorizationConfig AAAconf);
125
126     /**
127      * Return the list of authorization resources
128      *
129      * @return {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
130      *         List of Authorization Resource
131      */
132     public List<AuthorizationConfig> getAuthorizationList();
133
134     /**
135      * Returns a list of AAA Providers.
136      *
137      * @return Set of provider names.
138      */
139     public Set<String> getAAAProviderNames();
140
141     /**
142      * Change the current password for a locally configured user
143      *
144      * @param user
145      *            the username
146      * @param curPasssword
147      *            the current password
148      * @param newPassword
149      *            the new password
150      * @return {@link org.opendaylight.controller.sal.utils.Status}
151      *         status of this action
152      */
153     public Status changeLocalUserPassword(String user, String curPassword,
154             String newPassword);
155
156     /**
157      * Return a list of AAA servers currently configured
158      *
159      * @return {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
160      *         List of ServerConfig
161      */
162     public List<ServerConfig> getAAAServerList();
163
164     /**
165      * Return a list of local users
166      *
167      * @return {@link org.opendaylight.controller.usermanager.internal.UserConfig}
168      *         List of UserConfig
169      */
170     public List<UserConfig> getLocalUserList();
171
172     /**
173      * Save the local users to disk
174      *
175      * @return {@link org.opendaylight.controller.sal.utils.Status}
176      *         status of this action
177      */
178     public Status saveLocalUserList();
179
180     /**
181      * Save the AAA server configurations to disk
182      *
183      * @return {@link org.opendaylight.controller.sal.utils.Status}
184      *         status of this action
185      */
186     public Status saveAAAServerList();
187
188     /**
189      * Save the Authorization configurations to disk
190      *
191      * @return {@link org.opendaylight.controller.sal.utils.Status}
192      *         status code
193      */
194     public Status saveAuthorizationList();
195
196     /**
197      * Remove user profile when user logs out
198      *
199      * @param username
200      *            the user name
201      */
202     public void userLogout(String username);
203
204     /**
205      * Remove user profile when user times out
206      *
207      * @param username
208      *            the user name
209      */
210     public void userTimedOut(String username);
211
212     /**
213      * Get the list of users currently logged in
214      *
215      * @return the list of users along with their administrative roles
216      */
217     public Map<String, List<String>> getUserLoggedIn();
218
219     /**
220      * Get date and time user was successfully authenticated
221      *
222      * @param user
223      * @return Date in String format
224      */
225     public String getAccessDate(String user);
226
227     /**
228      * Returns the highest user level for the passed user name. It checks the roles
229      * assigned to this user and checks against the well known Controller user
230      * roles to determines the highest user level associated with the user
231      *
232      * @param userName
233      *            the user name
234      * @return {@link org.opendaylight.controller.sal.authorization.UserLevel}
235      *         the highest user level for this user
236      */
237     public UserLevel getUserLevel(String userName);
238
239     /**
240      * Returns the list of user level for the passed user name. It checks the roles
241      * assigned to this user and checks against the well known Controller user
242      * roles to determines the corresponding list of user level associated with the user
243      *
244      * @param userName
245      *            the user name
246      * @return
247      *          the list of user level for this user
248      */
249     public List<UserLevel> getUserLevels(String userName);
250
251     /**
252      * Returns the Security Context
253      *
254      * @returns {@link org.springframework.security.web.context.SecurityContextRepository}
255      *          Security Context
256      */
257     public SecurityContextRepository getSecurityContextRepo();
258
259     /**
260      * Returns the Session Manager Interface Handler
261      *
262      * @return {@link org.opendaylight.controller.usermanager.ISessionManager}
263      *         session manager interface handler
264      */
265     public ISessionManager getSessionManager();
266
267     /**
268      * Checks if the specified role belongs to any application. Usually an
269      * application will call this function when configuring a role, to check if
270      * that role is already being used by another application.
271      *
272      * @param role
273      *            The role to check
274      * @return true if the specified role belongs to any application or if the
275      *         role is a well-known controller role, false otherwise.
276      */
277     public boolean isRoleInUse(String role);
278
279     /* non-Javadoc
280      * Returns the password for a given user
281      *
282      * @param username
283      *            the user name
284      * @return password for the username
285      */
286     public String getPassword(String username);
287
288 }