View Javadoc
1   /*
2    * Copyright (c) 2002-2025, 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.portal.service.security;
35  
36  import java.util.Arrays;
37  import java.util.Collection;
38  
39  import javax.security.auth.login.FailedLoginException;
40  import javax.security.auth.login.LoginException;
41  
42  import javax.servlet.http.HttpServletRequest;
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      public String getAuthServiceName( )
55      {
56          return "MOKE AUTHENTICATION SERVICE";
57      }
58  
59      public String getAuthType( HttpServletRequest request )
60      {
61          return null;
62      }
63  
64      public LuteceUser login( final String strUserName, final String strUserPassword, HttpServletRequest request ) throws LoginException
65      {
66          if ( "admin".equals( strUserName ) && "adminadmin".equals( strUserPassword ) )
67          {
68              return new MokeLuteceUser( strUserName, this );
69          }
70          else
71          {
72              throw new FailedLoginException( );
73          }
74      }
75  
76      public void logout( LuteceUser user )
77      {
78      }
79  
80      public boolean findResetPassword( HttpServletRequest request, String strLogin )
81      {
82          return false;
83      }
84  
85      public LuteceUser getAnonymousUser( )
86      {
87          return null;
88      }
89  
90      public boolean isUserInRole( LuteceUser user, HttpServletRequest request, String strRole )
91      {
92          return Arrays.asList( user.getRoles( ) ).contains( strRole );
93      }
94  
95      public String [ ] getRolesByUser( LuteceUser user )
96      {
97          return null;
98      }
99  
100     public boolean isExternalAuthentication( )
101     {
102         return false;
103     }
104 
105     public LuteceUser getHttpAuthenticatedUser( HttpServletRequest request )
106     {
107         return null;
108     }
109 
110     public String getLoginPageUrl( )
111     {
112         return null;
113     }
114 
115     public String getDoLoginUrl( )
116     {
117         return null;
118     }
119 
120     public String getDoLogoutUrl( )
121     {
122         return null;
123     }
124 
125     public String getNewAccountPageUrl( )
126     {
127         return null;
128     }
129 
130     public String getViewAccountPageUrl( )
131     {
132         return null;
133     }
134 
135     public String getLostPasswordPageUrl( )
136     {
137         return null;
138     }
139 
140     public String getResetPasswordPageUrl( HttpServletRequest request )
141     {
142         return null;
143     }
144 
145     public String getAccessDeniedTemplate( )
146     {
147         return null;
148     }
149 
150     public String getAccessControledTemplate( )
151     {
152         return null;
153     }
154 
155     public boolean isUsersListAvailable( )
156     {
157         return false;
158     }
159 
160     public Collection<LuteceUser> getUsers( )
161     {
162         return null;
163     }
164 
165     public LuteceUser getUser( String strUserLogin )
166     {
167         return null;
168     }
169 
170     public boolean isDelegatedAuthentication( )
171     {
172         return false;
173     }
174 
175     public boolean isMultiAuthenticationSupported( )
176     {
177         return false;
178     }
179 
180     public String getIconUrl( )
181     {
182         return null;
183     }
184 
185     public String getName( )
186     {
187         return null;
188     }
189 
190     public String getPluginName( )
191     {
192         return null;
193     }
194 
195     public void updateDateLastLogin( LuteceUser user, HttpServletRequest request )
196     {
197     }
198 
199     @Override
200     public String getLostLoginPageUrl( )
201     {
202         return null;
203     }
204 }