Package fr.gouv.vitam.security.internal.client

# 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`

public class InternalSecurityClientRest extends DefaultClient implements InternalSecurityClient

- ## Field Summary

  ### Fields inherited from interface fr.gouv.vitam.common.client.BasicClient

  `STATUS_URL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InternalSecurityClientRest(VitamClientFactoryInterface<?> factory)`
  Constructor using given scheme (http)

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkIdentityExpiration()`
  `void`
  `checkPersonalCertificate(byte[] certificate, String permission)`
  Check certificate with a permission
  `void`
  `checkPersonalCertificateExpiration()`
  `void`
  `checkStatus()`
  Check the status from the service
  `void`
  `checkStatus(jakarta.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 certificate
  `void`
  `close()`
  Close the underneath http client
  `final void`
  `consumeAnyEntityAndClose(jakarta.ws.rs.core.Response response)`
  Helper when an error occurs on client usage side to consume response however
  `boolean`
  `contextIsUsed(String contextId)`
  Check if a context is used in certificates
  `Optional<IdentityModel>`
  `findIdentity(byte[] certificate)`
  Find Identity
  `jakarta.ws.rs.client.Client`
  `getChunkedClient()`
  `jakarta.ws.rs.client.Client`
  `getClient()`
  `VitamClientFactory<?>`
  `getClientFactory()`
  `String`
  `getResourcePath()`
  Get the resource path of the server.
  `String`
  `getServiceUrl()`
  Get the service URL
  `IsPersonalCertificateRequiredModel`
  `isPersonalCertificateRequiredByPermission(String permission)`
  Check if a personal certificate is required for this permission
  `jakarta.ws.rs.core.Response`
  `make(VitamRequestBuilder request)`
  `jakarta.ws.rs.core.Response`
  `makeSpecifyingUrl(VitamRequestBuilder request)`
  `static void`
  `staticConsumeAnyEntityAndClose(jakarta.ws.rs.core.Response response)`
  This method consume everything (in particular InputStream) and close the response.
  `String`
  `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

    public InternalSecurityClientRest(VitamClientFactoryInterface<?> factory)
    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 interface `InternalSecurityClient`
    Parameters:
      `certificate` -
    Returns:
      an Optional describing the IdentityModel, otherwise return an empty Optional.
    Throws:
      `VitamClientInternalException` - in case of client exception
      `InternalSecurityException` - in case of internal security exception

  - ### checkIdentityExpiration

    public void checkIdentityExpiration() throws VitamClientInternalException, InternalSecurityException
    Specified by:
      `checkIdentityExpiration` in interface `InternalSecurityClient`
    Throws:
      `VitamClientInternalException`
      `InternalSecurityException`

  - ### checkPersonalCertificateExpiration

    public void checkPersonalCertificateExpiration() throws VitamClientInternalException, InternalSecurityException
    Specified by:
      `checkPersonalCertificateExpiration` in interface `InternalSecurityClient`
    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 interface `InternalSecurityClient`
    Parameters:
      `contextId` -
    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 interface `InternalSecurityClient`
    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 interface `InternalSecurityClient`
    Parameters:
      `certificate` - the certificate to be checked
      `permission` - the permission to be checked
    Throws:
      `VitamClientInternalException`
      `InternalSecurityException`

  - ### staticConsumeAnyEntityAndClose

    public static void staticConsumeAnyEntityAndClose(jakarta.ws.rs.core.Response response)
    This method consume everything (in particular InputStream) and close the response.
    Parameters:
      `response` -

  - ### consumeAnyEntityAndClose

    public final void consumeAnyEntityAndClose(jakarta.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 interface `MockOrRestClient`
    Parameters:
      `response` -

  - ### checkStatus

    public void checkStatus() throws VitamApplicationServerException
    Description copied from interface: `MockOrRestClient`
    Check the status from the service
    Specified by:
      `checkStatus` in interface `MockOrRestClient`
    Throws:
      `VitamApplicationServerException` - if the Server is unavailable

  - ### checkStatus

    public void checkStatus(jakarta.ws.rs.core.MultivaluedHashMap<String,Object> headers) throws VitamApplicationServerException
    Description 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 interface `MockOrRestClient`
    Parameters:
      `headers` -
    Throws:
      `VitamApplicationServerException` - if the Server is unavailable

  - ### getResourcePath

    public String getResourcePath()
    Description copied from interface: `MockOrRestClient`
    Get the resource path of the server.
    Specified by:
      `getResourcePath` in interface `MockOrRestClient`
    Returns:
      the resource path as string

  - ### getServiceUrl

    public String getServiceUrl()
    Description copied from interface: `MockOrRestClient`
    Get the service URL
    Specified by:
      `getServiceUrl` in interface `MockOrRestClient`
    Returns:
      the service URL

  - ### close

    public void close()
    Description copied from interface: `MockOrRestClient`
    Close the underneath http client
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `MockOrRestClient`
    Specified by:
      `close` in interface `VitamAutoCloseable`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### makeSpecifyingUrl

    public jakarta.ws.rs.core.Response makeSpecifyingUrl(VitamRequestBuilder request) throws VitamClientInternalException
    Throws:
      `VitamClientInternalException`

  - ### make

    public jakarta.ws.rs.core.Response make(VitamRequestBuilder request) throws VitamClientInternalException
    Throws:
      `VitamClientInternalException`

  - ### getClientFactory

    public VitamClientFactory<?> getClientFactory()

  - ### getClient

    public jakarta.ws.rs.client.Client getClient()

  - ### getChunkedClient

    public jakarta.ws.rs.client.Client getChunkedClient()