Replacing Spring Security framework with Apache Tomcat Valve for Web Security (UI...
[controller.git] / opendaylight / usermanager / src / main / java / org / opendaylight / controller / usermanager / IUserManager.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.usermanager;
11
12 import java.util.List;
13 import java.util.Map;
14 import java.util.Set;
15
16 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
17 import org.opendaylight.controller.sal.authorization.UserLevel;
18 import org.opendaylight.controller.sal.utils.Status;
19 import org.opendaylight.controller.usermanager.internal.AuthorizationConfig;
20 import org.opendaylight.controller.usermanager.internal.ServerConfig;
21 import org.opendaylight.controller.usermanager.internal.UserConfig;
22 import org.springframework.security.core.userdetails.UserDetailsService;
23 import org.springframework.security.web.context.SecurityContextRepository;
24
25 /**
26  * The Interface which describes the methods exposed by User Manager.
27  */
28 public interface IUserManager extends UserDetailsService {
29
30     /**
31      * Returns the list of roles associated to the passed user name
32      *
33      * @param userName
34      * @return the role associated to the user name
35      */
36     public List<String> getUserRoles(String userName);
37
38     /**
39      * Authenticate user with AAA server and return authentication and authorization info
40      *
41      * @param username  the username
42      * @param password  the password
43      * @return                  {@link org.opendaylight.controller.sal.authorization.AuthResultEnum authenticate result}
44      */
45     public AuthResultEnum authenticate(String username, String password);
46
47     /**
48      * Add/remove AAA server
49      *
50      * @param configObject      refer to {@link org.opendaylight.controller.usermanager.internal.ServerConfig ServerConfig}
51      * @return                          status code
52      */
53     public Status addAAAServer(ServerConfig configObject);
54
55     /**
56      * Remove AAA server
57      *
58      * @param configObject      refer to {@link org.opendaylight.controller.usermanager.internal.ServerConfig ServerConfig}
59      * @return                          status code
60      */
61     public Status removeAAAServer(ServerConfig configObject);
62
63     /**
64      * Add a local user
65      *
66      * @param configObject refer to {@link org.opendaylight.controller.usermanager.internal.UserConfig UserConfig}
67      * @return                          status code
68      */
69     public Status addLocalUser(UserConfig configObject);
70
71     /**
72      * Remove a local user
73      *
74      * @param configObject refer to {@link org.opendaylight.controller.usermanager.internal.UserConfig UserConfig}
75      * @return                          status code
76      */
77     public Status removeLocalUser(UserConfig configObject);
78     
79     /**
80      * Remove a local user
81      * 
82      * @param userName the user name
83      * @return the status of this action
84      */
85     public Status removeLocalUser(String userName);
86
87     /**
88      * Add the authorization information for a user that gets authenticated remotely
89      *
90      * @param AAAconf
91      * @return
92      */
93     public Status addAuthInfo(AuthorizationConfig AAAconf);
94
95     /**
96      * Remove the authorization information for a user that gets authenticated remotely
97      *
98      * @param AAAconf
99      * @return
100      */
101     public Status removeAuthInfo(AuthorizationConfig AAAconf);
102
103     /**
104      * Return the list of authorization resources
105      * @return
106      */
107     public List<AuthorizationConfig> getAuthorizationList();
108
109     /**
110      * Returns a list of AAA Providers.
111      * @return Set of provider names.
112      */
113     public Set<String> getAAAProviderNames();
114
115     /**
116      * Change the current password for a configured user
117      *
118      * @param user
119      * @param curPasssword
120      * @param newPassword
121      * @return
122      */
123     public Status changeLocalUserPassword(String user, String curPassword,
124             String newPassword);
125
126     /**
127      * Return a list of AAA servers currently configured
128      *
129      * @return list of {@link org.opendaylight.controller.usermanager.internal.ServerConfig ServerConfig}
130      */
131     public List<ServerConfig> getAAAServerList();
132
133     /**
134      * Return a list of local users
135      *
136      * @return list of {@link org.opendaylight.controller.usermanager.internal.UserConfig UserConfig}
137      */
138     public List<UserConfig> getLocalUserList();
139
140     /**
141      * Save the local users to local disk
142      *
143      * @return status code
144      */
145     public Status saveLocalUserList();
146
147     /**
148      * Save the AAA server configurations to local disk
149      *
150      * @return status code
151      */
152     public Status saveAAAServerList();
153
154     /**
155      * Save the Authorization configurations to local disk
156      *
157      * @return status code
158      */
159     public Status saveAuthorizationList();
160
161     /**
162      * Remove user profile when user logs out
163      *
164      * @param username  the user name
165      */
166     public void userLogout(String username);
167
168     /**
169      * Remove user profile when user times out
170      *
171      * @param username  the user name
172      */
173     public void userTimedOut(String username);
174
175     /**
176      * Get the list of users currently logged in
177      *
178      * @return the list of users along with their administrative roles
179      */
180     public Map<String, List<String>> getUserLoggedIn();
181
182     /**
183      * Get date and time user was successfully authenticated
184      *
185      * @param user
186      * @return Date in String format
187      */
188     public String getAccessDate(String user);
189
190     /**
191      * Returns the user level for the passed user name
192      * It check the roles assigned to this user and checks
193      * against the well known Controller user roles to
194      * determines the highest user level associated with
195      * the user
196      *
197      * @param userName the user name
198      * @return  the highest user level for this user
199      */
200     public UserLevel getUserLevel(String userName);
201
202     // For internal use. Place holder to move securityContext storage.
203     public SecurityContextRepository getSecurityContextRepo();
204
205     // Session manager to implement session mgmt across web-apps
206     public ISessionManager getSessionManager();
207     
208     
209     public String getPassword(String username);
210
211 }