View Javadoc
1   /*
2    * Copyright (c) 2002-2017, 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.plugins.mylutece.modules.openiddatabase.authentication.business;
35  
36  import fr.paris.lutece.portal.service.plugin.Plugin;
37  
38  import java.util.Collection;
39  
40  
41  /**
42   *
43   * @author Etienne
44   */
45  public interface IOpenIdDatabaseUserDAO
46  {
47      /**
48       * Generates a new primary key
49       * @param plugin The Plugin using this data access service
50       * @return The new primary key
51       */
52      int newPrimaryKey( Plugin plugin );
53  
54      /**
55       * Insert a new record in the table.
56       *
57       * @param databaseUser The databaseUser object
58       * @param strPassword The user password
59       * @param plugin The Plugin using this data access service
60       */
61      void insert( OpenIdDatabaseUser databaseUser, String strPassword, Plugin plugin );
62  
63      /**
64       * Load the data of DatabaseUser from the table
65       *
66       * @param nDatabaseUserId The identifier of databaseUser
67       * @param plugin The Plugin using this data access service
68       * @return the instance of the DatabaseUser
69       */
70      OpenIdDatabaseUser load( int nDatabaseUserId, Plugin plugin );
71  
72      /**
73       * Delete a record from the table
74       * @param databaseUser The databaseUser object
75       * @param plugin The Plugin using this data access service
76       */
77      void delete( OpenIdDatabaseUser databaseUser, Plugin plugin );
78  
79      /**
80       * Update the record in the table
81       * @param databaseUser The reference of databaseUser
82       * @param plugin The Plugin using this data access service
83       */
84      void store( OpenIdDatabaseUser databaseUser, Plugin plugin );
85  
86      /**
87       * Update the record in the table
88       * @param databaseUser The reference of databaseUser
89       * @param plugin The Plugin using this data access service
90       */
91      void storeByLogin( OpenIdDatabaseUser databaseUser, Plugin plugin );
92  
93      /**
94       * Update the record in the table
95       * @param databaseUser The reference of databaseUser
96       * @param strNewPassword The new password to store
97       * @param plugin The Plugin using this data access service
98       */
99      void updatePassword( OpenIdDatabaseUser databaseUser, String strNewPassword, Plugin plugin );
100 
101     /**
102      * Load the password of the specified user
103      *
104      * @param nDatabaseUserId The Primary key of the databaseUser
105      * @param plugin The current plugin using this method
106      * @return String the user password
107      */
108     String selectPasswordByPrimaryKey( int nDatabaseUserId, Plugin plugin );
109 
110     /**
111      * Load the list of databaseUsers
112      * @param plugin The Plugin using this data access service
113      * @return The Collection of the databaseUsers
114      */
115     Collection<OpenIdDatabaseUser> selectDatabaseUserList( Plugin plugin );
116 
117     /**
118      * Load the list of DatabaseUsers for a login
119      * @param strLogin The login of DatabaseUser
120      * @param plugin The Plugin using this data access service
121      * @return The Collection of the DatabaseUsers
122      */
123     Collection<OpenIdDatabaseUser> selectDatabaseUserListForLogin( String strLogin, Plugin plugin );
124 
125     /**
126      * Load the list of a user by a email
127      * @param strEmail The email of DatabaseUser
128      * @param plugin The Plugin using this data access service
129      * @return The Collection of the DatabaseUsers
130      */
131     OpenIdDatabaseUser selectDatabaseUserByEmail( String strEmail, Plugin plugin );
132 
133     /**
134      * Check the password for a DatabaseUser
135      *
136      * @param strLogin The user login of DatabaseUser
137      * @param strPassword The password of DatabaseUser
138      * @param plugin The Plugin using this data access service
139      * @return true if password is ok
140      */
141     boolean checkPassword( String strLogin, String strPassword, Plugin plugin );
142 
143     /**
144      * Checks whether the login exists
145      *
146      * @param strLogin The user login of DatabaseUser
147      * @param plugin The Plugin using this data access service
148      * @return true if password is ok
149      */
150     boolean checkUserLogin( String strLogin, Plugin plugin );
151 }