nextcloud / nextcloud/user_oidc

Support for ACR values

Open
#696 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
181
Forks
60
Avg merge
7h 34m
Merged PRs (30d)
26

Description

We want to support some clients that only require a single factor for authentication and some clients that require two factors (and some that allow step-up for specific requests - but those are not relevant here). Nextcloud is one of the clients requiring two factors. Currently we have split the clients into two realms with different authentication flows. If a user uses two clients from different realms they have to perform authentication twice. We would like to have all clients in one realm for proper SSO. For this we need support for handling acr claims as this would allow different levels of authentication within one realm. Is there any plan to support handling of ACR values?

The ACR handling would require three additions. I'm not very good at PHP and I don't know the codebase well, but I have tried to identify the parts of the code that would need changes.

  1. Add a setting which allows a user to specify if ACR should be handled and what ACR value should be used. I did not look this up in the code as i guess it would be a trivial part.

  2. When sending a login request the acr claim has to be added to the request. I think this would be done here. The official Keycloak documentation gives an example for the claim (in the Request a certain authentication level paragraph of the linked section).

    claims= {
        "id_token": {
            "acr": {
                "essential": true,
                "values": ["ACR_VALUE_GOES_HERE"]
            }
        }
    }
    
  3. When receiving the response from the IdP the value of the acr claim in the ID token returned by the IdP has to be compared with the requested value. Otherwise users could avoid having to go through extra steps by changing the login URL. This is mentioned in the Keycloak documentation (in the warning block of the linked section). I am not entirely sure where the IdP response is handled in the code, but i think the check would need to be added here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading lib/Controller/LoginController.php around lines 265 and 464, then trace how provider settings and the IdP response are handled. Define how an ACR setting is stored and applied to the login request, and how the returned ID-token ACR value is checked against it. Done means the requested authentication level is sent and mismatches are rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.