1 /*
2 * Copyright (c) 2002-2021, City of Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.plugins.mylutece.authentication;
35
36 import fr.paris.lutece.plugins.mylutece.web.MyLuteceApp;
37 import fr.paris.lutece.portal.service.security.LuteceAuthentication;
38 import fr.paris.lutece.portal.service.security.LuteceUser;
39
40 import java.util.Collection;
41
42 import javax.servlet.http.HttpServletRequest;
43
44 /**
45 *
46 * ExternalAuthentication.
47 */
48 public abstract class ExternalAuthentication extends AbstractAuthentication
49 {
50 private static final String CONSTANT_PATH_ICON = "images/local/skin/plugins/mylutece/mylutece.png";
51
52 /**
53 * Indicates that the user should be already authenticated by an external authentication service (ex : Web Server authentication).
54 *
55 * @return true if the authentication is external, false if the authentication is provided by the Lutece portal.
56 */
57 public boolean isExternalAuthentication( )
58 {
59 return true;
60 }
61
62 /**
63 *
64 * Always false
65 *
66 * @return false
67 */
68 public boolean isDelegatedAuthentication( )
69 {
70 return false;
71 }
72
73 /**
74 * Returns the Login page URL of the Authentication Service
75 *
76 * @return The URL
77 */
78 public String getLoginPageUrl( )
79 {
80 return null;
81 }
82
83 /**
84 * Returns the DoLogin URL of the Authentication Service
85 *
86 * @return The URL
87 */
88 public String getDoLoginUrl( )
89 {
90 return null;
91 }
92
93 /**
94 * Returns the DoLogout URL of the Authentication Service
95 *
96 * @return The URL
97 */
98 public String getDoLogoutUrl( )
99 {
100 return null;
101 }
102
103 /**
104 * Returns the new account page URL of the Authentication Service
105 *
106 * @return The URL
107 */
108 public String getNewAccountPageUrl( )
109 {
110 return null;
111 }
112
113 /**
114 * Returns the View account page URL of the Authentication Service
115 *
116 * @return The URL
117 */
118 public String getViewAccountPageUrl( )
119 {
120 return null;
121 }
122
123 /**
124 * Returns the lost password URL of the Authentication Service
125 *
126 * @return The URL
127 */
128 public String getLostPasswordPageUrl( )
129 {
130 return null;
131 }
132
133 /**
134 * {@inheritDoc}
135 */
136 @Override
137 public String getLostLoginPageUrl( )
138 {
139 return null;
140 }
141
142 /**
143 * Returns the access denied template
144 *
145 * @return The template
146 */
147 public String getAccessDeniedTemplate( )
148 {
149 return MyLuteceApp.getAccessDeniedTemplate( );
150 }
151
152 /**
153 * Returns the access controled template
154 *
155 * @return The template
156 */
157 public String getAccessControledTemplate( )
158 {
159 return MyLuteceApp.getAccessControledTemplate( );
160 }
161
162 /**
163 * Tells whether or not the authentication service can provide a list of all its users
164 *
165 * @return true if the service can return a users list
166 */
167 public boolean isUsersListAvailable( )
168 {
169 return false;
170 }
171
172 /**
173 * Returns all users managed by the authentication service if this feature is available.
174 *
175 * @return A collection of Lutece users or null if the service doesn't provide a users list
176 */
177 public Collection<LuteceUser> getUsers( )
178 {
179 return null;
180 }
181
182 /**
183 * Returns the user managed by the authentication service if this feature is available.
184 *
185 * @param userLogin
186 * user login
187 * @return A Lutece users or null if the service doesn't provide a user
188 */
189 public LuteceUser getUser( String userLogin )
190 {
191 return null;
192 }
193
194 /**
195 * get all roles for this user : - user's roles - user's groups roles
196 *
197 * @param user
198 * The user
199 * @return Array of roles
200 */
201 public String [ ] getRolesByUser( LuteceUser user )
202 {
203 return null;
204 }
205
206 /**
207 * Returns false
208 *
209 * @return false
210 * @see LuteceAuthentication#isMultiAuthenticationSupported()
211 *
212 */
213 public boolean isMultiAuthenticationSupported( )
214 {
215 return false;
216 }
217
218 /**
219 *
220 * {@inheritDoc}
221 */
222 public String getIconUrl( )
223 {
224 return CONSTANT_PATH_ICON;
225 }
226
227 /**
228 *
229 * {@inheritDoc}
230 */
231 @Override
232 public boolean findResetPassword( HttpServletRequest request, String strLogin )
233 {
234 return false;
235 }
236
237 /**
238 *
239 * {@inheritDoc}
240 */
241 @Override
242 public String getResetPasswordPageUrl( HttpServletRequest request )
243 {
244 return null;
245 }
246
247 /**
248 *
249 * {@inheritDoc}
250 */
251 @Override
252 public void updateDateLastLogin( LuteceUser user, HttpServletRequest request )
253 {
254 }
255 }