2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.usermanager;
11 import java.util.List;
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;
22 * The Interface which describes the methods exposed by User Manager.
24 public interface IUserManager extends UserDetailsService {
27 * Returns the list of roles associated to the passed user name
30 * @return the role associated to the user name
32 public List<String> getUserRoles(String userName);
35 * Authenticate user with AAA server and return authentication and
42 * @return {@link org.opendaylight.controller.sal.authorization.AuthResultEnum}
43 * authentication result
45 public AuthResultEnum authenticate(String username, String password);
48 * Add/remove AAA server
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
56 public Status addAAAServer(ServerConfig configObject);
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
68 public Status removeAAAServer(ServerConfig configObject);
74 * {@link org.opendaylight.controller.usermanager.internal.UserConfig}
76 * @return refer to {@link org.opendaylight.controller.sal.utils.Status}
79 public Status addLocalUser(UserConfig configObject);
85 * {@link org.opendaylight.controller.usermanager.internal.UserConfig}
86 * The new User Configuration
87 * @return refer to {@link org.opendaylight.controller.sal.utils.Status}
90 public Status modifyLocalUser(UserConfig configObject);
96 * {@link org.opendaylight.controller.usermanager.internal.UserConfig}
98 * @return {@link org.opendaylight.controller.sal.utils.Status}
99 * status of this action
101 public Status removeLocalUser(UserConfig configObject);
104 * Remove a local user
108 * @return {@link org.opendaylight.controller.sal.utils.Status}
109 * status of this action
111 public Status removeLocalUser(String userName);
114 * Add the authorization information for a user that gets authenticated
118 * {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
119 * Authorization Resources
120 * @return {@link org.opendaylight.controller.sal.utils.Status}
121 * status of this action
123 public Status addAuthInfo(AuthorizationConfig AAAconf);
126 * Remove the authorization information for a user that gets authenticated
130 * {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
131 * Authorization Resource
132 * @return {@link org.opendaylight.controller.sal.utils.Status}
133 * status of this action
135 public Status removeAuthInfo(AuthorizationConfig AAAconf);
138 * Return the list of authorization resources
140 * @return {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
141 * List of Authorization Resource
143 public List<AuthorizationConfig> getAuthorizationList();
146 * Returns a list of AAA Providers.
148 * @return Set of provider names.
150 public Set<String> getAAAProviderNames();
153 * Change the current password for a locally configured user
157 * @param curPasssword
158 * the current password
161 * @return {@link org.opendaylight.controller.sal.utils.Status}
162 * status of this action
164 public Status changeLocalUserPassword(String user, String curPassword,
168 * Return a list of AAA servers currently configured
170 * @return {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
171 * List of ServerConfig
173 public List<ServerConfig> getAAAServerList();
176 * Return a list of local users
178 * @return {@link org.opendaylight.controller.usermanager.internal.UserConfig}
181 public List<UserConfig> getLocalUserList();
184 * Save the local users to disk
186 * @return {@link org.opendaylight.controller.sal.utils.Status}
187 * status of this action
189 public Status saveLocalUserList();
192 * Save the AAA server configurations to disk
194 * @return {@link org.opendaylight.controller.sal.utils.Status}
195 * status of this action
197 public Status saveAAAServerList();
200 * Save the Authorization configurations to disk
202 * @return {@link org.opendaylight.controller.sal.utils.Status}
205 public Status saveAuthorizationList();
208 * Remove user profile when user logs out
213 public void userLogout(String username);
216 * Remove user profile when user times out
221 public void userTimedOut(String username);
224 * Get the list of users currently logged in
226 * @return the list of users along with their administrative roles
228 public Map<String, List<String>> getUserLoggedIn();
231 * Get date and time user was successfully authenticated
234 * @return Date in String format
236 public String getAccessDate(String user);
239 * Returns the highest user level for the passed user name. It checks the roles
240 * assigned to this user and checks against the well known Controller user
241 * roles to determines the highest user level associated with the user
245 * @return {@link org.opendaylight.controller.sal.authorization.UserLevel}
246 * the highest user level for this user
248 public UserLevel getUserLevel(String userName);
251 * Returns the list of user level for the passed user name. It checks the roles
252 * assigned to this user and checks against the well known Controller user
253 * roles to determines the corresponding list of user level associated with the user
258 * the list of user level for this user
260 public List<UserLevel> getUserLevels(String userName);
263 * Returns the Security Context
265 * @returns {@link org.springframework.security.web.context.SecurityContextRepository}
268 public SecurityContextRepository getSecurityContextRepo();
271 * Returns the Session Manager Interface Handler
273 * @return {@link org.opendaylight.controller.usermanager.ISessionManager}
274 * session manager interface handler
276 public ISessionManager getSessionManager();
279 * Checks if the specified role belongs to any application. Usually an
280 * application will call this function when configuring a role, to check if
281 * that role is already being used by another application.
285 * @return true if the specified role belongs to any application or if the
286 * role is a well-known controller role, false otherwise.
288 public boolean isRoleInUse(String role);
291 * Returns the password for a given user
295 * @return password for the username
297 public String getPassword(String username);