View Javadoc
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.ctv.authentification;
35  
36  import java.util.Collection;
37  
38  import javax.security.auth.login.LoginException;
39  import javax.servlet.http.HttpServletRequest;
40  
41  import fr.paris.lutece.portal.service.security.LuteceAuthentication;
42  import fr.paris.lutece.portal.service.security.LuteceUser;
43  
44  /**
45   *
46   */
47  public class MokeLuteceAuthentication implements LuteceAuthentication
48  {
49      /** Creates a new instance of MokeLuteceAuthentication */
50      public MokeLuteceAuthentication( )
51      {
52      }
53  
54      @Override
55      public String getAuthServiceName( )
56      {
57          return "MOKE AUTHENTICATION SERVICE";
58      }
59  
60      @Override
61      public String getAuthType( HttpServletRequest request )
62      {
63          return "mock";
64      }
65  
66      @Override
67      public LuteceUser login( final String strUserName, final String strUserPassword, HttpServletRequest request ) throws LoginException
68      {
69          LuteceUser user = new MokeLuteceUser( strUserName, this );
70          user.setUserInfo( "EMAIL", request.getParameter( "email" ) );
71          user.setUserInfo( "LOGIN", strUserName );
72          return user;
73      }
74  
75      public void logout( LuteceUser user )
76      {
77      }
78  
79      @Override
80      public boolean findResetPassword( HttpServletRequest request, String strLogin )
81      {
82          return false;
83      }
84  
85      @Override
86      public LuteceUser getAnonymousUser( )
87      {
88          return null;
89      }
90  
91      public boolean isUserInRole( LuteceUser user, HttpServletRequest request, String strRole )
92      {
93          return true;
94      }
95  
96      public String [ ] getRolesByUser( LuteceUser user )
97      {
98          return null;
99      }
100 
101     @Override
102     public boolean isExternalAuthentication( )
103     {
104         return false;
105     }
106 
107     @Override
108     public LuteceUser getHttpAuthenticatedUser( HttpServletRequest request )
109     {
110         return null;
111     }
112 
113     @Override
114     public String getLoginPageUrl( )
115     {
116         return "jsp/site/plugins/ctv/auth/MockMyLuteceLogin.jsp";
117     }
118 
119     @Override
120     public String getDoLoginUrl( )
121     {
122         return "jsp/site/plugins/ctv/auth/MockMyLuteceLogin.jsp";
123     }
124 
125     @Override
126     public String getDoLogoutUrl( )
127     {
128         return "jsp/site/plugins/ctv/auth/DoMockMyLuteceLogout.jsp";
129     }
130 
131     @Override
132     public String getNewAccountPageUrl( )
133     {
134         return "";
135     }
136 
137     @Override
138     public String getViewAccountPageUrl( )
139     {
140         return "";
141     }
142 
143     @Override
144     public String getLostPasswordPageUrl( )
145     {
146         return null;
147     }
148 
149     @Override
150     public String getResetPasswordPageUrl( HttpServletRequest request )
151     {
152         return null;
153     }
154 
155     @Override
156     public String getAccessDeniedTemplate( )
157     {
158         return null;
159     }
160 
161     @Override
162     public String getAccessControledTemplate( )
163     {
164         return null;
165     }
166 
167     @Override
168     public boolean isUsersListAvailable( )
169     {
170         return false;
171     }
172 
173     @Override
174     public Collection<LuteceUser> getUsers( )
175     {
176         return null;
177     }
178 
179     @Override
180     public LuteceUser getUser( String strUserLogin )
181     {
182         return null;
183     }
184 
185     @Override
186     public boolean isDelegatedAuthentication( )
187     {
188         return false;
189     }
190 
191     @Override
192     public boolean isMultiAuthenticationSupported( )
193     {
194         return false;
195     }
196 
197     @Override
198     public String getIconUrl( )
199     {
200         return null;
201     }
202 
203     @Override
204     public String getName( )
205     {
206         return null;
207     }
208 
209     @Override
210     public String getPluginName( )
211     {
212         return null;
213     }
214 
215     public void updateDateLastLogin( LuteceUser user, HttpServletRequest request )
216     {
217     }
218 
219     @Override
220     public String getLostLoginPageUrl( )
221     {
222         return null;
223     }
224 }