Table of Contents

Class OpenBiApiClientOAuthAppExtensions

Namespace
BiExcellence.OpenBi.Api.OAuthApps
Assembly
BiExcellence.OpenBi.Api.Client.dll

Extension methods for the /oauthapps REST API. Callers see and manage the apps they registered; holders of openbi.user.write see and manage everyone's.

public static class OpenBiApiClientOAuthAppExtensions
Inheritance
object
OpenBiApiClientOAuthAppExtensions

Methods

CreateOAuthAppAsync(IOpenBiApiClient, OAuthApp, CancellationToken)

Registers an OAuth app and returns it with its generated id and - for a confidential app - its secret, which is not returned again. Only a caller holding openbi.user.write may register one for someone else with UserId. An invalid app throws OpenBiApiException (400).

public static Task<OAuthApp?> CreateOAuthAppAsync(this IOpenBiApiClient client, OAuthApp oauthApp, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
oauthApp OAuthApp
cancellationToken CancellationToken

Returns

Task<OAuthApp>

CreateOAuthAppSecretAsync(IOpenBiApiClient, string, CancellationToken)

Replaces the secret of a confidential app and returns the app with the new one (POST oauthapps/{id}/secret). The old secret stops working at once. A public app throws OpenBiApiException (400).

public static Task<OAuthApp?> CreateOAuthAppSecretAsync(this IOpenBiApiClient client, string id, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
id string
cancellationToken CancellationToken

Returns

Task<OAuthApp>

DeleteOAuthAppAsync(IOpenBiApiClient, string, CancellationToken)

Deletes an OAuth app, and with it every token issued through it. A caller without openbi.user.write can only delete the apps it registered; deleting an app that is not there is not an error.

public static Task DeleteOAuthAppAsync(this IOpenBiApiClient client, string id, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
id string
cancellationToken CancellationToken

Returns

Task

DeleteOAuthConsentAsync(IOpenBiApiClient, string, CancellationToken)

Withdraws what the calling user allowed an app (DELETE oauth/consents/{appId}): the app is asked again next time, and every token it holds for the user is revoked at once. Withdrawing a consent that is not there is not an error.

public static Task DeleteOAuthConsentAsync(this IOpenBiApiClient client, string appId, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
appId string
cancellationToken CancellationToken

Returns

Task

GetOAuthAppAsync(IOpenBiApiClient, string, CancellationToken)

Reads one OAuth app by id. Throws OpenBiApiException (404) when there is no such app - or, for a caller without openbi.user.write, when someone else registered it.

public static Task<OAuthApp> GetOAuthAppAsync(this IOpenBiApiClient client, string id, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
id string
cancellationToken CancellationToken

Returns

Task<OAuthApp>

GetOAuthAppsAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken)

Lists OAuth apps (GET oauthapps), with the shared list options of request: the caller's own, or every app when the caller holds openbi.user.write. Secret is always null.

public static Task<OpenBiListResult<OAuthApp>> GetOAuthAppsAsync(this IOpenBiApiClient client, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
request OpenBiListRequest
cancellationToken CancellationToken

Returns

Task<OpenBiListResult<OAuthApp>>

GetOAuthConsentsAsync(IOpenBiApiClient, CancellationToken)

Lists the OAuth apps the calling user allowed, and with what (GET oauth/consents). Always the caller's own; needs no permission.

public static Task<OpenBiListResult<OAuthConsent>> GetOAuthConsentsAsync(this IOpenBiApiClient client, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
cancellationToken CancellationToken

Returns

Task<OpenBiListResult<OAuthConsent>>

UpdateOAuthAppAsync(IOpenBiApiClient, string, OAuthApp, CancellationToken)

Updates an OAuth app. Like UpdateApiKeyAsync this does not create a missing app: an unknown id - or, for a caller without openbi.user.write, someone else's app - throws OpenBiApiException (404). Making a public app confidential returns its new secret.

public static Task<OAuthApp?> UpdateOAuthAppAsync(this IOpenBiApiClient client, string id, OAuthApp oauthApp, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
id string
oauthApp OAuthApp
cancellationToken CancellationToken

Returns

Task<OAuthApp>