Package org.springframework.credhub.core
Class CredHubTemplate
java.lang.Object
org.springframework.credhub.core.CredHubTemplate
- All Implemented Interfaces:
CredHubOperations
Implements the main interaction with CredHub.
- Author:
- Scott Frederick
-
Constructor Summary
ConstructorDescriptionCredHubTemplate
(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory) Create a newCredHubTemplate
using the provided connection properties andClientHttpRequestFactory
.CredHubTemplate
(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository, org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager clientManager) Create a newCredHubTemplate
using the provided connection properties,ClientHttpRequestFactory
, and OAuth2 support.CredHubTemplate
(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository, org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository authorizedClientRepository) Create a newCredHubTemplate
using the provided connection properties,ClientHttpRequestFactory
, and OAuth2 support.CredHubTemplate
(RestTemplate restTemplate) Create a newCredHubTemplate
using the providedRestTemplate
. -
Method Summary
Modifier and TypeMethodDescriptionGet the operations for retrieving, regenerating, and updating certificates.Get the operations for saving, retrieving, and deleting credentials.<T> T
doWithRest
(RestOperationsCallback<T> callback) Allow interaction with the configuredRestTemplate
not provided by other methods.info()
Get the operations for retrieving CredHub server information.Get the operations for interpolating service binding credentials.boolean
Get the operations for adding, retrieving, and deleting permissions from a credential.Get the operations for adding, retrieving, and deleting permissions from a credential.
-
Constructor Details
-
CredHubTemplate
Create a newCredHubTemplate
using the providedRestTemplate
. Intended for internal testing only.- Parameters:
restTemplate
- theRestTemplate
to use for interactions with CredHub
-
CredHubTemplate
public CredHubTemplate(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory) Create a newCredHubTemplate
using the provided connection properties andClientHttpRequestFactory
.- Parameters:
properties
- the CredHub connection properties; must not be nullclientHttpRequestFactory
- theClientHttpRequestFactory
to use when creating new connections
-
CredHubTemplate
public CredHubTemplate(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository, org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository authorizedClientRepository) Create a newCredHubTemplate
using the provided connection properties,ClientHttpRequestFactory
, and OAuth2 support.- Parameters:
properties
- the CredHub connection properties; must not be nullclientHttpRequestFactory
- theClientHttpRequestFactory
to use when creating new connectionsclientRegistrationRepository
- a repository of OAuth2 client registrationsauthorizedClientRepository
- a repository of authorized OAuth2 clients
-
CredHubTemplate
public CredHubTemplate(CredHubProperties properties, ClientHttpRequestFactory clientHttpRequestFactory, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository, org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager clientManager) Create a newCredHubTemplate
using the provided connection properties,ClientHttpRequestFactory
, and OAuth2 support.- Parameters:
properties
- the CredHub connection properties; must not be nullclientHttpRequestFactory
- theClientHttpRequestFactory
to use when creating new connectionsclientRegistrationRepository
- a repository of OAuth2 client registrationsclientManager
- an OAuth2 authorization client manager
-
-
Method Details
-
credentials
Get the operations for saving, retrieving, and deleting credentials.- Specified by:
credentials
in interfaceCredHubOperations
- Returns:
- the credentials operations
-
permissions
Get the operations for adding, retrieving, and deleting permissions from a credential.- Specified by:
permissions
in interfaceCredHubOperations
- Returns:
- the permissions operations
-
permissionsV2
Get the operations for adding, retrieving, and deleting permissions from a credential.- Specified by:
permissionsV2
in interfaceCredHubOperations
- Returns:
- the permissions operations
-
certificates
Get the operations for retrieving, regenerating, and updating certificates.- Specified by:
certificates
in interfaceCredHubOperations
- Returns:
- the certificates operations
-
interpolation
Get the operations for interpolating service binding credentials.- Specified by:
interpolation
in interfaceCredHubOperations
- Returns:
- the interpolation operations
-
info
Get the operations for retrieving CredHub server information.- Specified by:
info
in interfaceCredHubOperations
- Returns:
- the info operations
-
doWithRest
Allow interaction with the configuredRestTemplate
not provided by other methods.- Specified by:
doWithRest
in interfaceCredHubOperations
- Type Parameters:
T
- the credential implementation type- Parameters:
callback
- wrapper for the callback method- Returns:
- the return value from the callback method
-
isUsingOAuth2
public boolean isUsingOAuth2()
-