Interface CredentialHelper


  • public interface CredentialHelper
    Allows for performing various credential related operations which needs to be handled internally, not via the public API.

    This interface is intended for an internal use, as it performs all operations without any authorization. It should be used by the authentication related components as credential validators or authenticators.

    Author:
    K. Benedyczak
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​pl.edu.icm.unity.types.authn.CredentialDefinition> getCredentialDefinitions()
      Get credential definitions as map
      boolean isCredentialSet​(pl.edu.icm.unity.types.basic.EntityParam entity, java.lang.String credentialId)
      Check if credential is set
      void setCredential​(long entityId, java.lang.String credentialName, java.lang.String value, LocalCredentialVerificator handler)
      Updates the credential in DB.
      void updateCredential​(long entityId, java.lang.String credentialName, java.lang.String dbEncodedCredentialState)
      Updates the credential in DB.
    • Method Detail

      • updateCredential

        void updateCredential​(long entityId,
                              java.lang.String credentialName,
                              java.lang.String dbEncodedCredentialState)
                       throws pl.edu.icm.unity.exceptions.EngineException
        Updates the credential in DB. This feature is required to perform a sort of callback: credentials may need to update themselves in DB, e.g. to invalidate them in case when it is detected during login that the current password is not valid anymore.

        IMPORTANT: the last argument must be given in a database format, i.e. must be already result of processing by an appropriate credential handler. Therefore this method is useful to be called from a verificator itself.

        Parameters:
        entityId -
        credentialName -
        dbEncodedCredentialState -
        Throws:
        pl.edu.icm.unity.exceptions.EngineException
      • setCredential

        void setCredential​(long entityId,
                           java.lang.String credentialName,
                           java.lang.String value,
                           LocalCredentialVerificator handler)
                    throws pl.edu.icm.unity.exceptions.EngineException
        Updates the credential in DB. This is the same code as IdentitiesManagement#setEntityCredential(pl.edu.icm.unity.types.basic.EntityParam, String, String) but requires no authorization.
        Parameters:
        entityId -
        credentialName -
        value -
        Throws:
        pl.edu.icm.unity.exceptions.EngineException
      • isCredentialSet

        boolean isCredentialSet​(pl.edu.icm.unity.types.basic.EntityParam entity,
                                java.lang.String credentialId)
                         throws pl.edu.icm.unity.exceptions.EngineException
        Check if credential is set
        Parameters:
        entity -
        credentialId -
        Returns:
        Throws:
        pl.edu.icm.unity.exceptions.EngineException
      • getCredentialDefinitions

        java.util.Map<java.lang.String,​pl.edu.icm.unity.types.authn.CredentialDefinition> getCredentialDefinitions()
                                                                                                                  throws pl.edu.icm.unity.exceptions.EngineException
        Get credential definitions as map
        Returns:
        Throws:
        pl.edu.icm.unity.exceptions.EngineException