Class IdentityRepository
- java.lang.Object
-
- fr.gouv.vitam.security.internal.rest.repository.IdentityRepository
-
- All Implemented Interfaces:
CertificateCRLCheckStateUpdater<IdentityModel>
,CertificateRepository
public class IdentityRepository extends java.lang.Object implements CertificateRepository, CertificateCRLCheckStateUpdater<IdentityModel>
repository for identity certificate entities management in mongo.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CERTIFICATE_COLLECTION
-
Constructor Summary
Constructors Constructor Description IdentityRepository(MongoDbAccess mongoDbAccess)
IdentityRepository(MongoDbAccess mongoDbAccess, java.lang.String collectionName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contextIsUsed(java.lang.String contextId)
Check if a context is usedvoid
createIdentity(IdentityModel identityModel)
create a certificate with contextId and many informationjava.util.List<IdentityModel>
findAll()
com.mongodb.client.FindIterable<org.bson.Document>
findCertificate(java.lang.String issuerDN, CertificateStatus certificateStatus)
return list of certificate filtered by issuerDN and certificateStatusjava.util.Optional<IdentityModel>
findIdentity(java.lang.String subjectDN, java.lang.String serialNumber)
return certificate according to subjectDN and serilanumberjava.lang.Class<IdentityModel>
getEntityModelType()
void
linkContextToIdentity(java.lang.String subjectDN, java.lang.String contextId, java.lang.String serialNumber)
void
updateCertificateState(java.util.List<java.lang.String> certificatesToUpdate, CertificateStatus certificateStatus)
set state for a given list of certificates
-
-
-
Field Detail
-
CERTIFICATE_COLLECTION
public static final java.lang.String CERTIFICATE_COLLECTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IdentityRepository
public IdentityRepository(MongoDbAccess mongoDbAccess, java.lang.String collectionName)
-
IdentityRepository
public IdentityRepository(MongoDbAccess mongoDbAccess)
-
-
Method Detail
-
createIdentity
public void createIdentity(IdentityModel identityModel) throws InvalidParseOperationException
create a certificate with contextId and many information- Parameters:
identityModel
-- Throws:
InvalidParseOperationException
-
findIdentity
public java.util.Optional<IdentityModel> findIdentity(java.lang.String subjectDN, java.lang.String serialNumber) throws InvalidParseOperationException
return certificate according to subjectDN and serilanumber- Parameters:
subjectDN
-serialNumber
-- Returns:
- Throws:
InvalidParseOperationException
-
findAll
public java.util.List<IdentityModel> findAll() throws InvalidParseOperationException
- Specified by:
findAll
in interfaceCertificateRepository
- Throws:
InvalidParseOperationException
-
linkContextToIdentity
public void linkContextToIdentity(java.lang.String subjectDN, java.lang.String contextId, java.lang.String serialNumber)
- Parameters:
subjectDN
-contextId
-serialNumber
-
-
contextIsUsed
public boolean contextIsUsed(java.lang.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(java.lang.String issuerDN, CertificateStatus certificateStatus)
return list of certificate filtered by issuerDN and certificateStatus- Specified by:
findCertificate
in interfaceCertificateCRLCheckStateUpdater<IdentityModel>
- Returns:
- list of identity certificate
-
updateCertificateState
public void updateCertificateState(java.util.List<java.lang.String> certificatesToUpdate, CertificateStatus certificateStatus)
set state for a given list of certificates- Specified by:
updateCertificateState
in interfaceCertificateCRLCheckStateUpdater<IdentityModel>
-
getEntityModelType
public java.lang.Class<IdentityModel> getEntityModelType()
- Specified by:
getEntityModelType
in interfaceCertificateCRLCheckStateUpdater<IdentityModel>
- Returns:
- certificate model class type
-
-