Class IdentityAttributeValidator


  • public class IdentityAttributeValidator
    extends java.lang.Object
    Service class used to validate attribute values in requests
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkAttributeExistence​(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto identity)
      Checks if the request identity contains valid attributes that exist in the referential
      void checkAttributeExistence​(java.util.Collection<java.lang.String> attributeKeys)
      Checks if the request attribute keys correspond to valid attributes that exist in the referential
      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)
      Makes a bunch of checks regarding the validity of this update or merge request on this connected identity.
      static IdentityAttributeValidator instance()  
      boolean validateAttribute​(java.lang.String key, java.lang.String value)
      Validate if the given attribute value matches the regexp defined for the given attribute key
      void validateIdentityAttributeValues​(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.
      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)
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IdentityAttributeValidator

        public IdentityAttributeValidator()
    • Method Detail

      • validateAttribute

        public boolean validateAttribute​(java.lang.String key,
                                         java.lang.String value)
                                  throws fr.paris.lutece.plugins.identitystore.web.exception.ResourceNotFoundException
        Validate 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.RequestFormatException
        Checks 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.RequestFormatException
        Checks 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.RequestContentFormattingException
        Validates 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.RequestFormatException
        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.
        Parameters:
        existingIdentityDto - the existing identity in case of update, null otherwise
        identity - the identity
        geocodesCheck - 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.ClientAuthorizationException
        Makes 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 request
        existingIdentityToUpdate - the existing identity
        Throws:
        fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException