Runs the checks in this order, stopping at the first failure:
Arguments
- client
A client from
sso_client().- query
The callback's query: a string (
"?code=...&state=...", as in Shiny'ssession$clientData$url_search) or a named list.- pending
The
pendingvaluesso_start()returned.
Value
An identity (see has_group()). The raw ID token claims are in
$claims.
Details
an
errorparameter ->rusckersso_provider_error;statemust equalpending$state->rusckersso_state_mismatch;issmust be present and equal the issuer ->rusckersso_issuer_mismatch;the code is exchanged at the token endpoint (client secret over HTTP Basic, the
redirect_uri, thecode_verifier) ->rusckersso_token_refused;the ID token is verified: ES256 only, signature against the portal's keys,
iss,aud,exp,nonce->rusckersso_invalid_id_token;the identity is returned.
Steps 1-3 happen before any network call. A code works once: never call this twice with the same callback.
Examples
if (FALSE) { # \dontrun{
# Needs a reachable portal and the callback of a real sign-in.
# In a Shiny server function, with `start` kept from sso_start():
id <- sso_finish(client, session$clientData$url_search, start$pending)
id$sub # the person's permanent id
has_role(id, "fiscal", "gestor")
} # }