Class TokenCredentials
Token based credentials for use with a REST Service Client.
Inherited Members
Namespace: k8s.Authentication
Assembly: KubernetesClient.dll
Syntax
public class TokenCredentials : ServiceClientCredentials
Constructors
View SourceTokenCredentials(string)
Initializes a new instance of the TokenCredentials class with the given 'Bearer' token.
Declaration
public TokenCredentials(string token)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | Valid JSON Web Token (JWT). |
TokenCredentials(string, string)
Initializes a new instance of the TokenCredentials class with the given token and token type.
Declaration
public TokenCredentials(string token, string tokenType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | Valid JSON Web Token (JWT). |
| string | tokenType | The token type of the given token. |
TokenCredentials(ITokenProvider)
Initializes a new instance of the TokenCredentials class. Create an access token credentials object, given an interface to a token source.
Declaration
public TokenCredentials(ITokenProvider tokenProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| ITokenProvider | tokenProvider | The source of tokens for these credentials. |
TokenCredentials(ITokenProvider, string, string)
Initializes a new instance of the TokenCredentials class. Create an access token credentials object, given an interface to a token source.
Declaration
public TokenCredentials(ITokenProvider tokenProvider, string tenantId, string callerId)
Parameters
| Type | Name | Description |
|---|---|---|
| ITokenProvider | tokenProvider | The source of tokens for these credentials. |
| string | tenantId | Tenant ID from AuthenticationResult |
| string | callerId | UserInfo.DisplayableId field from AuthenticationResult |
Properties
View SourceCallerId
Gets UserInfo.DisplayableId
Declaration
public string CallerId { get; }
Property Value
| Type | Description |
|---|---|
| string |
TenantId
Gets Tenant ID
Declaration
public string TenantId { get; }
Property Value
| Type | Description |
|---|---|
| string |
TokenProvider
Gets secure token used to authenticate against Microsoft Azure API. No anonymous requests are allowed.
Declaration
protected ITokenProvider TokenProvider { get; }
Property Value
| Type | Description |
|---|---|
| ITokenProvider |
Methods
View SourceProcessHttpRequestAsync(HttpRequestMessage, CancellationToken)
Apply the credentials to the HTTP request.
Declaration
public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestMessage | request | The HTTP request. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | Task that will complete when processing has completed. |