Home Reference Source
import AuthHeader from '@token-io/core/src/http/AuthHeader.js'
public class | source

AuthHeader

Handles the addition of the http headers (with signature) to the request

Static Method Summary

Static Private Methods
private static

_customerInitiated(context: *): string

private static

_keyLevel(context: *): *

private static

_onBehalfOfHeader(context: *): string

Constructor Summary

Public Constructor
public

constructor(baseUrl: string, client: Object)

Creates an AuthHeader object with set url and signer

Member Summary

Private Members
private
private

_client: *

Method Summary

Public Methods
public

async addAuthorizationHeader(memberId: string, request: Object, context: AuthContext)

Adds an authorization header to the request.

Static Private Methods

private static _customerInitiated(context: *): string source

Params:

NameTypeAttributeDescription
context *

Return:

string

private static _keyLevel(context: *): * source

Params:

NameTypeAttributeDescription
context *

Return:

*

private static _onBehalfOfHeader(context: *): string source

Params:

NameTypeAttributeDescription
context *

Return:

string

Public Constructors

public constructor(baseUrl: string, client: Object) source

Creates an AuthHeader object with set url and signer

Params:

NameTypeAttributeDescription
baseUrl string

url to send requests to (gateway)

client Object

client, to get the signer

Private Members

private _baseUrl: * source

private _client: * source

Public Methods

public async addAuthorizationHeader(memberId: string, request: Object, context: AuthContext) source

Adds an authorization header to the request. This takes into account the url, payload of the request (with timestamp), to generate a message and signature. All of it goes into the Authorization http header.

Params:

NameTypeAttributeDescription
memberId string

memberId making the request

request Object

request

context AuthContext

auth context for access token redemption