1 /* 2 * Copyright (c) 2002-2014, Mairie de 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.business.user.authentication; 35 36 import fr.paris.lutece.portal.business.user.AdminUser; 37 38 import java.util.Collection; 39 40 import javax.security.auth.login.LoginException; 41 42 import javax.servlet.http.HttpServletRequest; 43 44 45 /** 46 * This Interface defines all methods required by an authentication service password is not valid 47 */ 48 public interface AdminAuthentication 49 { 50 /** 51 * Gets the Authentification service name 52 * @return The Service Name 53 */ 54 String getAuthServiceName( ); 55 56 /** 57 * Gets the Authentification type 58 * @param request The HTTP request 59 * @return The type of authentication 60 */ 61 String getAuthType( HttpServletRequest request ); 62 63 /** 64 * Checks the login 65 * 66 * @param strAccessCode The username 67 * @param strUserPassword The user's password 68 * @param request The HttpServletRequest 69 * @return The login 70 * @throws LoginException The Login Exception 71 */ 72 AdminUser login( final String strAccessCode, final String strUserPassword, HttpServletRequest request ) 73 throws LoginException; 74 75 /** 76 * logout the user 77 * @param user The user 78 */ 79 void logout( AdminUser user ); 80 81 /** 82 * This method create an anonymous user 83 * 84 * @return A AdminUser object corresponding to an anonymous user 85 */ 86 AdminUser getAnonymousUser( ); 87 88 /** 89 * Indicates that the user should be already authenticated by an external authentication service (ex : Web Server authentication). 90 * @return true if the authentication is external, false if the authentication is provided by the Lutece portal. 91 */ 92 boolean isExternalAuthentication( ); 93 94 /** 95 * Returns a Lutece user object if the user is already authenticated in the Http request. This method should return null if the user is not authenticated or if the authentication service is not 96 * based on Http authentication. 97 * @param request The HTTP request 98 * @return Returns A Lutece User 99 */ 100 AdminUser getHttpAuthenticatedUser( HttpServletRequest request ); 101 102 /** 103 * Returns the Login page URL of the Authentication Service 104 * @return The URL 105 */ 106 String getLoginPageUrl( ); 107 108 /** 109 * Returns the password modification page URL of the Authentication Service 110 * @return The URL 111 */ 112 String getChangePasswordPageUrl( ); 113 114 /** 115 * Returns the DoLogin URL of the Authentication Service 116 * @return The URL 117 */ 118 String getDoLoginUrl( ); 119 120 /** 121 * Returns the DoLogout URL of the Authentication Service 122 * @return The URL 123 */ 124 String getDoLogoutUrl( ); 125 126 /** 127 * Returns the new account page URL of the Authentication Service 128 * @return The URL 129 */ 130 String getNewAccountPageUrl( ); 131 132 /** 133 * Returns the view account page URL of the Authentication Service 134 * @return The URL 135 */ 136 String getViewAccountPageUrl( ); 137 138 /** 139 * Returns the lost password URL of the Authentication Service 140 * @return The URL 141 */ 142 String getLostPasswordPageUrl( ); 143 144 /** 145 * Returns the lost login URL of the Authentication Service 146 * @return The URL 147 */ 148 String getLostLoginPageUrl( ); 149 150 /** 151 * get the list of user to display a list for selection in the main user management page 152 * 153 * @param strLastName The last name 154 * @param strFirstName The first name 155 * @param strEmail The email 156 * @return the collection of available users 157 */ 158 Collection<AdminUser> getUserList( String strLastName, String strFirstName, String strEmail ); 159 160 /** 161 * Get user data 162 * @param strAccessCode The access code (login) 163 * @return The admin User 164 */ 165 AdminUser getUserPublicData( String strAccessCode ); 166 }