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.opendaylight.controller.usermanager.AuthorizationConfig;
19 import org.opendaylight.controller.usermanager.ServerConfig;
20 import org.opendaylight.controller.usermanager.UserConfig;
21 import org.springframework.security.core.userdetails.UserDetailsService;
22 import org.springframework.security.web.context.SecurityContextRepository;
25 * The Interface which describes the methods exposed by User Manager.
27 public interface IUserManager extends UserDetailsService {
30 * Returns the list of roles associated to the passed user name
33 * @return the role associated to the user name
35 public List<String> getUserRoles(String userName);
38 * Authenticate user with AAA server and return authentication and
45 * @return {@link org.opendaylight.controller.sal.authorization.AuthResultEnum}
46 * authentication result
48 public AuthResultEnum authenticate(String username, String password);
51 * Add/remove AAA server
54 * {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
55 * Server Configuration
56 * @return {@link org.opendaylight.controller.sal.utils.Status}
57 * status of this action
59 public Status addAAAServer(ServerConfig configObject);
66 * {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
67 * Server Configuration
68 * @return {@link org.opendaylight.controller.sal.utils.Status}
69 * status of this action
71 public Status removeAAAServer(ServerConfig configObject);
77 * {@link org.opendaylight.controller.usermanager.internal.UserConfig}
79 * @return refer to {@link org.opendaylight.controller.sal.utils.Status}
82 public Status addLocalUser(UserConfig configObject);
88 * {@link org.opendaylight.controller.usermanager.internal.UserConfig}
90 * @return {@link org.opendaylight.controller.sal.utils.Status}
91 * status of this action
93 public Status removeLocalUser(UserConfig configObject);
100 * @return {@link org.opendaylight.controller.sal.utils.Status}
101 * status of this action
103 public Status removeLocalUser(String userName);
106 * Add the authorization information for a user that gets authenticated
110 * {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
111 * Authorization Resources
112 * @return {@link org.opendaylight.controller.sal.utils.Status}
113 * status of this action
115 public Status addAuthInfo(AuthorizationConfig AAAconf);
118 * Remove the authorization information for a user that gets authenticated
122 * {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
123 * Authorization Resource
124 * @return {@link org.opendaylight.controller.sal.utils.Status}
125 * status of this action
127 public Status removeAuthInfo(AuthorizationConfig AAAconf);
130 * Return the list of authorization resources
132 * @return {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
133 * List of Authorization Resource
135 public List<AuthorizationConfig> getAuthorizationList();
138 * Returns a list of AAA Providers.
140 * @return Set of provider names.
142 public Set<String> getAAAProviderNames();
145 * Change the current password for a locally configured user
149 * @param curPasssword
150 * the current password
153 * @return {@link org.opendaylight.controller.sal.utils.Status}
154 * status of this action
156 public Status changeLocalUserPassword(String user, String curPassword,
160 * Return a list of AAA servers currently configured
162 * @return {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
163 * List of ServerConfig
165 public List<ServerConfig> getAAAServerList();
168 * Return a list of local users
170 * @return {@link org.opendaylight.controller.usermanager.internal.UserConfig}
173 public List<UserConfig> getLocalUserList();
176 * Save the local users to disk
178 * @return {@link org.opendaylight.controller.sal.utils.Status}
179 * status of this action
181 public Status saveLocalUserList();
184 * Save the AAA server configurations to disk
186 * @return {@link org.opendaylight.controller.sal.utils.Status}
187 * status of this action
189 public Status saveAAAServerList();
192 * Save the Authorization configurations to disk
194 * @return {@link org.opendaylight.controller.sal.utils.Status}
197 public Status saveAuthorizationList();
200 * Remove user profile when user logs out
205 public void userLogout(String username);
208 * Remove user profile when user times out
213 public void userTimedOut(String username);
216 * Get the list of users currently logged in
218 * @return the list of users along with their administrative roles
220 public Map<String, List<String>> getUserLoggedIn();
223 * Get date and time user was successfully authenticated
226 * @return Date in String format
228 public String getAccessDate(String user);
231 * Returns the highest user level for the passed user name. It checks the roles
232 * assigned to this user and checks against the well known Controller user
233 * roles to determines the highest user level associated with the user
237 * @return {@link org.opendaylight.controller.sal.authorization.UserLevel}
238 * the highest user level for this user
240 public UserLevel getUserLevel(String userName);
243 * Returns the list of user level for the passed user name. It checks the roles
244 * assigned to this user and checks against the well known Controller user
245 * roles to determines the corresponding list of user level associated with the user
250 * the list of user level for this user
252 public List<UserLevel> getUserLevels(String userName);
255 * Returns the Security Context
257 * @returns {@link org.springframework.security.web.context.SecurityContextRepository}
260 public SecurityContextRepository getSecurityContextRepo();
263 * Returns the Session Manager Interface Handler
265 * @return {@link org.opendaylight.controller.usermanager.ISessionManager}
266 * session manager interface handler
268 public ISessionManager getSessionManager();
271 * Checks if the specified role belongs to any application. Usually an
272 * application will call this function when configuring a role, to check if
273 * that role is already being used by another application.
277 * @return true if the specified role belongs to any application or if the
278 * role is a well-known controller role, false otherwise.
280 public boolean isRoleInUse(String role);
283 * Returns the password for a given user
287 * @return password for the username
289 public String getPassword(String username);