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}
87 * @return {@link org.opendaylight.controller.sal.utils.Status}
88 * status of this action
90 public Status removeLocalUser(UserConfig configObject);
97 * @return {@link org.opendaylight.controller.sal.utils.Status}
98 * status of this action
100 public Status removeLocalUser(String userName);
103 * Add the authorization information for a user that gets authenticated
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
112 public Status addAuthInfo(AuthorizationConfig AAAconf);
115 * Remove the authorization information for a user that gets authenticated
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
124 public Status removeAuthInfo(AuthorizationConfig AAAconf);
127 * Return the list of authorization resources
129 * @return {@link org.opendaylight.controller.usermanager.internal.AuthorizationConfig}
130 * List of Authorization Resource
132 public List<AuthorizationConfig> getAuthorizationList();
135 * Returns a list of AAA Providers.
137 * @return Set of provider names.
139 public Set<String> getAAAProviderNames();
142 * Change the current password for a locally configured user
146 * @param curPasssword
147 * the current password
150 * @return {@link org.opendaylight.controller.sal.utils.Status}
151 * status of this action
153 public Status changeLocalUserPassword(String user, String curPassword,
157 * Return a list of AAA servers currently configured
159 * @return {@link org.opendaylight.controller.usermanager.internal.ServerConfig}
160 * List of ServerConfig
162 public List<ServerConfig> getAAAServerList();
165 * Return a list of local users
167 * @return {@link org.opendaylight.controller.usermanager.internal.UserConfig}
170 public List<UserConfig> getLocalUserList();
173 * Save the local users to disk
175 * @return {@link org.opendaylight.controller.sal.utils.Status}
176 * status of this action
178 public Status saveLocalUserList();
181 * Save the AAA server configurations to disk
183 * @return {@link org.opendaylight.controller.sal.utils.Status}
184 * status of this action
186 public Status saveAAAServerList();
189 * Save the Authorization configurations to disk
191 * @return {@link org.opendaylight.controller.sal.utils.Status}
194 public Status saveAuthorizationList();
197 * Remove user profile when user logs out
202 public void userLogout(String username);
205 * Remove user profile when user times out
210 public void userTimedOut(String username);
213 * Get the list of users currently logged in
215 * @return the list of users along with their administrative roles
217 public Map<String, List<String>> getUserLoggedIn();
220 * Get date and time user was successfully authenticated
223 * @return Date in String format
225 public String getAccessDate(String user);
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
234 * @return {@link org.opendaylight.controller.sal.authorization.UserLevel}
235 * the highest user level for this user
237 public UserLevel getUserLevel(String userName);
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
247 * the list of user level for this user
249 public List<UserLevel> getUserLevels(String userName);
252 * Returns the Security Context
254 * @returns {@link org.springframework.security.web.context.SecurityContextRepository}
257 public SecurityContextRepository getSecurityContextRepo();
260 * Returns the Session Manager Interface Handler
262 * @return {@link org.opendaylight.controller.usermanager.ISessionManager}
263 * session manager interface handler
265 public ISessionManager getSessionManager();
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.
274 * @return true if the specified role belongs to any application or if the
275 * role is a well-known controller role, false otherwise.
277 public boolean isRoleInUse(String role);
280 * Returns the password for a given user
284 * @return password for the username
286 public String getPassword(String username);