Class: OidcProvider

OidcProvider(connection, options)

The Authentication Provider for OpenID Connect.

See the openid-connect-popup.html and openid-connect-redirect.html files in the /examples/oidc folder for usage examples in the browser.

If you want to implement OIDC in a non-browser environment, you can override the OidcProvider or AuthProvider classes with custom behavior. In this case you must provide a function that creates your new class to the Connection.setOidcProviderFactory() method.

Constructor

new OidcProvider(connection, options)

Creates a new OidcProvider instance to authenticate using OpenID Connect.

Parameters:
Name Type Description
connection Connection

A Connection object representing an established connection to an openEO back-end.

options OidcProviderMeta

OpenID Connect Provider details as returned by the API.

Source:
See:

Extends

Members

(protected) connection :Connection

Type:
Overrides:
Source:

Methods

(static) isSupported() → {boolean}

Checks whether the required OIDC client library openid-client-js is available.

Source:
Returns:
Type
boolean

(static) setUiMethod(method)

Globally sets the UI method (redirect, popup) to use for OIDC authentication.

Parameters:
Name Type Description
method string

Method how to load and show the authentication process. Either popup (opens a popup window) or redirect (HTTP redirects, default).

Source:

(async, static) signinCallback(provider) → {Promise.<Oidc.User>}

Finishes the OpenID Connect sign in (authentication) workflow.

Must be called in the page that OpenID Connect redirects to after logging in.

Parameters:
Name Type Default Description
provider OidcProvider null

A OIDC provider to assign the user to.

Source:
Throws:

Error

Returns:

For uiMethod = 'redirect' only: OIDC User (to be assigned to the Connection via setUser if no provider has been specified).

Type
Promise.<Oidc.User>

getDescription() → {string}

Returns the human-readable description for the authentication method / provider.

Overrides:
Source:
Returns:
Type
string

getId() → {string}

Get an identifier for the auth provider (combination of the type + provider identifier).

Overrides:
Source:
Returns:
Type
string

getIssuer() → {string}

Returns the OpenID Connect / OAuth issuer.

Source:
Returns:
Type
string

getProviderId() → {string}

Returns the provider identifier, may not be available for all authentication methods.

Overrides:
Source:
Returns:
Type
string

getScopes() → {Array.<string>}

Returns the OpenID Connect / OAuth scopes.

Source:
Returns:
Type
Array.<string>

getTitle() → {string}

Returns the human-readable title for the authentication method / provider.

Overrides:
Source:
Returns:
Type
string

getToken() → (nullable) {string}

Returns the access token that is used as Bearer Token in API requests.

Returns null if no access token has been set yet (i.e. not authenticated any longer).

Overrides:
Source:
Returns:
Type
string

getType() → {string}

Returns the type of the authentication procedure as specified by the API, e.g. oidc or basic.

Overrides:
Source:
Returns:
Type
string

getUser() → {Oidc.User}

Returns the OpenID Connect user instance retrieved from the OIDC client library.

Source:
Returns:
Type
Oidc.User

(async) login(client_id, redirect_uri, optionsopt) → {Promise.<void>}

Authenticate with OpenID Connect (OIDC).

Supported only in Browser environments.

Parameters:
Name Type Attributes Default Description
client_id string

Your client application's identifier as registered with the OIDC provider

redirect_uri string

The redirect URI of your client application to receive a response from the OIDC provider.

options object.<string, *> <optional>
{}

Object with authentication options.

Overrides:
Source:
See:
Throws:
Error
Returns:
Type
Promise.<void>

(async) logout()

Logout from the established session.

Overrides:
Source:

setToken(tokennullable)

Sets the access token that is used as Bearer Token in API requests.

Set to null to remove the access token.

This also manages which auth provider is set for the connection.

Parameters:
Name Type Attributes Description
token string <nullable>
Overrides:
Source:

setUser(user)

Sets the OIDC User.

Parameters:
Name Type Description
user Oidc.User

The OIDC User returned by OidcProvider.signinCallback(). Passing null resets OIDC authentication details.

Source:
See: