Package fr.gouv.vitam.security.internal.rest.repository

# Class IdentityRepository

java.lang.Object
fr.gouv.vitam.security.internal.rest.repository.IdentityRepository

All Implemented Interfaces:
  `CertificateCRLCheckStateUpdater<IdentityModel>`, `CertificateRepository`

public class IdentityRepository extends Object implements CertificateRepository, CertificateCRLCheckStateUpdater<IdentityModel>
repository for identity certificate entities management in mongo.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CERTIFICATE_COLLECTION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdentityRepository(MongoDbAccess mongoDbAccess)`
  `IdentityRepository(MongoDbAccess mongoDbAccess, String collectionName)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contextIsUsed(String contextId)`
  Check if a context is used
  `void`
  `createIdentity(IdentityModel identityModel)`
  create a certificate with contextId and many information
  `List<IdentityModel>`
  `findAll()`
  `com.mongodb.client.FindIterable<org.bson.Document>`
  `findCertificate(String issuerDN, CertificateStatus certificateStatus)`
  return list of certificate filtered by issuerDN and certificateStatus
  `Optional<IdentityModel>`
  `findIdentity(String subjectDN, String serialNumber)`
  return certificate according to subjectDN and serilanumber
  `Class<IdentityModel>`
  `getEntityModelType()`
  `void`
  `linkContextToIdentity(String subjectDN, String contextId, String serialNumber)`
  `void`
  `updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus)`
  set state for a given list of certificates

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CERTIFICATE_COLLECTION

    public static final String CERTIFICATE_COLLECTION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### IdentityRepository

    public IdentityRepository(MongoDbAccess mongoDbAccess, String collectionName)

  - ### IdentityRepository

    public IdentityRepository(MongoDbAccess mongoDbAccess)

- ## Method Details

  - ### createIdentity

    public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException
    create a certificate with contextId and many information
    Parameters:
      `identityModel` -
    Throws:
      `InvalidParseOperationException`

  - ### findIdentity

    public Optional<IdentityModel> findIdentity(String subjectDN, String serialNumber) throws InvalidParseOperationException
    return certificate according to subjectDN and serilanumber
    Parameters:
      `subjectDN` -
      `serialNumber` -
    Returns:
    Throws:
      `InvalidParseOperationException`

  - ### findAll

    public List<IdentityModel> findAll() throws InvalidParseOperationException
    Specified by:
      `findAll` in interface `CertificateRepository`
    Throws:
      `InvalidParseOperationException`

  - ### linkContextToIdentity

    public void linkContextToIdentity(String subjectDN, String contextId, String serialNumber)
    Parameters:
      `subjectDN` -
      `contextId` -
      `serialNumber` -

  - ### contextIsUsed

    public boolean contextIsUsed(String contextId)
    Check if a context is used
    Parameters:
      `contextId` -
    Returns:
      true if the context is used by Identity

  - ### findCertificate

    public com.mongodb.client.FindIterable<org.bson.Document> findCertificate(String issuerDN, CertificateStatus certificateStatus)
    return list of certificate filtered by issuerDN and certificateStatus
    Specified by:
      `findCertificate` in interface `CertificateCRLCheckStateUpdater<IdentityModel>`
    Parameters:
      `issuerDN` -
      `certificateStatus` -
    Returns:
      list of identity certificate

  - ### updateCertificateState

    public void updateCertificateState(List<String> certificatesToUpdate, CertificateStatus certificateStatus)
    set state for a given list of certificates
    Specified by:
      `updateCertificateState` in interface `CertificateCRLCheckStateUpdater<IdentityModel>`
    Parameters:
      `certificatesToUpdate` -
      `certificateStatus` -

  - ### getEntityModelType

    public Class<IdentityModel> getEntityModelType()
    Specified by:
      `getEntityModelType` in interface `CertificateCRLCheckStateUpdater<IdentityModel>`
    Returns:
      certificate model class type