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.-
Method Summary
Modifier and TypeMethodDescriptioncreateApiKey(String authorizedClientId, ApiKeyCreateRequest request, boolean validateClientAccessibility) Creates a new API key for the given client.voiddeleteApiKey(String authorizedClientId, String id, boolean validateClientAccessibility) Deletes an API key.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-facingreadAllByAuthorizedClientId(String, Pageable, Node, boolean).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.readByAuthorizedClientIdAndApiKeyId(String authorizedClientId, String id, boolean validateClientAccessibility) Retrieves a specific API key belonging to the specified client.readByHashedKey(String hashedKey) Finds an API key by its hashed value.updateApiKey(String authorizedClientId, String id, ApiKeyUpdateRequest request, boolean validateClientAccessibility) Updates an existing API key.
-
Method Details
-
readByHashedKey
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- theAuthorizedClient.getId()pageable- the pagination parametersfilters- additional filters used to restrict results. Cannot be null - useEmptyNodeif 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- theAuthorizedClient.getId()pageable- the pagination parametersfilters- additional filters used to restrict results. Cannot be null - useEmptyNodeif 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- theAuthorizedClient.getId()id- the API key IDvalidateClientAccessibility- 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- theAuthorizedClient.getId()request- the create request containing configurationvalidateClientAccessibility- 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- theAuthorizedClient.getId()id- the API key IDrequest- the update request containing the updated fieldsvalidateClientAccessibility- whether to perform authentication context and tenant checks- Returns:
- the updated API key
-
deleteApiKey
Deletes an API key.- Parameters:
authorizedClientId- theAuthorizedClient.getId()id- the API key IDvalidateClientAccessibility- whether to perform authentication context and tenant checks
-