Interface ApiKeyService<P extends ApiKey>

Type Parameters:
P - The API key domain type
All Known Implementing Classes:
DefaultApiKeyService

public interface ApiKeyService<P extends ApiKey>
Service interface for managing ApiKey entities.
See Also:
  • Method Details

    • readByHashedKey

      Optional<P> readByHashedKey(String hashedKey)
      Finds an API key by its hashed value.
      Parameters:
      hashedKey - the hashed key
      Returns:
      an Optional containing the API key if found, or empty otherwise
    • readAllByAuthorizedClientId

      org.springframework.data.domain.Page<P> readAllByAuthorizedClientId(String authorizedClientId, org.springframework.data.domain.Pageable pageable, cz.jirutka.rsql.parser.ast.Node filters, boolean validateClientAccessibility)
      Retrieves all API keys belonging to the specified client.
      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      pageable - the pagination parameters
      filters - additional filters used to restrict results. Cannot be null - use EmptyNode if no additional filters should be applied.
      validateClientAccessibility - whether to perform authentication context and tenant checks
      Returns:
      a page of API keys
    • internalReadAllByAuthorizedClientId

      org.springframework.data.domain.Page<P> internalReadAllByAuthorizedClientId(String authorizedClientId, org.springframework.data.domain.Pageable pageable, cz.jirutka.rsql.parser.ast.Node filters)

      This method is intended for internal system usage in trusted flows, and bypasses the standard client existence/accessibility validations from the external-facing readAllByAuthorizedClientId(String, Pageable, Node, boolean).

      Retrieves all API keys belonging to the specified client.

      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      pageable - the pagination parameters
      filters - additional filters used to restrict results. Cannot be null - use EmptyNode if no additional filters should be applied.
      Returns:
      a page of API keys
    • readByAuthorizedClientIdAndApiKeyId

      P readByAuthorizedClientIdAndApiKeyId(String authorizedClientId, String id, boolean validateClientAccessibility)
      Retrieves a specific API key belonging to the specified client.
      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      id - the API key ID
      validateClientAccessibility - whether to perform authentication context and tenant checks
      Returns:
      the API key
    • createApiKey

      ApiKeyCreateResponse createApiKey(String authorizedClientId, ApiKeyCreateRequest request, boolean validateClientAccessibility)
      Creates a new API key for the given client.
      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      request - the create request containing configuration
      validateClientAccessibility - whether to perform authentication context and tenant checks
      Returns:
      the create response containing the one-time plaintext key
    • updateApiKey

      P updateApiKey(String authorizedClientId, String id, ApiKeyUpdateRequest request, boolean validateClientAccessibility)
      Updates an existing API key.
      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      id - the API key ID
      request - the update request containing the updated fields
      validateClientAccessibility - whether to perform authentication context and tenant checks
      Returns:
      the updated API key
    • deleteApiKey

      void deleteApiKey(String authorizedClientId, String id, boolean validateClientAccessibility)
      Deletes an API key.
      Parameters:
      authorizedClientId - the AuthorizedClient.getId()
      id - the API key ID
      validateClientAccessibility - whether to perform authentication context and tenant checks