Ir al contenido

OpenID Connect

OkYouIn is an OpenID Connect provider (OP) for web applications. The application sends the browser to OkYouIn; the user signs in on OkYouIn’s branded sign-in page with the password and, if the rules require it, a second factor; OkYouIn sends the browser back with an authorization code, which the application exchanges for an ID token.

One sign-in serves every OIDC and SAML application: the second application the user opens signs in without a prompt while the OkYouIn session is alive.

Step-by-step setups: Grafana, GitLab and any OIDC application.

  • The server’s public URL (Settings ▸ General) must be an https:// address. It defines the issuer; without it every /oidc/ endpoint answers 503 and the application’s Connect tab shows a warning.
  • The relying party must be reachable by the user’s browser over HTTPS: OkYouIn accepts https redirect URIs only (http only for localhost, 127.0.0.1 and [::1]).

The issuer is the public URL followed by /oidc — for example https://mfa.example.com/oidc. Access ▸ Settings ▸ Single sign-on shows it together with the discovery URL.

EndpointPath
Discoveryhttps://mfa.example.com/oidc/.well-known/openid-configuration
Authorizationhttps://mfa.example.com/oidc/authorize
Tokenhttps://mfa.example.com/oidc/token
Userinfohttps://mfa.example.com/oidc/userinfo
JWKShttps://mfa.example.com/oidc/jwks
End sessionhttps://mfa.example.com/oidc/end_session

What the provider supports, as published in discovery:

Supported
FlowAuthorization code (response_type=code, response_mode=query)
Grant typesauthorization_code — no refresh tokens
Client authenticationclient_secret_basic, client_secret_post, none (public clients)
PKCES256 (plain is refused)
ID token signingRS256
Scopesopenid, profile, email, groups
promptnone, login
LogoutRP-initiated logout (end_session_endpoint); front-channel and back-channel logout are not supported

ID tokens and access tokens are valid for 10 minutes; an authorization code for 60 seconds. There is no refresh token: the application starts a new authorization when it needs one, which the live OkYouIn session answers without a prompt.

Create the application from the Generic OIDC template or a product template (Access ▸ Applications ▸ Add application). The OIDC settings:

SettingMeaning
Client typeConfidential (client secret) — a server-side application that keeps the client secret. Public (PKCE, no secret) — a browser or mobile application that cannot keep a secret; it must use PKCE.
Redirect URIsOne per line. The application’s callback must match one exactly — no wildcards, no fragments.
Post-logout redirect URIsOne per line. Where the application may send the browser after signing out of OkYouIn; empty = the OkYouIn “Signed out” page.
Client IDGenerated.
Client secretGenerated for confidential clients. Stored encrypted; revealing it is audited.
Require MFAOff: sign-ins the policy allows get in without a second factor.
Session lifetime (hours)How long one MFA serves this application. After it, the next sign-in to this application asks for the second factor again, even if the OkYouIn session is still alive.

PKCE is mandatory for a public client and checked whenever a confidential client sends a code_challenge.

Claims depend on the scopes the client requests and are the same in the ID token and the userinfo answer:

ScopeClaims
openidsub (the OkYouIn user ID — stable across renames), plus iss, aud, azp, exp, iat, auth_time, nonce (when sent), amr
profilepreferred_username, name, given_name, family_name
emailemail when the user has one; email_verified is not sent
groupsgroups — the names of the user’s groups, local and directory, sorted

For a directory user, preferred_username is the qualified name — for an Active Directory user typically the UPN (alice@corp.example.com). Userinfo reads the user’s data at the moment of the call, so a group change shows up at the next call.

Application rules can add claims of their own — for example role: Admin for members of a group. They are added to every ID token and userinfo answer, whatever scopes the client asks for. A name given several times becomes a list; template claims a rule leaves out are sent with their default. Protocol, standard and scope claims, groups and names starting with okyouin: are reserved.

