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

# Class IdentityService

java.lang.Object
fr.gouv.vitam.security.internal.rest.service.SecurityService
fr.gouv.vitam.security.internal.rest.service.IdentityService

public class IdentityService extends SecurityService
manage certificate.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdentityService(IdentityRepository identityRepository)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contextIsUsed(String contextId)`
  `void`
  `createIdentity(IdentityInsertModel identityInsertModel)`
  create certificate
  `List<IdentityModel>`
  `findAllIdentities()`
  `Optional<IdentityModel>`
  `findIdentity(byte[] certificate)`
  `CertificateRepository`
  `getRepository()`
  `Optional<IdentityModel>`
  `linkContextToIdentity(IdentityInsertModel identityInsertModel)`

  ### Methods inherited from class fr.gouv.vitam.security.internal.rest.service.SecurityService

  `checkCertificates`

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

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

- ## Constructor Details

  - ### IdentityService

    public IdentityService(IdentityRepository identityRepository)

- ## Method Details

  - ### createIdentity

    public void createIdentity(IdentityInsertModel identityInsertModel) throws CertificateException, InvalidParseOperationException
    create certificate
    Parameters:
      `identityInsertModel` - Identity certificate to insert
    Throws:
      `CertificateException` - thrown if certificate parse fail
      `InvalidParseOperationException` - thrown if insertion fail

  - ### linkContextToIdentity

    public Optional<IdentityModel> linkContextToIdentity(IdentityInsertModel identityInsertModel) throws CertificateException, InvalidParseOperationException
    Parameters:
      `identityInsertModel` - Identity certificate to insert
    Returns:
      the identity model if exists
    Throws:
      `CertificateException` - thrown if certificate parse fail
      `InvalidParseOperationException` - thrown retrieving identity fail

  - ### findIdentity

    public Optional<IdentityModel> findIdentity(byte[] certificate) throws CertificateException, InvalidParseOperationException
    Parameters:
      `certificate` - the certificate to find
    Returns:
      the identity model if exists
    Throws:
      `CertificateException` - thrown if certificate parse fail
      `InvalidParseOperationException` - thrown retrieving certificate fail

  - ### findAllIdentities

    public List<IdentityModel> findAllIdentities() throws InvalidParseOperationException
    Returns:
      list of identity models
    Throws:
      `InvalidParseOperationException` - thrown retrieving certificates fail

  - ### contextIsUsed

    public boolean contextIsUsed(String contextId)
    Parameters:
      `contextId` - the context Id
    Returns:
      true if the context is used by an identity

  - ### getRepository

    public CertificateRepository getRepository()