Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Allow multiple values for SSO attributes #13238

@villepeh

Description

@villepeh

Description:

I'm currently running Synapse that's closed for registration and I'm using SSO for authentication. Other login methods have been disabled.

Since we can't disable registration with homeserver config file, I followed the advice given here #11968 which is using attribute_requirements to restrict who can login or register using SSO.

oidc_providers:
  - idp_id: google
    idp_name: Google
    idp_brand: "google"  # optional: styling hint for clients
    issuer: "https://accounts.google.com/"
    client_id: "xxx" # TO BE FILLED
    client_secret: "xxxx" # TO BE FILLED
    scopes: ["openid", "profile", "email"]
    attribute_requirements:
     - attribute: email
       value: "my@email.tld"

This worked perfecly to restrict SSO only to my email. The issue came up when I tried adding more email addresses to "the whitelist" above

    attribute_requirements:
     - attribute: email
       value: "my@email.tld"
       value: "other@email.tld"

or

    attribute_requirements:
     - attribute: email
       value: "my@email.tld"
     - attribute: email
       value: "other@email.tld"

With this setup, Synapse ignores all values except the last line (other@email.tld) and the SSO handler no longer matches to my@email.tld. I suppose this is intended behavior, since even the config file clearly states "All of the listed attributes must match for the login to be permitted". However, this makes it really difficult to enable single sign-on and only allow logins from "friends only".

The only way I could figure out how to really get it to work was to hack /synapse/handlers/sso.py and hardcode email addresses there.

Would it be possible to allow matching several different values on required attributes? (In this case, allowing multiple email addresses.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SSOSingle Sign-On (maybe OIDC)T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions