Dōrvis

Sign in

Keycloak Smart-ID and eParaksts login with Dorvis

To add Keycloak Smart-ID, eParaksts and Latvian bank login, register Dorvis in your realm as an "OpenID Connect v1.0" identity provider. Keycloak brokers the login and stores the verified name and personal code as user attributes; your applications keep talking only to Keycloak.

What you need before you start

  • A Keycloak realm you administer. Field names below follow the current Keycloak admin console (the identity provider UI of Keycloak 24 and later).
  • A Dorvis account and an integration in the self-service portal. The Free plan covers Digimaks; Smart-ID, eParaksts and bank login need a paid plan.
  • For production Smart-ID, a contract with SK ID Solutions; for bank login, the bank agreements. Our Launch Kit handles these applications for you.
  • An alias for the provider, for example dorvis. The alias becomes part of the redirect URI and cannot be changed later without re-registering it.

Add Dorvis as an OpenID Connect identity provider

  1. Register the redirect URI in Dorvis

    In the Dorvis portal create an integration with the redirect URI https://KEYCLOAK_HOST/realms/REALM/broker/dorvis/endpoint (replace the host, realm and alias). Keycloak also shows this exact value as Redirect URI on the provider page. Copy the client ID and client secret that Dorvis issues.

  2. Create the provider

    In the admin console open Identity providers and choose OpenID Connect v1.0. Set Alias to dorvis and Display name to what users should see, for example "Smart-ID, eParaksts or bank".

  3. Import the Dorvis metadata

    Keep Use discovery endpoint on and paste https://dorvis.eu/oidc/.well-known/openid-configuration into Discovery endpoint. Keycloak fills in the authorization, token, user info, logout, issuer and JWKS values.

  4. Set client authentication

    Choose Client secret sent in the request body (Dorvis also accepts HTTP Basic authentication) under Client authentication, then enter the Client ID and Client Secret from the Dorvis portal. Keycloak can read the secret from its vault instead of storing it in the realm.

  5. Review the advanced settings

    Under Advanced set Scopes to openid profile, keep Validate Signatures and Use JWKS URL on, and choose a Sync mode (see the table below). Save.

  6. Add mappers and test

    On the Mappers tab add the attribute mappers described below, then sign in to the realm account console with the Dorvis button using a test identity.

Recommended Keycloak settings for Dorvis

Keycloak fieldValueWhy
Discovery endpointhttps://dorvis.eu/oidc/.well-known/openid-configurationImports all endpoints and the signing keys
Issuerhttps://dorvis.eu/oidcKeycloak checks the iss claim against it
Client authenticationClient secret sent in the request bodyStandard confidential client; secret stays on the server
Scopesopenid profileprofile returns given_name, family_name and person_code
Validate Signatures / Use JWKS URLOn / OnID tokens are verified with the Dorvis keys, which rotate automatically
Sync modeForceName changes are copied on every login; use Import if users may edit their names in Keycloak
Trust EmailOffDorvis does not return an e-mail address
First login flow overridefirst broker login (default) or your own flowControls how new users are created and linked
Forwarded query parametersacr_values (only for option B below)Passes the method chosen by the application on to Dorvis

Map given_name, family_name and person_code to user attributes

Add an Attribute Importer mapper for each claim: Claim given_name → User Attribute Name firstName, and family_name → lastName. For the personal code use Claim person_code → User Attribute Name person_code.

Since Keycloak 24 the declarative user profile is always active and unmanaged attributes are disabled by default, so first declare person_code under Realm settings → User profile. Make it read-only for users and visible only to administrators unless your applications need it in tokens.

Add a Username Template Importer with the template ${ALIAS}.${CLAIM.sub} so usernames do not contain the personal code. To pass person_code on to an application, add a "User Attribute" protocol mapper to that client in Keycloak, and only for clients that really need it (GDPR notes).

Choosing the method: acr_values in Keycloak

Without acr_values Dorvis shows its own chooser with every method enabled in your integration. That is the simplest set-up: one Keycloak provider, one button.

Option A: one provider per method (recommended when you want separate buttons). Create a provider for each method, for example aliases dorvis-smartid and dorvis-eparaksts. Enter the endpoints manually with Use discovery endpoint off, and append the method to the Authorization URL, for example https://dorvis.eu/oidc/oauth2/auth?acr_values=idp:smartid. Keycloak builds the redirect from this URL and keeps the existing query string. Each alias needs its own redirect URI in the Dorvis integration.

Option B: let the application choose. Enter acr_values in Forwarded query parameters on a single provider; Keycloak then passes the value from the application's authorization request to Dorvis. Since Keycloak 26.4.2 this must be configured explicitly. Keycloak also reads acr_values itself for step-up authentication, so test this option against your realm's ACR to LoA mapping before going live.

Values: idp:smartid, idp:eparaksts-mobile, idp:eparaksts, idp:swedbank, idp:seb, idp:citadele, idp:luminor or idp:edim (Digimaks). Dorvis reads one value per request.

Example: separate Keycloak providers for Smart-ID and eParaksts

The Authorization URL of each provider carries a fixed method. Applications skip the Keycloak login page with kc_idp_hint.

# Provider "dorvis-smartid"
Authorization URL: https://dorvis.eu/oidc/oauth2/auth?acr_values=idp:smartid
Token URL:         https://dorvis.eu/oidc/oauth2/token
User Info URL:     https://dorvis.eu/oidc/userinfo
Issuer:            https://dorvis.eu/oidc
JWKS URL:          https://dorvis.eu/oidc/.well-known/jwks.json

# Provider "dorvis-eparaksts"
Authorization URL: https://dorvis.eu/oidc/oauth2/auth?acr_values=idp:eparaksts-mobile

# Application login link straight to Smart-ID
https://KEYCLOAK_HOST/realms/REALM/protocol/openid-connect/auth
  ?client_id=my-app&response_type=code&scope=openid
  &redirect_uri=https://app.example.lv/callback
  &kc_idp_hint=dorvis-smartid

First broker login and skipping the Keycloak login page

On the first Dorvis login Keycloak runs the first broker login flow. Its Review Profile step asks for missing required data, and the default user profile requires an e-mail address, which Dorvis does not send. Either let users enter an e-mail on that screen, or make email optional in Realm settings → User profile if your application does not need it.

Do not use automatic account linking by e-mail with Dorvis. To link existing accounts reliably, match on person_code in a custom flow or link accounts in your own registration process.

If Dorvis should be the only login method, open Authentication → browser flow, click the gear icon on Identity Provider Redirector and set Default Identity Provider to dorvis. Applications can override it per request with kc_idp_hint.

Did not find the answer?

Write to us and a developer will reply.

Ask a question
Loading complete

We use cookies to make this website easier to use. Read our Privacy and Cookie Policy.