Class InternalSecurityClientRest
java.lang.Object
fr.gouv.vitam.common.client.DefaultClient
fr.gouv.vitam.security.internal.client.InternalSecurityClientRest
- All Implemented Interfaces:
BasicClient
,MockOrRestClient
,VitamAutoCloseable
,InternalSecurityClient
,AutoCloseable
-
Field Summary
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
Constructor Summary
ConstructorDescriptionConstructor using given scheme (http) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
checkPersonalCertificate
(byte[] certificate, String permission) Check certificate with a permissionvoid
void
Check the status from the servicevoid
checkStatus
(javax.ws.rs.core.MultivaluedHashMap<String, Object> headers) Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificatevoid
close()
Close the underneath http clientfinal void
consumeAnyEntityAndClose
(javax.ws.rs.core.Response response) Helper when an error occurs on client usage side to consume response howeverboolean
contextIsUsed
(String contextId) Check if a context is used in certificatesfindIdentity
(byte[] certificate) Find Identityjavax.ws.rs.client.Client
javax.ws.rs.client.Client
Get the resource path of the server.Get the service URLisPersonalCertificateRequiredByPermission
(String permission) Check if a personal certificate is required for this permissionjavax.ws.rs.core.Response
make
(VitamRequestBuilder request) javax.ws.rs.core.Response
makeSpecifyingUrl
(VitamRequestBuilder request) static void
staticConsumeAnyEntityAndClose
(javax.ws.rs.core.Response response) This method consume everything (in particular InputStream) and close the response.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface fr.gouv.vitam.common.client.MockOrRestClient
checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl
-
Constructor Details
-
InternalSecurityClientRest
Constructor using given scheme (http)- Parameters:
factory
- The client factory
-
-
Method Details
-
findIdentity
public Optional<IdentityModel> findIdentity(byte[] certificate) throws VitamClientInternalException, InternalSecurityException Description copied from interface:InternalSecurityClient
Find Identity- Specified by:
findIdentity
in interfaceInternalSecurityClient
- Returns:
- an Optional describing the IdentityModel, otherwise return an empty Optional.
- Throws:
VitamClientInternalException
- in case of client exceptionInternalSecurityException
- in case of internal security exception
-
checkIdentityExpiration
public void checkIdentityExpiration() throws VitamClientInternalException, InternalSecurityException- Specified by:
checkIdentityExpiration
in interfaceInternalSecurityClient
- Throws:
VitamClientInternalException
InternalSecurityException
-
checkPersonalCertificateExpiration
public void checkPersonalCertificateExpiration() throws VitamClientInternalException, InternalSecurityException- Specified by:
checkPersonalCertificateExpiration
in interfaceInternalSecurityClient
- Throws:
VitamClientInternalException
InternalSecurityException
-
contextIsUsed
public boolean contextIsUsed(String contextId) throws VitamClientInternalException, InternalSecurityException Description copied from interface:InternalSecurityClient
Check if a context is used in certificates- Specified by:
contextIsUsed
in interfaceInternalSecurityClient
- Returns:
- true if the context is used by an identity.
- Throws:
VitamClientInternalException
InternalSecurityException
-
isPersonalCertificateRequiredByPermission
public IsPersonalCertificateRequiredModel isPersonalCertificateRequiredByPermission(String permission) throws VitamClientInternalException, InternalSecurityException Description copied from interface:InternalSecurityClient
Check if a personal certificate is required for this permission- Specified by:
isPersonalCertificateRequiredByPermission
in interfaceInternalSecurityClient
- Parameters:
permission
- the permission to be checkd- Returns:
- IsPersonalCertificateRequiredModel
- Throws:
VitamClientInternalException
InternalSecurityException
-
checkPersonalCertificate
public void checkPersonalCertificate(byte[] certificate, String permission) throws VitamClientInternalException, InternalSecurityException Description copied from interface:InternalSecurityClient
Check certificate with a permission- Specified by:
checkPersonalCertificate
in interfaceInternalSecurityClient
- Parameters:
certificate
- the certificate to be checkedpermission
- the permission to be checked- Throws:
VitamClientInternalException
InternalSecurityException
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response) This method consume everything (in particular InputStream) and close the response.- Parameters:
response
-
-
consumeAnyEntityAndClose
public final void consumeAnyEntityAndClose(javax.ws.rs.core.Response response) Description copied from interface:MockOrRestClient
Helper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClose
in interfaceMockOrRestClient
-
checkStatus
Description copied from interface:MockOrRestClient
Check the status from the service- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
checkStatus
public void checkStatus(javax.ws.rs.core.MultivaluedHashMap<String, Object> headers) throws VitamApplicationServerExceptionDescription copied from interface:MockOrRestClient
Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
getResourcePath
Description copied from interface:MockOrRestClient
Get the resource path of the server.- Specified by:
getResourcePath
in interfaceMockOrRestClient
- Returns:
- the resource path as string
-
getServiceUrl
Description copied from interface:MockOrRestClient
Get the service URL- Specified by:
getServiceUrl
in interfaceMockOrRestClient
- Returns:
- the service URL
-
close
public void close()Description copied from interface:MockOrRestClient
Close the underneath http client- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
-
makeSpecifyingUrl
public javax.ws.rs.core.Response makeSpecifyingUrl(VitamRequestBuilder request) throws VitamClientInternalException - Throws:
VitamClientInternalException
-
make
public javax.ws.rs.core.Response make(VitamRequestBuilder request) throws VitamClientInternalException - Throws:
VitamClientInternalException
-
getClientFactory
-
getClient
public javax.ws.rs.client.Client getClient() -
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-