Skip to content

feat: support OIDC authentication#184

Closed
michaelhthomas wants to merge 73 commits intoseerr-team:developfrom
michaelhthomas:oidc-login
Closed

feat: support OIDC authentication#184
michaelhthomas wants to merge 73 commits intoseerr-team:developfrom
michaelhthomas:oidc-login

Conversation

@michaelhthomas
Copy link
Contributor

@michaelhthomas michaelhthomas commented Jul 11, 2022

Description

Adds support for logging in using an OIDC Identity Provider (Auth0, Authentik, Keycloak, etc.).

Refactors Plex OAuth login to be in its own component, like the other identity providers.

Screenshot (if UI-related)

Login Page

Settings Page

To-Dos

  • Successful build yarn build
  • Translation keys yarn i18n:extract
  • Database migration (if required)

Issues Fixed or Closed

@john-sp
Copy link

john-sp commented Jul 14, 2022

You may want to blur some of the info in the image

@fallenbagel
Copy link
Collaborator

Ah I see that you resolved the merge conflicts. Was going to ask. Thanks

@fallenbagel
Copy link
Collaborator

@michaelhthomas Hi. I tried to test this PR, however, during first setup in the library step, I get this error and I am not able to continue it setup
image

@michaelhthomas
Copy link
Contributor Author

Uh oh... I'm pretty sure that means you made it to the second page but aren't logged in with Plex or Jellyfin, which probably means the login failed and I need to add some better error handling. Which one were you testing?

@fallenbagel
Copy link
Collaborator

Which one were you testing?

Jellyfin. That is from the libraries setup page right after logging in

@michaelhthomas
Copy link
Contributor Author

@fallenbagel Found the bug and am working on a fix. Got a question...right now there's a value for MediaServerType.EMBY that's essentially unused, since emby is actually treated as MediaServerType.JELLYFIN with JELLYFIN_TYPE set to "emby". Would you be ok with removing MediaServerType.EMBY to avoid confusion, or would you rather everything use MediaServerType.EMBY instead of JELLYFIN_TYPE for consistency?

@fallenbagel
Copy link
Collaborator

We need the MediaServerType=Emby as the current emby implementation is temporary. We are going to be implementing emby without the env variable through api which would also allow us to have simultaneous server support. So we need it

@michaelhthomas
Copy link
Contributor Author

Ok sweet. I'll test Emby with my current implementation to make sure everything works as expected, and when it's implemented properly there will probably be some changes that need to be made to the login window / setup wizard.

@fallenbagel
Copy link
Collaborator

Ok sweet. I'll test Emby with my current implementation to make sure everything works as expected, and when it's implemented properly there will probably be some changes that need to be made to the login window / setup wizard.

I have not tested yet but if it works for emby it should work for jellyfin. Will test tonight

@fallenbagel
Copy link
Collaborator

fallenbagel commented Aug 18, 2022

