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

Add OAuth/OpenID profile filter #9031

Open
rijkvanzanten opened this issue Oct 21, 2021 · 8 comments
Open

Add OAuth/OpenID profile filter #9031

rijkvanzanten opened this issue Oct 21, 2021 · 8 comments

Comments

@rijkvanzanten
Copy link
Member

With the newly added OAuth and OpenID drivers, it's possible to automatically create the user if they don't exist in the platform yet. However, this is currently an all-or-nothing setup. Useful for private user directories, like auth0 or Okta, but less ideal for big open platforms like Facebook or Google.

We should add a AUTH_<PROVIDER>_PUBLIC_REGISTRATION_FILTER that takes in a filter rules object to allow for specific external providers to have access. This could be something like

{
  "email": {
    "_ends_with": "@directus.io"
  }
}

or

{
  "profile": {
    "username": {
      "_in": ["@rijkvanzanten", "@benhaynes"]
    }
  }
}
@joselcvarela
Copy link
Member

I believe you had removed this commit 33dd4b3
in order to have a more fine grained control, instead of just domains, am I right?

@adanielyan
Copy link
Contributor

With the newly added OAuth and OpenID drivers, it's possible to automatically create the user if they don't exist in the platform yet.

Is this feature documented anywhere? How do I enable the automatic user creation?

@adanielyan
Copy link
Contributor

Never mind, I think I just found it in Environment variables: AUTH_<PROVIDER>_ALLOW_PUBLIC_REGISTRATION.

@aidenfoxx
Copy link
Contributor

I believe you had removed this commit 33dd4b3 in order to have a more fine grained control, instead of just domains, am I right?

Yup. That is the plan 😄

@jamescammarano
Copy link
Contributor

I believe you had removed this commit 33dd4b3 in order to have a more fine grained control, instead of just domains, am I right?

Yup. That is the plan 😄

Are you working on this? If not could we talk more about the plan?

@aidenfoxx
Copy link
Contributor

I believe you had removed this commit 33dd4b3 in order to have a more fine grained control, instead of just domains, am I right?

Yup. That is the plan 😄

Are you working on this? If not could we talk more about the plan?

This is on @rijkvanzanten. If I had my way it would be using the email domain filter I implemented 😂

@rijkvanzanten rijkvanzanten changed the title Add oAuth/OpenID profile filter Add OAuth/OpenID profile filter Nov 2, 2021
@rijkvanzanten
Copy link
Member Author

Are you working on this? If not could we talk more about the plan?

@jaycammarano The rough plan is:

  • When you register through an OAuth/OpenID provider, you get a profile with information
  • The information is different per provider, and has an unknown type signature
  • We'd want to have a way to only allow people to register who have a specific thing in that profile information

In order to do that, we need to configure what to check for and filter against, which we can do in a "public registration filter" environment variable. We already have a filtering setup (the filer rules), and a util that can check any arbitrary object against those rules, so we should be able to add an if-statement in the registration part of the OAuth/OpenID/LDAP providers that checks if the payload we received from the provider validates against the custom rules configured in the env var. This would allow the user to only allow dynamic registration based on a known flag on "the other end", for example "role = xyz" or "email endswidth @directus.io" etc

@rijkvanzanten
Copy link
Member Author

Linear: ENG-290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

5 participants