flwr_oauth2/client_management

Types

pub type ClientManagementErrorResponse {
  Unauthorized(List(bearer_token.BearerErrorResponse))
  Forbidden
  NotSupported
  InvalidStatus(status: Int)
  ErrorResponse(response.ResponseError)
}

Constructors

  • Unauthorized(List(bearer_token.BearerErrorResponse))

    Error if the bearer token is not valid

  • Forbidden

    The client is not allowed to access this resource

  • NotSupported

    This operation is not supported by the authorization server

  • InvalidStatus(status: Int)

    The authorization server responded with an unknown invalid status

  • ErrorResponse(response.ResponseError)

    The response from the authorization server could not be parsed

Values

pub fn client_information_to_http_request(
  management_info: client_registration.ClientManagement,
) -> Result(request.Request(String), token_request.RequestError)

Creates a read (GET) request to the client information endpoint using the provided access token. This will just read the client information and not change anything, see RFC7592 Section 2.1. To parse the response, see parse_client_information_response IMPORTANT: The endpoint should be secured with HTTPS for production use cases.

pub fn delete_client_to_http_request(
  management_info: client_registration.ClientManagement,
) -> Result(request.Request(String), token_request.RequestError)

Creates a delete (DELETE) request to the client information endpoint using the provided access token. This will delete the client, see RFC7592 Section 2.3. To parse the response, see parse_client_deletion_response. IMPORTANT: The endpoint should be secured with HTTPS for production use cases.

pub fn parse_client_deletion_response(
  response resp: response.Response(String),
) -> Result(Nil, ClientManagementErrorResponse)

Parses the response from the client information endpoint, can be used if the client has been deleted. See RFC7592 Section 2.3. Returns Ok(Nil) if the client was deleted successfully, otherwise returns the error.

pub fn parse_client_information_response(
  response resp: response.Response(String),
) -> Result(
  client_registration.ClientInformationResponse,
  ClientManagementErrorResponse,
)

Parses the response from the client information endpoint, can be used if the client has been updated or if it was read. See https://datatracker.ietf.org/doc/html/rfc7592#section-2.1 and https://datatracker.ietf.org/doc/html/rfc7592#section-2.2 NOTE: If any custom extensions are included in the response, parse them out of the low level response manually.

pub fn update_client_information_to_http_request(
  management_info: client_registration.ClientManagement,
  client_update: client_registration.ClientInformationResponse,
) -> Result(request.Request(String), token_request.RequestError)

Creates an update (PUT) request to the client information endpoint using the provided access token. This will update the client information, see RFC7592 Section 2.2. Any custom extensions will be deleted per RFC7592 as null or non-present values are deleted. For custom extensions use [update_client_information_with_extensions_to_http_request][#update_client_information_with_extensions_to_http_request], as this will preserve the custom extensions. To parse the response, see parse_client_information_response IMPORTANT: The endpoint should be secured with HTTPS for production use cases.

pub fn update_client_information_with_extensions_to_http_request(
  management_info: client_registration.ClientManagement,
  client_update: client_registration.ClientInformationResponse,
  extensions: List(#(String, json.Json)),
) -> Result(request.Request(String), token_request.RequestError)

Creates an update (PUT) request to the client information endpoint using the provided access token. This will update the client information including any custom extensions, see RFC7592 Section 2.2. Extensions are serialized verbatim. Do not include fields prohibited in RFC 7592 Section 2.2 (registration_access_token, registration_client_uri, client_secret_expires_at, or client_id_issued_at), or keys already supplied by the typed metadata. Duplicate JSON keys may be handled unpredictably by the server. To parse the response, see parse_client_information_response. IMPORTANT: The endpoint should be secured with HTTPS for production use cases.

✨ Search Document