{
"sub": "4f6c1e0a-3b7d-4c2e-9a51-0d2b8f7e6c11",
"preferred_username": "alice@corp.example.com",
"name": "Alice Example",
"email": "alice@example.com",
"groups": ["DevOps", "VPN-users"],
"role": "Admin"
}
  1. The application redirects to /oidc/authorize. OkYouIn checks the client, the redirect URI and the request, and evaluates the policy for this application and the browser’s address.

  2. Without a live OkYouIn session the browser lands on the sign-in page: username and password, then the second factor — a code field for TOTP or an e-mailed code, a number to pick for Web Push with number matching, or a wait for Telegram or an e-mail Approve link. A user without a method gets an enrolment link if self-service is on.

  3. OkYouIn redirects back with the code. The application exchanges it at /oidc/token and receives id_token and access_token.

  4. The next application — or the same one later — finds the OkYouIn session and is signed in without a prompt, unless that application’s session lifetime has passed since the last MFA (then only the second factor is asked) or the policy now says otherwise.

The policy is evaluated on every authorization request and after every MFA, with the browser’s current address — network and country conditions see where the user is now. A denied user sees OkYouIn’s message and a “Back to” link to the application, which then receives error=access_denied. With prompt=none, a sign-in that would need the password or MFA answers login_required or interaction_required instead of showing a page.

Kerberos-capable Active Directory sites can replace the password step with the user’s Windows ticket: see Kerberos desktop SSO.

Access ▸ Settings ▸ Single sign-on sets how long a browser stays signed in to OkYouIn:

SettingDefault
Hours after which a single sign-on session ends and the password is asked again12 (1–720)
Minutes of inactivity after which a single sign-on session ends120 (5–10080)

After either end, the next sign-in asks for the password again. How long one MFA serves an application is that application’s own Session lifetime (hours).

Logging ▸ SSO sessions lists live OkYouIn sessions: user, sign-in time, last seen, end, last MFA and the applications used. Every sign-in, MFA round, replayed code and sign-out is in Logging ▸ SSO sign-in log.

There are two kinds of session, and it matters which one ends:

  • the OkYouIn session — the browser’s single sign-on to OkYouIn;
  • the application’s own session — the cookie Grafana, GitLab or your app keeps after the sign-in.

Point the application’s logout to the end session URL:

https://mfa.example.com/oidc/end_session?id_token_hint=<ID-TOKEN>&post_logout_redirect_uri=https://app.example.com/login

With a valid id_token_hint, OkYouIn ends its session without asking and redirects to the post_logout_redirect_uri (if it is one of the application’s Post-logout redirect URIs) or to its own “Signed out” page. Without a hint OkYouIn first asks “Sign out?” — protection against a forged logout link. With no live OkYouIn session there is nothing to end, and the browser goes straight on.

Logging ▸ SSO sessions ▸ Revoke (or Revoke all of this user) ends the OkYouIn session at once: the codes and access tokens it issued stop working, and the browser’s next sign-in to any application asks for the password again. Locking a user, disabling them, changing their password or resetting their MFA does the same.

ID tokens are signed with the active key (RSA 2048, RS256). Access ▸ Settings ▸ Single sign-on lists the keys with their key ID, state and whether they are published in JWKS.

  • The active key is replaced automatically after the configured number of days (90 by default; 0 = manual only).
  • Rotate now — a new key signs from now on; the previous one stays in JWKS for 7 days, so nothing breaks for the applications.
  • Rotate and drop previous — for a key that may be compromised: the previous key leaves JWKS at once and every token signed with it stops verifying. Most applications fetch JWKS again on an unknown key ID; others need a restart.
Symptom (SSO sign-in log reason)Cause
Redirect URI not registeredThe application sends a callback that is not exactly in Redirect URIs — check scheme, host, port, path and trailing slash.
HTTPS requiredThe application or a proxy reached OkYouIn over plain HTTP.
PKCE requiredA public client sent no code_challenge.
Wrong client secret / Invalid client authenticationThe secret on the application differs, or it sends the secret both in the header and the body.
Invalid scope (no openid)The client did not request the openid scope.
Post-logout redirect URI not registeredThe logout target is not in Post-logout redirect URIs; OkYouIn shows its own “Signed out” page instead.
Denied by policyNo policy rule allows this user for this application from this address.

OkYouIn’s provider passes the OpenID Foundation conformance suite’s Basic OP and Config OP plans in our lab (self-run; this is not a certification) — see Generic OIDC.