Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple values for SSO attributes #13238

Open
matrixbot opened this issue Dec 19, 2023 · 0 comments
Open

Allow multiple values for SSO attributes #13238

matrixbot opened this issue Dec 19, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 19, 2023

This issue has been migrated from #13238.


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: "[email protected]"

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: "[email protected]"
       value: "[email protected]"

or

    attribute_requirements:
     - attribute: email
       value: "[email protected]"
     - attribute: email
       value: "[email protected]"

With this setup, Synapse ignores all values except the last line ([email protected]) and the SSO handler no longer matches to [email protected]. 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.)

@matrixbot matrixbot changed the title Dummy issue Allow multiple values for SSO attributes Dec 21, 2023
@matrixbot matrixbot reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant