registerOidcConfig method

Future<RegisterOidcConfigResponse> registerOidcConfig({
  1. required String companyId,
  2. required String issuer,
  3. required String networkId,
  4. required String scopes,
  5. String? customUsername,
  6. String? extraAuthParams,
  7. String? secret,
  8. int? ssoTokenBufferMinutes,
  9. String? userId,
})

Registers and saves an OpenID Connect (OIDC) configuration for a Wickr network, enabling Single Sign-On (SSO) authentication through an identity provider.

May throw BadRequestError. May throw ForbiddenError. May throw InternalServerError. May throw RateLimitError. May throw ResourceNotFoundError. May throw UnauthorizedError. May throw ValidationError.

Parameter companyId : Custom identifier your end users will use to sign in with SSO.

Parameter issuer : The issuer URL of the OIDC provider (e.g., 'https://login.example.com').

Parameter networkId : The ID of the Wickr network for which OIDC will be configured.

Parameter scopes : The OAuth scopes to request from the OIDC provider (e.g., 'openid profile email').

Parameter customUsername : A custom field mapping to extract the username from the OIDC token (optional).

Parameter extraAuthParams : Additional authentication parameters to include in the OIDC flow (optional).

Parameter secret : The client secret for authenticating with the OIDC provider (optional).

Parameter ssoTokenBufferMinutes : The buffer time in minutes before the SSO token expires to refresh it (optional).

Parameter userId : Unique identifier provided by your identity provider to authenticate the access request. Also referred to as clientID.

Implementation

Future<RegisterOidcConfigResponse> registerOidcConfig({
  required String companyId,
  required String issuer,
  required String networkId,
  required String scopes,
  String? customUsername,
  String? extraAuthParams,
  String? secret,
  int? ssoTokenBufferMinutes,
  String? userId,
}) async {
  final $payload = <String, dynamic>{
    'companyId': companyId,
    'issuer': issuer,
    'scopes': scopes,
    if (customUsername != null) 'customUsername': customUsername,
    if (extraAuthParams != null) 'extraAuthParams': extraAuthParams,
    if (secret != null) 'secret': secret,
    if (ssoTokenBufferMinutes != null)
      'ssoTokenBufferMinutes': ssoTokenBufferMinutes,
    if (userId != null) 'userId': userId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/oidc/save',
    exceptionFnMap: _exceptionFns,
  );
  return RegisterOidcConfigResponse.fromJson(response);
}