Table of Contents

Class UmaTicketExchangeClient

Namespace
Keycloak.AuthServices.Sdk.Protection
Assembly
Keycloak.AuthServices.Sdk.dll

Implements UMA ticket exchange using the Keycloak token endpoint.

public class UmaTicketExchangeClient : IUmaTicketExchangeClient
Inheritance
UmaTicketExchangeClient
Implements
Inherited Members

Remarks

Initializes a new instance of the UmaTicketExchangeClient class.

Constructors

UmaTicketExchangeClient(HttpClient, IOptions<KeycloakProtectionClientOptions>, ILogger<UmaTicketExchangeClient>)

Implements UMA ticket exchange using the Keycloak token endpoint.

public UmaTicketExchangeClient(HttpClient httpClient, IOptions<KeycloakProtectionClientOptions> options, ILogger<UmaTicketExchangeClient> logger)

Parameters

httpClient HttpClient
options IOptions<KeycloakProtectionClientOptions>
logger ILogger<UmaTicketExchangeClient>

Remarks

Initializes a new instance of the UmaTicketExchangeClient class.

Methods

ExchangeTicketForRptAsync(string, string, CancellationToken)

Exchanges a UMA permission ticket for a Requesting Party Token (RPT).

public Task<string?> ExchangeTicketForRptAsync(string accessToken, string ticket, CancellationToken cancellationToken = default)

Parameters

accessToken string

The bearer access token of the requesting party.

ticket string

The permission ticket received from the resource server's UMA challenge.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<string>

The RPT access token string, or null if the exchange failed.

SubmitPermissionRequestAsync(string, string, CancellationToken)

Submits a permission request for resource owner approval.

public Task<bool> SubmitPermissionRequestAsync(string accessToken, string ticket, CancellationToken cancellationToken = default)

Parameters

accessToken string

The bearer access token of the requesting party.

ticket string

The permission ticket received from the resource server's UMA challenge.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

true if the permission request was submitted for owner approval; otherwise false.

Remarks

Uses the submit_request=true parameter in the UMA ticket exchange. When access is denied, Keycloak persists a pending permission request that the resource owner can approve.