Class IdentityAttributeValidator
- java.lang.Object
-
- fr.paris.lutece.plugins.identitystore.v3.web.request.validator.IdentityAttributeValidator
-
public class IdentityAttributeValidator extends java.lang.ObjectService class used to validate attribute values in requests
-
-
Constructor Summary
Constructors Constructor Description IdentityAttributeValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAttributeExistence(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity)Checks if the request identity contains valid attributes that exist in the referentialvoidcheckAttributeExistence(java.util.Collection<java.lang.String> attributeKeys)Checks if the request attribute keys correspond to valid attributes that exist in the referentialvoidcheckConnectedIdentityUpdate(java.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.AttributeDto> requestAttributes, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityToUpdate)Makes a bunch of checks regarding the validity of this update or merge request on this connected identity.static IdentityAttributeValidatorinstance()booleanvalidateAttribute(java.lang.String key, java.lang.String value)Validate if the given attribute value matches the regexp defined for the given attribute keyvoidvalidateIdentityAttributeValues(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity)Validates all attribute values stored in the provided identity, according to each attribute validation regex.voidvalidatePivotAttributesIntegrity(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityDto, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity, boolean geocodesCheck)Validates the integrity of pivot attributes stored in the provided identity.
If a pivot attribute is present and certified with a process with a greater or equal level to the defined process in configuration, then ALL the pivot attributes need to be present and certified with the same certification process.
If the birthcountry code attribute is set and doesn't correspond to FRANCE, then the birthplace code attribute is allowed to be missing.
If the above rules are not fullfiled, the response status is put to FAILURE.
-
-
-
Method Detail
-
instance
public static IdentityAttributeValidator instance()
-
validateAttribute
public boolean validateAttribute(java.lang.String key, java.lang.String value) throws fr.paris.lutece.plugins.identitystore.web.exception.ResourceNotFoundExceptionValidate if the given attribute value matches the regexp defined for the given attribute key- Parameters:
key-value-- Returns:
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ResourceNotFoundException
-
checkAttributeExistence
public void checkAttributeExistence(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity) throws fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatExceptionChecks if the request identity contains valid attributes that exist in the referential- Parameters:
identity- the identity- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatException
-
checkAttributeExistence
public void checkAttributeExistence(java.util.Collection<java.lang.String> attributeKeys) throws fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatExceptionChecks if the request attribute keys correspond to valid attributes that exist in the referential- Parameters:
attributeKeys- the attribute keys- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatException
-
validateIdentityAttributeValues
public void validateIdentityAttributeValues(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity) throws fr.paris.lutece.plugins.identitystore.web.exception.RequestContentFormattingExceptionValidates all attribute values stored in the provided identity, according to each attribute validation regex.- Parameters:
identity- the identity- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.RequestContentFormattingException
-
validatePivotAttributesIntegrity
public void validatePivotAttributesIntegrity(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityDto, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity, boolean geocodesCheck) throws fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatExceptionValidates the integrity of pivot attributes stored in the provided identity.
If a pivot attribute is present and certified with a process with a greater or equal level to the defined process in configuration, then ALL the pivot attributes need to be present and certified with the same certification process.
If the birthcountry code attribute is set and doesn't correspond to FRANCE, then the birthplace code attribute is allowed to be missing.
If the above rules are not fullfiled, the response status is put to FAILURE.- Parameters:
existingIdentityDto- the existing identity in case of update,nullotherwiseidentity- the identitygeocodesCheck- if checks geocode or not- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatException
-
checkConnectedIdentityUpdate
public void checkConnectedIdentityUpdate(java.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.AttributeDto> requestAttributes, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityToUpdate) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationExceptionMakes a bunch of checks regarding the validity of this update or merge request on this connected identity.- Authorise update on attributes in property only
- For new attributes, certification level must be > 100 (better than self-declare)
- For existing attributes, certification level must be >= than the existing level
- If one "PIVOT" attribute is certified at a certain level N (conf) :
- All "PIVOT" attributes must be set
- All "PIVOT" attributes must be certified with level greater or equal to N
- Parameters:
requestAttributes- the attributes in the update or merge requestexistingIdentityToUpdate- the existing identity- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
-