1 /* 2 * Copyright (c) 2002-2024, 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.identitystore.v3.web.service; 35 36 import fr.paris.lutece.plugins.identitystore.v3.web.rs.IdentityRequestValidator; 37 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.RequestAuthor; 38 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractSearchResponse; 39 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest; 40 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeResponse; 41 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.exporting.IdentityExportRequest; 42 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.exporting.IdentityExportResponse; 43 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityHistoryGetResponse; 44 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityHistorySearchRequest; 45 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityHistorySearchResponse; 46 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeRequest; 47 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeResponse; 48 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchRequest; 49 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchResponse; 50 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.UpdatedIdentitySearchRequest; 51 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.UpdatedIdentitySearchResponse; 52 import fr.paris.lutece.plugins.identitystore.web.exception.IdentityNotFoundException; 53 import fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException; 54 import fr.paris.lutece.portal.service.util.AppException; 55 56 /** 57 * Interface for providing identity transport 58 */ 59 public interface IIdentityTransportProvider 60 { 61 /** 62 * get identity matching connectionId for provided application code 63 * 64 * @param strCustomerId 65 * customer Id 66 * @param strClientCode 67 * client code of calling application 68 * @param author 69 * author of the request 70 * @return identity if found 71 * @throws IdentityNotFoundException 72 * if no identity found for input parameters 73 * @throws AppException 74 * if inconsitent parmeters provided, or errors occurs... 75 * 76 */ 77 IdentitySearchResponse getIdentity( final String strCustomerId, final String strClientCode, final RequestAuthor author ) throws IdentityStoreException; 78 79 /** 80 * Creates an identity only if the identity does not already exist. The identity is created from the provided attributes. 81 * 82 * The order to test if the identity exists: 83 * 84 * - by using the provided customer id if present - by using the provided connection id if present 85 * 86 * 87 * @param identityChange 88 * change to apply to identity 89 * @param strClientCode 90 * client code of calling application 91 * @param author 92 * the author of the request 93 * @return the {@link IdentityChangeResponse} 94 * 95 * @throws AppException 96 * if error occurred while updating identity 97 * @throws IdentityNotFoundException 98 */ 99 IdentityChangeResponse createIdentity( final IdentityChangeRequest identityChange, final String strClientCode, final RequestAuthor author ) 100 throws IdentityStoreException; 101 102 /** 103 * Updates an identity. 104 * 105 * @param customerId 106 * customer Id 107 * @param identityChange 108 * change to apply to identity 109 * @param strClientCode 110 * client code of calling application 111 * @param author 112 * the author of the request 113 * @return the {@link IdentityChangeResponse} 114 * 115 * @throws AppException 116 * if error occurred while updating identity 117 * @throws IdentityNotFoundException 118 */ 119 IdentityChangeResponse updateIdentity( final String customerId, final IdentityChangeRequest identityChange, final String strClientCode, 120 final RequestAuthor author ) throws IdentityStoreException; 121 122 /** 123 * Deletes an identity from the specified connectionId 124 * 125 * @param strClientCode 126 * client code of calling application 127 * @param author 128 * the author of the request 129 * @return the {@code ResponseDto} object 130 * @throws IdentityNotFoundException 131 * if no identity found for input parameters 132 * @throws AppException 133 * if inconsistent parameters provided, or errors occurs... 134 */ 135 IdentityChangeResponse deleteIdentity( final String strCustomerId, final String strClientCode, final RequestAuthor author ) throws IdentityStoreException; 136 137 /** 138 * returns a list of identity from combination of attributes 139 * 140 * @param identitySearchRequest 141 * change to apply to identity 142 * @param strClientCode 143 * client code of calling application 144 * @param author 145 * the author of the request 146 * @return identity filled according to application rights for user identified by connection id 147 */ 148 IdentitySearchResponse searchIdentities( final IdentitySearchRequest identitySearchRequest, final String strClientCode, final RequestAuthor author ) 149 throws IdentityStoreException; 150 151 /** 152 * returns the active service contract for the given application code 153 * 154 * @deprecated Please use {@link IServiceContractTransportProvider} for requests regarding service contract. 155 * 156 * @param strClientCode 157 * client code of calling application 158 * @param author 159 * the author of the request 160 * @return the active service contract for the given application code 161 * @throws IdentityStoreException 162 */ 163 @Deprecated 164 ServiceContractSearchResponse getServiceContract( final String strClientCode, final RequestAuthor author ) throws IdentityStoreException; 165 166 /** 167 * import an identity to the id store 168 * 169 * @param identityChange 170 * change to apply to identity 171 * @param strClientCode 172 * client code of calling application 173 * @param author 174 * the author of the request 175 * @return identity filled according to application rights for user identified by connection id 176 */ 177 IdentityChangeResponse importIdentity( final IdentityChangeRequest identityChange, final String strClientCode, final RequestAuthor author ) 178 throws IdentityStoreException; 179 180 /** 181 * Merge two identities. 182 * 183 * @param identityMerge 184 * the request containing the master cuid, the secondary cuid, and a list of attribute to be taken from the secondary identity and put on the 185 * master identity. 186 * @param strClientCode 187 * client code of calling application 188 * @param author 189 * the author of the request 190 * @return IdentityMergeResponse 191 */ 192 IdentityMergeResponse mergeIdentities( final IdentityMergeRequest identityMerge, final String strClientCode, final RequestAuthor author ) 193 throws IdentityStoreException; 194 195 /** 196 * Unmerge two identities. 197 * 198 * @param identityMerge 199 * the request containing the master cuid, the secondary cuid 200 * @param strClientCode 201 * client code of calling application 202 * @param author 203 * the author of the request 204 * @return IdentityMergeResponse 205 */ 206 IdentityMergeResponse unMergeIdentities( final IdentityMergeRequest identityMerge, final String strClientCode, final RequestAuthor author ) 207 throws IdentityStoreException; 208 209 /** 210 * Gives the identity history (identity+attributes) from a customerID 211 * 212 * @param strCustomerId 213 * customerID 214 * @param strClientCode 215 * client code of calling application 216 * @param author 217 * the author of the request 218 * @return the history 219 */ 220 IdentityHistoryGetResponse getIdentityHistory( final String strCustomerId, final String strClientCode, final RequestAuthor author ) 221 throws IdentityStoreException; 222 223 /** 224 * Search for identities history according to given request 225 * 226 * @param request 227 * request 228 * @param strClientCode 229 * client code of calling application 230 * @param author 231 * the author of the request 232 * @return the history 233 */ 234 IdentityHistorySearchResponse searchIdentityHistory( final IdentityHistorySearchRequest request, final String strClientCode, final RequestAuthor author ) 235 throws IdentityStoreException; 236 237 /** 238 * get identities that have been updated, according to given request. 239 * 240 * @param request 241 * the request 242 * @param strClientCode 243 * client code of calling application 244 * @param author 245 * the author of the request 246 * @return the list of identities 247 */ 248 UpdatedIdentitySearchResponse getUpdatedIdentities( final UpdatedIdentitySearchRequest request, final String strClientCode, final RequestAuthor author ) 249 throws IdentityStoreException; 250 251 /** 252 * Dé-certification d'une identité.<br/> 253 * Une identité ne pouvant pas posséder d'attributs non-certifiés, une dé-certification implique la certification de ses attributs avec le processus défini 254 * par la property : <code>identitystore.identity.uncertify.processus</code> (par défaut : "dec", qui correspond au niveau le plus faible de certification 255 * (auto-déclaratif)) 256 * 257 * @param strCustomerId 258 * the customer ID 259 * @param strClientCode 260 * client code of calling application 261 * @param author 262 * the author of the request 263 * @return IdentityChangeResponse 264 */ 265 IdentityChangeResponse uncertifyIdentity( final String strCustomerId, final String strClientCode, final RequestAuthor author ) 266 throws IdentityStoreException; 267 268 /** 269 * Exports a list of identities according to the provided request and client code. 270 * 271 * @param request 272 * the export request 273 * @param strClientCode 274 * the client code 275 * @return IdentityExportResponse 276 */ 277 IdentityExportResponse exportIdentities( final IdentityExportRequest request, final String strClientCode, final RequestAuthor author ) 278 throws IdentityStoreException; 279 280 default void checkCommonHeaders( final String strClientCode, final RequestAuthor author ) throws IdentityStoreException 281 { 282 IdentityRequestValidator.instance( ).checkAuthor( author ); 283 IdentityRequestValidator.instance( ).checkClientCode( strClientCode ); 284 } 285 }