Table of Contents

Class AuthToken

Namespace
DxFeed.Graal.Net.Auth
Assembly
DxFeed.Graal.Net.dll

The AuthToken class represents an authorization token and encapsulates information about the authorization scheme and its associated value.

An AuthToken consists of the following components:
  • Scheme - The authorization scheme (e.g., "Basic" or "Bearer").
  • Value - The encoded value, which is scheme-dependent (e.g., an access token per RFC6750 or Base64-encoded "user:password" per RFC2617).
  • String representation - A string that combines the scheme and value in the format: [scheme + " " + value].
public class AuthToken
Inheritance
AuthToken
Inherited Members

Fields

BasicScheme

The Basic Authentication Scheme.

public const string BasicScheme = "Basic"

Field Value

string

BearerScheme

The Bearer Authentication (token authentication) Scheme.

public const string BearerScheme = "Bearer"

Field Value

string

Properties

HttpAuthorization

Gets the HTTP authorization header value.

public string HttpAuthorization { get; }

Property Value

string

Password

Gets the password or null if it is not known or applicable.

public string? Password { get; }

Property Value

string

Scheme

Gets the authentication scheme.

public string Scheme { get; }

Property Value

string

User

Gets the username or null if it is not known or applicable.

public string? User { get; }

Property Value

string

Value

Gets the access token for RFC6750 or the Base64-encoded "username:password" for RFC2617.

public string Value { get; }

Property Value

string

Methods

CreateBasicToken(string)

Constructs an AuthToken with the specified username and password per RFC2617. Username and password can be empty.

public static AuthToken CreateBasicToken(string userPassword)

Parameters

userPassword string

The string containing the username and password in the format username:password.

Returns

AuthToken

The constructed AuthToken.

Exceptions

JavaException

If the userPassword is malformed.

CreateBasicToken(string, string)

Constructs an AuthToken with the specified username and password per RFC2617. Username and password can be empty.

public static AuthToken CreateBasicToken(string user, string password)

Parameters

user string

The username/

password string

The password.

Returns

AuthToken

The constructed AuthToken.

CreateBasicTokenOrNull(string?, string?)

Constructs an AuthToken with the specified username and password per RFC2617. If both the username and password are empty or null, returns null.

public static AuthToken? CreateBasicTokenOrNull(string? user, string? password)

Parameters

user string

The username.

password string

The password.

Returns

AuthToken

The constructed AuthToken or null.

CreateBearerToken(string)

Constructs an AuthToken with the specified bearer token per RFC6750.

public static AuthToken CreateBearerToken(string token)

Parameters

token string

The access token.

Returns

AuthToken

The constructed AuthToken.

Exceptions

JavaException

If the token is empty.

CreateBearerTokenOrNull(string?)

Constructs an AuthToken with the specified bearer token per RFC6750.

public static AuthToken? CreateBearerTokenOrNull(string? token)

Parameters

token string

The access token.

Returns

AuthToken

The constructed AuthToken or null.

CreateCustomToken(string, string)

Constructs an AuthToken with a custom scheme and value.

public static AuthToken CreateCustomToken(string scheme, string value)

Parameters

scheme string

The custom scheme.

value string

The custom value.

Returns

AuthToken

The constructed AuthToken.

Exceptions

JavaException

If the scheme or value is empty.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Returns a hash code value for this object.

public override int GetHashCode()

Returns

int

A hash code value for this object.

ToString()

Returns string representation of this token.

public override string ToString()

Returns

string

The string representation.

ValueOf(string)

Constructs an AuthToken from the specified string.

public static AuthToken ValueOf(string str)

Parameters

str string

The string with space-separated scheme and value.

Returns

AuthToken

The constructed AuthToken.

Exceptions

JavaException

If the string is malformed, or if the scheme is "Basic" but the format does not comply with RFC2617.