I tested the setup and it indeed worked. However, as I have no way of testing OIDC, I will deploy this as a preview tag (:preview-pr184 for testing for now

@fallenbagel fallenbagel added the merge conflict Cannot merge due to merge conflicts label Sep 7, 2022
@michaelhthomas
Copy link
Contributor Author

@fallenbagel resolved the merge conflicts. OIDC is working great for me (using authentik) but would love to have some others test with different OIDC providers.

@fallenbagel
Copy link
Collaborator

fallenbagel commented Sep 18, 2022

@fallenbagel resolved the merge conflicts. OIDC is working great for me (using authentik) but would love to have some others test with different OIDC providers.

Is LDAP possible with this? (I don't really know OIDCs and stuff so)

@michaelhthomas
Copy link
Contributor Author

@fallenbagel resolved the merge conflicts. OIDC is working great for me (using authentik) but would love to have some others test with different OIDC providers.

Is LDAP possible with this? (I don't really know OIDCs and stuff so)

Not directly. A number of oauth2 / OIDC providers do integrate with LDAP (including authentik) for authentication, but oauth2 is much higher level. Where LDAP acts more like an external users database, an OIDC/oauth provider handles all the sign in and authentication logic. Plex SSO actually uses oauth2 afaik, it just doesn't conform to the OIDC standard.

@BoBeR182
Copy link

I can test with Keycloak, just learning how to compile and run this build still.

@fallenbagel
Copy link
Collaborator

fallenbagel commented Sep 22, 2022

I can test with Keycloak, just learning how to compile and run this build still.

If you want to compile it natively to test instead of the deployed docker snapshot, pull this PR and try it

And please provide feedback. Feedback is very much needed (since this is kind of a big feature)

@atropos112
Copy link

atropos112 commented Sep 23, 2022

Howdy,

I am excited to see this MR, its certainly something that is missing in my setup and hence i (somewhat selfishly) want to help.


My relevant setup:
I am running Sonarr, Radarr, Jellyfin and of course Jellyseerr. I am also running Authelia which I currently use as my OpenID solution for ArgoCD, WikiJs, Grafana, Harbor and Gitlab.


I have never implemented open id login mechanism but I have connected few applications to OpenID that Authelia provides (as outlined above), I am happy to test and provide feedback. I have ran your branch locally and have few questions.

A typical config in Authelia looks something like this

- id: <user-picked-id-here>
  pre_configured_consent_duration: '365d'
  description: idk
  secret: <SECRETHERE>
  public: false
  authorization_policy: one_factor
  audience: []
  scopes:
    - openid
    - email
    - profile
  redirect_uris:
    - <CALLBACKURL>
   response_modes:
        - form_post 

(I believe data needed to setup is somewhat similar for KeyCloak +- some small details)

In particular both Authelia and the app (Jellyseerr in this case) need to have id and the secret, both of which are chosen by the client.. In addition authelia (keycloak also) needs the callback url and the required scopes. In your implementation I see place for id but not the secret, is there a way of adding this ? I also do not know (maybe i am missing something obvious) what the callback url is and what scopes are required.

@michaelhthomas
Copy link
Contributor Author

Howdy,

I am excited to see this MR, its certainly something that is missing in my setup and hence i (somewhat selfishly) want to help.

My relevant setup: I am running Sonarr, Radarr, Jellyfin and of course Jellyseerr. I am also running Authelia which I currently use as my OpenID solution for ArgoCD, WikiJs, Grafana, Harbor and Gitlab.

I have never implemented open id login mechanism but I have connected few applications to OpenID that Authelia provides (as outlined above), I am happy to test and provide feedback. I have ran your branch locally and have few questions.

A typical config in Authelia looks something like this

- id: <user-picked-id-here>
  pre_configured_consent_duration: '365d'
  description: idk
  secret: <SECRETHERE>
  public: false
  authorization_policy: one_factor
  audience: []
  scopes:
    - openid
    - email
    - profile
  redirect_uris:
    - <CALLBACKURL>
   response_modes:
        - form_post 

(I believe data needed to setup is somewhat similar for KeyCloak +- some small details)

In particular both Authelia and the app (Jellyseerr in this case) need to have id and the secret, both of which are chosen by the client.. In addition authelia (keycloak also) needs the callback url and the required scopes. In your implementation I see place for id but not the secret, is there a way of adding this ? I also do not know (maybe i am missing something obvious) what the callback url is and what scopes are required.

Because Jellyseerr is a SPA (single page app), it uses the OAuth PKCE authorization flow instead of the traditional authorization flow. Since all of the login and (most of) the validation logic occurs on the client when using this flow, the client secret is not used. This is a "public" authorization flow, so the configuration will look a little bit different from apps using the traditional authorization flow. This looks to be the relevant configuration option for Authelia, and other providers should have similar options. In order to maintain security with this mechanism, be sure that the redirect URLs are limited only to your Jellyseerr instance (https://your-jellyseerr-instance.xyz/login). Also, the openid, profile, and email scopes are all used so that Jellyseer can view users' names and email addresses. Thanks for being open to testing this out!

@atropos112
Copy link

atropos112 commented Sep 24, 2022

That makes a lot of sense! I take it then I need something like this

      - id: jellyseerr
        public: true
        authorization_policy: two_factor
        audience: []
        scopes:
        - openid
        - email
        - profile
        redirect_uris:
        - https://jellyserrr-instance.xyz/login
        userinfo_signing_algorithm: none
        response_modes:
        - form_post 

I am building the docker image now, will shortly deploy and update.

@fallenbagel
Copy link
Collaborator

That makes a lot of sense! I take it then I need something like this

      - id: jellyseerr
        public: true
        authorization_policy: two_factor
        audience: []
        scopes:
        - openid
        - email
        - profile
        redirect_uris:
        - https://jellyserrr-instance.xyz/login
        userinfo_signing_algorithm: none
        response_modes:
        - form_post 

I am building the docker image now, will shortly deploy and update.

Docker image is already built tho. Can be access through preview-prxxx where xxx is this PRs number

@atropos112
Copy link

atropos112 commented Sep 24, 2022

I wanted to test it further so I ran

docker build -t oicd-jellyseerr -f Dockerfile .
docker tag oidc-jellyseerr:latest myharbor.xyz/testing/oidc-jellyseerr:develop
docker push myharbor.xyz/testing/oidc-jellyseerr:develop

but when i run a pod with the above image I get
image
(pressing reload refreshes the page and this pop-up appears again)
this is strange, I tried running on the normal develop branch to see if its something with your changes (which I doubted) but I get the same issue. Data seems to need to be reloaded but even if i start on fresh pvc i still get this. Is there some variable I am missing ?

@michaelhthomas
Copy link
Contributor Author

I wanted to test it further so I ran

docker build -t oicd-jellyseerr -f Dockerfile .
docker tag oidc-jellyseerr:latest myharbor.xyz/testing/oidc-jellyseerr:develop
docker push myharbor.xyz/testing/oidc-jellyseerr:develop

but when i run a pod with the above image I get
image
(pressing reload refreshes the page and this pop-up appears again)
this is strange, I tried running on the normal develop branch to see if its something with your changes (which I doubted) but I get the same issue. Data seems to need to be reloaded but even if i start on fresh pvc i still get this. Is there some variable I am missing ?

What happens when you press the reload button? That just looks like your browser still has the old version of the web interface cached

@github-actions github-actions bot added the merge conflict Cannot merge due to merge conflicts label Jun 12, 2024
@github-actions
Copy link

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@Alumni1506
Copy link

For people looking to use the latest version of authelia, using the previous working configuration will result in an error. You need to add token_endpoint_auth_method: 'client_secret_post' to the configuration file.

For those that have been running authelia and recently updated, this suggested change fixed my errors post update.

@nebb00
Copy link

nebb00 commented Jun 24, 2024

Is there a rough idea on a timeline for this support? Really want to migrate my users to jellyfin and jellyseer using Authelia as user management

@gauthier-th gauthier-th mentioned this pull request Aug 12, 2024
38 tasks
@TheRedCyclops
Copy link

I have managed to set this up with authelia, but there is one small error, when signing out it redirects to: https://jellyseerr.example.com/api/v1/auth/undefined instead of the login page or whatever page it was trying to redirect to.
No relevant logs

@mikevanes
Copy link

mikevanes commented Sep 13, 2024

Any information of the status of this PR? Currently using the preview branch which seems to work nicely, would love to see it merged.

@lucaam
Copy link

lucaam commented Sep 13, 2024

Any information of the status of this PR? Currently using the preview branch which seems to work nicely, would love to see it merged.

Hello, you should have a look here #883

@Ruakij
Copy link

Ruakij commented Sep 13, 2024

Any information of the status of this PR? Currently using the preview branch which seems to work nicely, would love to see it merged.

Hello, you should have a look here #883

I dont 100% understand why this cant be parallel? So this PR being integrated before Linking is introduced.
Linking needs to support multiple anyways and needs to migrate current states over, so this wouldnt be an exception. Ideally this would then only incur minimal changes there. (i.e. Enum + adding a Provider)

Just seems this feature will be pushed more and more because of more and more changes to the underlying system and parallel development state. :/

@0dragosh
Copy link

I agree with @Ruakij, it seems this has been pushed for over 2 years yet there’s a build with the feature fully operational.

Are there any downsides to merging what’s in preview-OIDC and adding linking later?

@fallenbagel
Copy link
Collaborator

fallenbagel commented Sep 13, 2024

This PR is way outdated. It's not even close to the state that develop is in. We cannot just simply merge this pr.

And if you look at #926 you can find that it's in the roadmap. But we need to completely rework this pr to even be compatible.

@0dragosh
Copy link

Alright @fallenbagel, no worries. Thanks for the work!

@pando85
Copy link

pando85 commented Nov 1, 2024

If there are some rework here. We should change the callback schema to allow https even if you run it in http because you can deploy Jellyseer behind a reverse proxy which is quite common.

@njhughes-01
Copy link

Im still running a really old dev branch as i don't want to break all my user logins if anyone moves to a newer branch and it functions can you please @ me. I understand this branch is in a rework state

@samip5
Copy link

samip5 commented Jan 9, 2025

Hi @michaelhthomas!

Is this PR abandoned? It sure looks that way and someone else could continue the work?

@michaelhthomas
Copy link
Contributor Author

Hi @michaelhthomas!

Is this PR abandoned? It sure looks that way and someone else could continue the work?

Hi! Please read the earlier discussion. This will be revisited and implemented, but not in this PR. For now, I'll probably close this.

@samip5
Copy link

samip5 commented Jan 11, 2025

Hi @michaelhthomas!

Is this PR abandoned? It sure looks that way and someone else could continue the work?

Hi! Please read the earlier discussion. This will be revisited and implemented, but not in this PR. For now, I'll probably close this.

Hi! I did read the previous messages in the thread but it wasn't apparent to me what's the actual state except that it needs to be remade.

@michaelhthomas
Copy link
Contributor Author

@samip5 I am still waiting for #883 to be merged. Once that is merged, a PR adding support for OpenID Connect should follow shortly thereafter.

@mobiledude
Copy link

mobiledude commented Feb 3, 2025

Really looking forward to this!! Thanks for the great work guys!. This would mean I can ditch this and stay updated ;-)
Screenshot 2025-02-03 at 16 53 55

@alleyu2
Copy link

alleyu2 commented Feb 6, 2025

Really looking forward to this!! Thanks for the great work guys!. This would mean I can ditch this and stay updated ;-) Screenshot 2025-02-03 at 16 53 55

Just curious what is this and hows does it help with SSO?

@samip5
Copy link

samip5 commented Feb 7, 2025

Really looking forward to this!! Thanks for the great work guys!. This would mean I can ditch this and stay updated ;-) Screenshot 2025-02-03 at 16 53 55

Just curious what is this and hows does it help with SSO?

Basically means they're still running this PR's code instead of being up-to-date.

@jridz
Copy link

jridz commented Feb 21, 2025

@samip5 I am still waiting for #883 to be merged. Once that is merged, a PR adding support for OpenID Connect should follow shortly thereafter.

#883 just got accepted! Excited to see where this goes.

@crazyelectron-io
Copy link

Looking forward to OIDC support in the official release.

@edbourque0
Copy link

@samip5 I am still waiting for #883 to be merged. Once that is merged, a PR adding support for OpenID Connect should follow shortly thereafter.

@michaelhthomas Is this still in your short-term plans ?

@seerr-team seerr-team locked and limited conversation to collaborators Mar 3, 2025
@gauthier-th
Copy link
Member

I'm locking this thread because nothing relevant is being said here.
Micheal will work on this when he has time, and we'll do our best to integrate this into Jellyseerr as quickly as possible. Keep in mind that we're all volunteers, and sometimes we have other obligations 😉

@fallenbagel fallenbagel removed merge conflict Cannot merge due to merge conflicts preview PRs deployed for testing with tag `:preview-prxx` labels Mar 3, 2025
@gauthier-th
Copy link
Member

The preview-OIDC tag now points to #1505 and not anymore to this PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Support login with OIDC [Feature request] SSO