Class CredHubClient
- Namespace
- Steeltoe.Security.DataProtection.CredHub
- Assembly
- Steeltoe.Security.DataProtection.CredHubBase.dll
[Obsolete("This feature will be removed in the next major version. See https://steeltoe.io/docs/v3/obsolete for details.")]
public class CredHubClient : ICredHubClient
- Inheritance
-
CredHubClient
- Implements
- Inherited Members
Constructors
CredHubClient(bool)
public CredHubClient(bool validateCertificates = true)
Parameters
validateCertificatesbool
Methods
AddPermissionsAsync(string, List<CredentialPermission>)
Add permissions to an existing credential.
public Task<List<CredentialPermission>> AddPermissionsAsync(string name, List<CredentialPermission> permissions)
Parameters
namestringpermissionsList<CredentialPermission>A collection of permissions to add
Returns
- Task<List<CredentialPermission>>
List of permissions
BulkRegenerateAsync(string)
Regenerate all certificates generated by a given certificate authority
public Task<RegeneratedCertificates> BulkRegenerateAsync(string certificateAuthority)
Parameters
certificateAuthoritystringName of certificate authority used to generate certificates that should be regenerated
Returns
- Task<RegeneratedCertificates>
List of regenerated certificates
CreateUAAClientAsync(CredHubOptions, ILogger, HttpClient)
Initialize a CredHub Client with user credentials for the appropriate UAA server
public static Task<CredHubClient> CreateUAAClientAsync(CredHubOptions credHubOptions, ILogger logger = null, HttpClient httpClient = null)
Parameters
credHubOptionsCredHubOptionsCredHub client configuration values
loggerILoggerPass in a logger if you want logs
httpClientHttpClientPrimarily for tests, optionally provide your own http client
Returns
- Task<CredHubClient>
An initialized CredHub client (using UAA OAuth)
DeleteByNameAsync(string)
Delete a credential by its full name.
public Task<bool> DeleteByNameAsync(string name)
Parameters
Returns
DeleteByNameInternalAsync(string)
public Task<bool> DeleteByNameInternalAsync(string name)
Parameters
namestring
Returns
DeletePermissionAsync(string, string)
Delete a permission associated with a credential.
public Task<bool> DeletePermissionAsync(string name, string actor)
Parameters
Returns
FindByNameAsync(string)
Search for credentials with a full or partial name.
public Task<List<FoundCredential>> FindByNameAsync(string name)
Parameters
Returns
- Task<List<FoundCredential>>
A summary of the credential search results
FindByPathAsync(string)
Find a credential using a path.
public Task<List<FoundCredential>> FindByPathAsync(string path)
Parameters
Returns
- Task<List<FoundCredential>>
A summary of the credential search results
GenerateAsync<T>(CredHubGenerateRequest)
Generate a new credential in CredHub, or overwrite an existing credential with a new generated value.
public Task<CredHubCredential<T>> GenerateAsync<T>(CredHubGenerateRequest requestParameters)
Parameters
requestParametersCredHubGenerateRequestParameters for the new credential to be generated in CredHub
Returns
- Task<CredHubCredential<T>>
The details of the generated credential
Type Parameters
TType of CredHub credential to be generated
GetByIdAsync<T>(Guid)
Retrieve a credential using its ID, as returned in a write request.
public Task<CredHubCredential<T>> GetByIdAsync<T>(Guid id)
Parameters
Returns
- Task<CredHubCredential<T>>
The details of the retrieved credential
Type Parameters
TType of CredHub credential to be retrieved
GetByNameAsync<T>(string)
Retrieve a credential using its name, as passed to a write request. Only the current credential value will be returned.
public Task<CredHubCredential<T>> GetByNameAsync<T>(string name)
Parameters
Returns
- Task<CredHubCredential<T>>
The details of the retrieved credential
Type Parameters
TType of CredHub credential to be retrieved
GetByNameWithHistoryAsync<T>(string, int)
Retrieve a credential using its name, as passed to a write request. A collection of all stored values for the named credential will be returned, including historical values.
public Task<List<CredHubCredential<T>>> GetByNameWithHistoryAsync<T>(string name, int entries = 10)
Parameters
namestringName of the credential; must not be null
entriesintMaximum number of entries to retrieve
Returns
- Task<List<CredHubCredential<T>>>
The details of the retrieved credential
Type Parameters
TType of CredHub credential to be retrieved
GetPermissionsAsync(string)
Get the permissions associated with a credential.
public Task<List<CredentialPermission>> GetPermissionsAsync(string name)
Parameters
namestring
Returns
- Task<List<CredentialPermission>>
List of permssions
InterpolateServiceDataAsync(string)
Search the provided data structure of bound service credentials, looking for references to CredHub credentials.
public Task<string> InterpolateServiceDataAsync(string serviceData)
Parameters
serviceDatastringa data structure of bound service credentials, as would be parsed from the {@literal VCAP_SERVICES} environment variable provided to applications running on Cloud Foundry
Returns
RegenerateAsync<T>(string)
Regenerate a credential in CredHub. Only credentials that were previously generated can be re-generated.
public Task<CredHubCredential<T>> RegenerateAsync<T>(string name)
Parameters
namestringName of the credential to regenerate
Returns
- Task<CredHubCredential<T>>
Regenerated credential details
Type Parameters
TType of CredHub credential to be regenerated
WriteAsync<T>(CredentialSetRequest)
Write a new credential to CredHub, or overwrite an existing credential with a new value.
public Task<CredHubCredential<T>> WriteAsync<T>(CredentialSetRequest credentialRequest)
Parameters
credentialRequestCredentialSetRequestThe credential to write to CredHub; must not be null
Returns
- Task<CredHubCredential<T>>
Newly written credential
Type Parameters
TType of CredHub credential to be written