Show / Hide Table of Contents

Class TokenCredentials

Token based credentials for use with a REST Service Client.

Inheritance
object
ServiceClientCredentials
TokenCredentials
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: k8s.Authentication
Assembly: KubernetesClient.dll
Syntax
public class TokenCredentials : ServiceClientCredentials

Constructors

View Source

TokenCredentials(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).

View Source

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.

View Source

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.

View Source

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 Source

CallerId

Gets UserInfo.DisplayableId

Declaration
public string CallerId { get; }
Property Value
Type Description
string
View Source

TenantId

Gets Tenant ID

Declaration
public string TenantId { get; }
Property Value
Type Description
string
View Source

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 Source

ProcessHttpRequestAsync(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.

Overrides
ServiceClientCredentials.ProcessHttpRequestAsync(HttpRequestMessage, CancellationToken)
  • View Source
In this article
Back to top Generated by DocFX