Table of Contents

Interface IAuthorizationServerClient

Namespace
Keycloak.AuthServices.Authorization.AuthorizationServer
Assembly
Keycloak.AuthServices.Authorization.dll

Keycloak AuthorizationServer API

public interface IAuthorizationServerClient

Methods

VerifyAccessToResource(string, string, ScopesValidationMode?, string?, CancellationToken)

Verifies access to the protected resource. Sends decision request to token endpoint {resource}#{scope}

Task<bool> VerifyAccessToResource(string resource, string scope, ScopesValidationMode? scopesValidationMode = null, string? audience = null, CancellationToken cancellationToken = default)

Parameters

resource string
scope string
scopesValidationMode ScopesValidationMode?
audience string

The Keycloak client ID of the target resource server to use as the UMA audience parameter. When null, the global KeycloakAuthorizationServerOptions.Resource value is used.

cancellationToken CancellationToken

Returns

Task<bool>

VerifyAccessToResource(string, string, string, ScopesValidationMode?, CancellationToken)

Verifies access to the protected resource using an explicit access token. Use this overload in SignalR or other long-lived connection scenarios where the token from HttpContext may be stale.

Task<bool> VerifyAccessToResource(string resource, string scope, string accessToken, ScopesValidationMode? scopesValidationMode = null, CancellationToken cancellationToken = default)

Parameters

resource string
scope string
accessToken string

The access token to use for the authorization request.

scopesValidationMode ScopesValidationMode?
cancellationToken CancellationToken

Returns

Task<bool>

VerifyAccessToResource(string, string, string, CancellationToken)

Verifies access to the protected resource using an explicit access token. Use this overload in SignalR or other long-lived connection scenarios where the token from HttpContext may be stale.

Task<bool> VerifyAccessToResource(string resource, string scope, string accessToken, CancellationToken cancellationToken = default)

Parameters

resource string
scope string
accessToken string

The access token to use for the authorization request.

cancellationToken CancellationToken

Returns

Task<bool>

VerifyAccessToResource(string, string, CancellationToken)

Verifies access to the protected resource. Sends decision request to token endpoint {resource}#{scope}

Task<bool> VerifyAccessToResource(string resource, string scope, CancellationToken cancellationToken = default)

Parameters

resource string
scope string
cancellationToken CancellationToken

Returns

Task<bool>