Table of Contents

Interface ICredHubClient

Namespace
Steeltoe.Security.DataProtection.CredHub
Assembly
Steeltoe.Security.DataProtection.CredHubBase.dll
public interface ICredHubClient

Methods

AddPermissionsAsync(string, List<CredentialPermission>)

Add permissions to an existing credential.

Task<List<CredentialPermission>> AddPermissionsAsync(string credentialName, List<CredentialPermission> permissions)

Parameters

credentialName string

The name of the credential; must not be null

permissions List<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

Task<RegeneratedCertificates> BulkRegenerateAsync(string certificateAuthority)

Parameters

certificateAuthority string

Name of certificate authority used to generate certificates that should be regenerated

Returns

Task<RegeneratedCertificates>

List of regenerated certificates

DeleteByNameAsync(string)

Delete a credential by its full name.

Task<bool> DeleteByNameAsync(string name)

Parameters

name string

the name of the credential; must not be null

Returns

Task<bool>

Boolean indicating success/failure

DeletePermissionAsync(string, string)

Delete a permission associated with a credential.

Task<bool> DeletePermissionAsync(string credentialName, string actor)

Parameters

credentialName string

the name of the credential; must not be null

actor string

the actor of the permission; must not be null

Returns

Task<bool>

Returns true if deleted, false if failed

FindByNameAsync(string)

Search for credentials with a full or partial name.

Task<List<FoundCredential>> FindByNameAsync(string name)

Parameters

name string

The name of the credential; must not be null

Returns

Task<List<FoundCredential>>

A summary of the credential search results

FindByPathAsync(string)

Find a credential using a path.

Task<List<FoundCredential>> FindByPathAsync(string path)

Parameters

path string

The path to the credential; must not be null

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.

Task<CredHubCredential<T>> GenerateAsync<T>(CredHubGenerateRequest requestParameters)

Parameters

requestParameters CredHubGenerateRequest

Parameters for the new credential to be generated in CredHub

Returns

Task<CredHubCredential<T>>

The details of the generated credential

Type Parameters

T

Type of CredHub credential to be generated

GetByIdAsync<T>(Guid)

Retrieve a credential using its ID, as returned in a write request.

Task<CredHubCredential<T>> GetByIdAsync<T>(Guid id)

Parameters

id Guid

ID of the credential; must not be null

Returns

Task<CredHubCredential<T>>

The details of the retrieved credential

Type Parameters

T

Type 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.

Task<CredHubCredential<T>> GetByNameAsync<T>(string name)

Parameters

name string

Name of the credential; must not be null

Returns

Task<CredHubCredential<T>>

The details of the retrieved credential

Type Parameters

T

Type 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.

Task<List<CredHubCredential<T>>> GetByNameWithHistoryAsync<T>(string name, int entries = 10)

Parameters

name string

Name of the credential; must not be null

entries int

Maximum number of entries to retrieve

Returns

Task<List<CredHubCredential<T>>>

The details of the retrieved credential

Type Parameters

T

Type of CredHub credential to be retrieved

GetPermissionsAsync(string)

Get the permissions associated with a credential.

Task<List<CredentialPermission>> GetPermissionsAsync(string credentialName)

Parameters

credentialName string

The name of the credential; must not be null

Returns

Task<List<CredentialPermission>>

List of permssions

InterpolateServiceDataAsync(string)

Search the provided data structure of bound service credentials, looking for references to CredHub credentials.

Task<string> InterpolateServiceDataAsync(string serviceData)

Parameters

serviceData string

a 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

Task<string>

the serviceData structure with CredHub references replaced by stored credential values

RegenerateAsync<T>(string)

Regenerate a credential in CredHub. Only credentials that were previously generated can be re-generated.

Task<CredHubCredential<T>> RegenerateAsync<T>(string name)

Parameters

name string

Name of the credential to regenerate

Returns

Task<CredHubCredential<T>>

Regenerated credential details

Type Parameters

T

Type of CredHub credential to be regenerated

WriteAsync<T>(CredentialSetRequest)

Write a new credential to CredHub, or overwrite an existing credential with a new value.

Task<CredHubCredential<T>> WriteAsync<T>(CredentialSetRequest credentialRequest)

Parameters

credentialRequest CredentialSetRequest

The credential to write to CredHub; must not be null

Returns

Task<CredHubCredential<T>>

Newly written credential

Type Parameters

T

Type of CredHub credential to be written