Compare commits

...
49 Commits
Author SHA1 Message Date
Ersei Saggi 2c3fc4d8e1 Prepare for 3.5.1.1 2023-08-07 08:42:10 -04:00
Ersei Saggi f897704100 fix: change iframe URL to point to the web UI instead of the root 2023-08-07 08:23:34 -04:00
Ersei Saggi d0b9b10a36 fix: remove the commit lint check (it's really useless) 2023-08-06 16:36:24 -04:00
Ersei Saggi 172f22e19f release: prepare for v3.5.1.0 2023-08-06 16:34:57 -04:00
Ersei Saggi 5777c8038e fix: improve final redirect (#109) 2023-08-06 16:29:44 -04:00
Ersei Saggi 95776b427b style: fix configPage style (prettier) 2023-08-06 16:27:01 -04:00
Ersei Saggi b82a3867e4 docs: detail Google requiring disabling of OpenID endpoint validation 2023-08-06 16:24:05 -04:00
Ersei Saggi 657f90ef13 fix: make SAML paths better; improve and add OID discovery defaults 2023-08-06 16:19:53 -04:00
Ersei Saggi dd01e729b8 docs: clarify plugin resetting permissions 2023-08-06 14:47:56 -04:00
Ersei Saggi f2452103bf style: fix README.md style 2023-08-06 14:44:23 -04:00
Ersei Saggi 076cb1b893 docs: document how to set login disclaimer (#16) 2023-08-06 14:43:09 -04:00
Ersei Saggi defab9c4e8 feat: clarify redirect paths (#84) 2023-08-06 14:32:05 -04:00
Ersei Saggi 2ead846ed8 fix: Remove funding 2023-08-05 18:58:04 -04:00
Ersei Saggi 8b755361b4 feat: 3.5.0.0 2023-08-05 18:51:31 -04:00
Ersei Saggi 340eb2c6c3 feat: add flakes, fix prettier 2023-08-05 18:48:33 -04:00
Ersei Saggi 08d24ba0db fix: try to fix prettier action 2023-08-05 18:26:46 -04:00
Ersei Saggi 0d19a3376f feat: Allow Live TV management 2023-08-05 18:04:28 -04:00
Ersei Saggi 1de72effca fix: Check for Roles being null in configuration for openid 2023-08-05 17:31:06 -04:00
Adam Zvolanek 698fbce81b add authentik redirect uri step (#127)
So users do not have to analyze the code for this line https://github.com/9p4/jellyfin-plugin-sso/blob/c6cac45004a32a7d8cf5863102ef947f792ed021/SSO-Auth/Api/SSOController.cs#L67
2023-07-10 12:35:22 -04:00
Esmond c6cac45004 fix: error in logs for #81 (#100) 2023-01-01 16:21:58 -05:00
Esmond dfd519ae9d fix: null check before trim() (#99)
* null check before trim()

* fix: #97 null check before trim()

* fix: apply null check to all trims
2022-11-06 21:53:55 -05:00
9p4 40120dd127 fix: #83 Trim whitespace in user provided strings (#89) 2022-11-03 22:42:56 -04:00
9p4 d78e8c88a3 fix: change matthewstrasiotto to strazto 2022-11-03 22:42:21 -04:00
9p4 42b567d018 fix: add contact email to conduct 2022-10-21 00:41:35 -04:00
9p4 5bedf010b7 docs: add contributing, fix linting on conduct 2022-10-21 00:39:06 -04:00
9p4 05fabf97fc docs: add code of conduct 2022-10-21 00:29:29 -04:00
9p4 ae063abea4 Create config.yml 2022-09-25 18:19:10 -04:00
9p4 fa46806dc5 feat: allow for HTTPS to be disabled in OpenID discovery (#77)
* feat: allow for HTTPS to be disabled in OpenID discovery (#76)
2022-09-09 10:19:48 -04:00
9p4 98ddb9e352 Merge pull request #74 from 9p4/custom-username-claim
feat: allow configuration of preferred username claim
2022-08-23 21:12:59 -04:00
9p4 46eb00bf43 Merge branch 'main' into custom-username-claim 2022-08-23 19:50:01 -04:00
9p4 5723cd718d ci: change commit linter 2022-08-23 19:48:41 -04:00
9p4 96b14f7a5a ci: run commit name lint on every push and pr 2022-08-23 19:42:56 -04:00
9p4 320551bc18 ci: update hash for commit lint action 2022-08-23 19:39:47 -04:00
Sambhav Saggi 9f8626bdf7 Merge branch 'custom-username-claim' of https://github.com/9p4/jellyfin-plugin-sso into custom-username-claim 2022-08-23 19:38:21 -04:00
Sambhav Saggi d5925fc1de docs: add custom username claim api doc 2022-08-23 19:38:01 -04:00
9p4 facf45058f Merge branch 'main' into custom-username-claim 2022-08-23 19:32:16 -04:00
9p4 f3d0497801 ci: lint commits 2022-08-23 19:31:02 -04:00
Sambhav Saggi 672fce8189 fix: prevent null passwords when fallback is set to default provider 2022-08-23 19:22:02 -04:00
Sambhav Saggi c2f50e1e4c style: run prettier 2022-08-23 18:57:57 -04:00
Sambhav Saggi a90e0359e4 feat: add config page for preferred username config 2022-08-23 18:26:58 -04:00
Sambhav Saggi 332f62d76e feat: allow configuration of preferred username claim (#47) 2022-08-23 18:18:42 -04:00
9p4 47db5cb504 Merge pull request #71 from fredriklindberg/improve-get-request-base
fix: don't include port in redirect URL for 80 and 443
2022-08-23 18:12:19 -04:00
Matthew Strasiotto fe1fdad0b0 Merge pull request #72 from fredriklindberg/make-user-creation-more-robust 2022-08-20 21:07:53 +10:00
Fredrik Lindberg d06f680407 fix: make user creation more robust
Reverse logic of CreateCanonicalLinkAndUserIfNotExist() to first check if the user exists,
then create the canonical link. This allows seamless re-creation of users through SSO after
they have been deleted from Jellyfin but not properly de-linked.
2022-08-18 17:55:41 +02:00
Fredrik Lindberg 976a816d8c fix: don't include port in redirect URL for 80 and 443
Skip port number in redirect URLs during the following conditions
 - The request scheme is http and request port is 80
 - The request scheme is https and request port is 443

This creates redirect urls as https://server/path instead of https://server:443/path
2022-08-18 17:48:37 +02:00
Matthew Strasiotto f7ce40fe5e Merge pull request #69 from matthewstrasiotto/main
ci: 📌 change from shogo82148/actions-upload-release-asset to softprops/action-gh-release
2022-08-18 19:09:45 +10:00
Matthew Strasiotto 8666818dfa ci: 📌 change from shogo82148/actions-upload-release-asset to softprops/action-gh-release 2022-08-18 19:09:12 +10:00
Matthew Strasiotto c5e6bf96f9 Merge pull request #68 from matthewstrasiotto/main
ci: 👷 keep our own build workflow and reference that in publish.yml
2022-08-18 18:42:39 +10:00
Matthew Strasiotto fd59b83a0e ci: 👷 keep our own build workflow and reference that in publish.yml
Squash of
- ci: 👷 keep our own build workflow and reference that in publish.yml
- ci: 📌 pin actions/checkout,setup-dotnet odstr13/jellyfin-plugin-repo-manager to approved version

This will still fail because actions/upload-artifact isnt approved.

Getting kind of tilted trying to contribute to ci when the upstream CI settings fight me at every turn
2022-08-18 18:41:16 +10:00
22 changed files with 899 additions and 159 deletions
-13
View File
@@ -1,13 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: a055
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+4
View File
@@ -0,0 +1,4 @@
contact_links:
- name: Question
url: https://github.com/9p4/jellyfin-plugin-sso/discussions
about: Please ask and answer questions here.
+39
View File
@@ -0,0 +1,39 @@
on:
workflow_call:
inputs:
dotnet-version:
required: false
default: "6.0.x"
description: "The .NET version to setup for the build"
type: string
dotnet-target:
required: false
default: "net6.0"
description: "The .NET target to set for JPRM"
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "${{ inputs.dotnet-version }}"
- name: Build Jellyfin Plugin
uses: oddstr13/jellyfin-plugin-repository-manager@b9e92867a6aa279d611a5ea80cf61f6358838c39
id: jprm
with:
dotnet-target: "${{ inputs.dotnet-target }}"
- name: Upload Artifact
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3
with:
name: build-artifact
retention-days: 30
if-no-files-found: error
path: ${{ steps.jprm.outputs.artifact }}
+5 -2
View File
@@ -12,9 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
- name: Prettify code
uses: creyD/prettier_action@v4.2
uses: creyD/prettier_action@v4.3
with:
dry: True
prettier_options: '--check **/*.{js,html,md,css,scss}'
+10 -5
View File
@@ -8,7 +8,7 @@ on:
jobs:
build:
uses: jellyfin/jellyfin-meta-plugins/.github/workflows/build.yaml@30fd723cc3bafc4457a4a85be3cdbee2f3e2013b
uses: ./.github/workflows/build.yml
with:
dotnet-version: "6.0.*"
dotnet-target: "net6.0"
@@ -28,11 +28,16 @@ jobs:
sha256sum ${file#./} >> ${file%.*}.sha256
done
ls -l
- name: Upload GitHub Release assets
uses: shogo82148/[email protected]
- name: Publish output artifacts
id: publish-assets
uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./*
prerelease: false
fail_on_unmatched_files: true
tag_name: ${{ github.event.release.tag_name }}
files: ./*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
generate:
runs-on: ubuntu-latest
needs:
+76
View File
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [[email protected]](mailto:[email protected]). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
+181
View File
@@ -0,0 +1,181 @@
<!-- omit in toc -->
# Contributing to Jellyfin SSO Plugin
First off, thanks for taking the time to contribute! ❤️
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
>
> - Star the project
> - Tweet about it
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues
<!-- omit in toc -->
## Table of Contents
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)
- [Join The Project Team](#join-the-project-team)
## I Have a Question
> If you want to ask a question, we assume that you have read the available [Documentation](https://github.com/9p4/jellyfin-plugin-sso/blob/main/README.md).
Before you ask a question, it is best to search for existing [Issues](https://github.com/9p4/jellyfin-plugin-sso/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
If you then still feel the need to ask a question and need clarification, we recommend the following:
- Open an [Issue](https://github.com/9p4/jellyfin-plugin-sso/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
We will then take care of the issue as soon as possible.
<!--
You might want to create a separate issue tag for questions and include it in this description. People should then tag their issues accordingly.
Depending on how large the project is, you may want to outsource the questioning, e.g. to Stack Overflow or Gitter. You may add additional contact and information possibilities:
- IRC
- Slack
- Gitter
- Stack Overflow tag
- Blog
- FAQ
- Roadmap
- E-Mail List
- Forum
-->
## I Want To Contribute
> ### Legal Notice <!-- omit in toc -->
>
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
### Reporting Bugs
<!-- omit in toc -->
#### Before Submitting a Bug Report
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://github.com/9p4/jellyfin-plugin-sso/blob/main/README.md). If you are looking for support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/9p4/jellyfin-plugin-ssoissues?q=label%3Abug).
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
- Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?
<!-- omit in toc -->
#### How Do I Submit a Good Bug Report?
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <[email protected]>.
<!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
- Open an [Issue](https://github.com/9p4/jellyfin-plugin-sso/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.
Once it's filed:
- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
<!-- You might want to create an issue template for bugs and errors that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
### Suggesting Enhancements
This section guides you through submitting an enhancement suggestion for Jellyfin SSO Plugin, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
<!-- omit in toc -->
#### Before Submitting an Enhancement
- Make sure that you are using the latest version.
- Read the [documentation](https://github.com/9p4/jellyfin-plugin-sso/blob/main/README.md) carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/9p4/jellyfin-plugin-sso/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
<!-- omit in toc -->
#### How Do I Submit a Good Enhancement Suggestion?
Enhancement suggestions are tracked as [GitHub issues](https://github.com/9p4/jellyfin-plugin-sso/issues).
- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. <!-- this should only be included if the project has a GUI -->
- **Explain why this enhancement would be useful** to most Jellyfin SSO Plugin users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
<!-- You might want to create an issue template for enhancement suggestions that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
### Your First Code Contribution
<!-- TODO
include Setup of env, IDE and typical getting started instructions?
-->
The project is built with .NET 6. Download it from [here](https://dotnet.microsoft.com/en-us/download).
Any code editor or IDE with .NET support will work out of the box with this program.
(Some) editors:
- [VSCode](https://code.visualstudio.com/docs/languages/dotnet)
- [N/Vim](https://github.com/OmniSharp/Omnisharp-vim)
### Improving The Documentation
<!-- TODO
Updating, improving and correcting the documentation
-->
We are always open to better docs! The main place documentation could be improved is the [providers](https://github.com/9p4/jellyfin-plugin-sso/blob/main/providers.md) documentation. This file keeps track of configurations that are known to work with common SSO providers.
## Styleguides
### Commit Messages
We use [commitlint](https://commitlint.js.org) for linting commit messages.
### C#
We format all C# code according to the .NET formatter. Run `dotnet build .` and fix any warnings that come up.
### HTML/CSS/JS/Markdown
We use [Prettier](https://prettier.io) to format these files.
<!-- TODO
-->
<!-- omit in toc -->
## Attribution
This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)!
+60 -15
View File
@@ -32,7 +32,7 @@ Existing users may link new SSO accounts, or remove existing links using self-se
This is 100% alpha software! PRs are welcome to improve the code.
~~There is NO admin configuration! You must use the API to configure the program!~~ Added by [matthewstrasiotto](https://github.com/matthewstrasiotto) in PR [#18](https://github.com/9p4/jellyfin-plugin-sso/pull/18) and [#27](https://github.com/9p4/jellyfin-plugin-sso/pull/27).
~~There is NO admin configuration! You must use the API to configure the program!~~ Added by [strazto](https://github.com/strazto) in PR [#18](https://github.com/9p4/jellyfin-plugin-sso/pull/18) and [#27](https://github.com/9p4/jellyfin-plugin-sso/pull/27).
**[This is for Jellyfin 10.8](https://github.com/9p4/jellyfin-plugin-sso/issues/3) and only on the Web UI!**
@@ -91,6 +91,35 @@ The nightly build may have new features unavailable in other builds, but **be wa
## Examples
### Creating A Login Button On The Main Page
In the Jellyfin administration UI, under "General", there is a "Branding" section. In that section, add the following code in the "Login disclaimer" block (replacing `PROVIDER_NAME` and the domain):
```html
<a
href="https://jellyfin.example.com/sso/OID/start/PROVIDER_NAME"
class="raised cancel block emby-button"
>Sign in with SSO</a
>
```
Then, add the following code in the "Custom CSS code" section:
```css
a.raised.emby-button {
padding: 0.9em 1em;
color: inherit !important;
}
.disclaimerContainer {
display: block;
}
```
![screenshot of the configuration page with the same code](img/custom-button.png)
For more information, refer to [issue #16](https://github.com/9p4/jellyfin-plugin-sso/issues/16).
### SAML
Example for adding a SAML configuration with the API using [curl](https://curl.se/):
@@ -104,9 +133,9 @@ The SAML provider must have the following configuration (I am using Keycloak, an
- Sign Documents on
- Sign Assertions off
- Client Signature Required off
- Redirect URI: [https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME](https://myjellyfin.example.com/sso/OID/p/PROVIDER_NAME)
- Redirect URI: [https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME)
- Base URL: [https://myjellyfin.example.com](https://myjellyfin.example.com)
- Master SAML processing URL: [https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME)
- Master SAML processing URL: [https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME)
Make sure that `clientid` is replaced with the actual client ID and `PROVIDER_NAME` is replaced with the chosen provider name!
@@ -120,7 +149,7 @@ The OpenID provider must have the following configuration (again, I am using Key
- Access Type: Confidential
- Standard Flow Enabled
- Redirect URI: [https://myjellyfin.example.com/sso/OID/r/PROVIDER_NAME](https://myjellyfin.example.com/sso/OID/r/PROVIDER_NAME)
- Redirect URI: [https://myjellyfin.example.com/sso/OID/redirect/PROVIDER_NAME](https://myjellyfin.example.com/sso/OID/redirect/PROVIDER_NAME)
- Base URL: [https://myjellyfin.example.com](https://myjellyfin.example.com)
Make sure that `clientid` is replaced with the actual client ID and `PROVIDER_NAME` is replaced with the chosen provider name!
@@ -133,8 +162,8 @@ The API is all done from a base URL of `/sso/`
#### Flow
- POST `SAML/p/PROVIDER_NAME`: This is the SAML POST endpoint. It accepts a form response from the SAML provider and returns HTML and JavaScript for the client to login with a given provider name.
- GET `SAML/p/PROVIDER_NAME`: This is the SAML initiator: it will begin the authorization flow for SAML with a given provider name.
- POST `SAML/start/PROVIDER_NAME`: This is the SAML POST endpoint. It accepts a form response from the SAML provider and returns HTML and JavaScript for the client to login with a given provider name.
- GET `SAML/start/PROVIDER_NAME`: This is the SAML initiator: it will begin the authorization flow for SAML with a given provider name.
- POST `SAML/Auth/PROVIDER_NAME`: This is the SAML client-side API: the HTML and JavaScript client will call this endpoint to receive Jellyfin credentials given a provider name. Post format is in JSON with the following keys:
- `deviceId`: string. Device ID.
- `deviceName`: string. Device name.
@@ -158,6 +187,11 @@ These all require authorization. Append an API key to the end of the request: `c
- `adminRoles`: array of strings. This uses SAML response's `Role` attributes. If a user has any of these roles, then the user is an admin. Leave blank to disable (default is to not enable admin permissions).
- `enableFolderRoles`: boolean. Determines if role-based folder access should be used.
- `folderRoleMapping`: object in the format "role": string and "folders": array of strings. The user with this role will have access to the following folders if `enableFolderRoles` is enabled. To get the IDs of the folders, GET the `/Library/MediaFolders` URL with an API key. Look for the `Id` attribute.
- `enableLiveTvRoles`: boolean. Determines if role-based Live TV access should be used.
- `liveTvRoles`: array of strings. If `enableLiveTvRoles` is enabled, then the user's roles will be checked against these. If the user is granted permission, then the user will be able to view Live TV.
- `liveTvManagementRoles`: array of strings. If `enableLiveTvRoles` is enabled, then the user's roles will be checked against these. If the user is granted permission, then the user will be able to manage Live TV.
- `enableLiveTv`: boolean. Whether to allow Live TV by default. This applies even if `enableLiveTvRoles` is enabled.
- `enableLiveTvManagement`: boolean. Whether to allow Live TV management by default. This applies even if `enableLiveTvRoles` is enabled.
- `defaultProvider`: string. The set provider then gets assigned to the user after they have logged in. If it is not set, nothing is changed. With this, a user can login with SSO but is still able to log in via other providers later. See the `Unregister` endpoint.
- GET `SAML/Del/PROVIDER_NAME`: This removes a configuration for SAML for a given provider name.
- GET `SAML/Get`: Lists the configurations currently available.
@@ -166,8 +200,8 @@ These all require authorization. Append an API key to the end of the request: `c
#### Flow
- GET `OID/r/PROVIDER_NAME`: This is the OpenID callback path. This will return HTML and JavaScript for the client to login with a given provider name.
- GET `OID/p/PROVIDER_NAME`: This is the OpenID initiator: it will begin the authorization flow for OpenID with a given provider name.
- GET `OID/redirect/PROVIDER_NAME`: This is the OpenID callback path. This will return HTML and JavaScript for the client to login with a given provider name.
- GET `OID/start/PROVIDER_NAME`: This is the OpenID initiator: it will begin the authorization flow for OpenID with a given provider name.
- POST `OID/Auth/PROVIDER_NAME`: This is the OpenID client-side API: the HTML and JavaScript client will call this endpoint to receive Jellyfin credentials for a given provider name. Post format is in JSON with the following keys:
- `deviceId`: string. Device ID.
- `deviceName`: string. Device name.
@@ -191,11 +225,20 @@ These all require authorization. Append an API key to the end of the request: `c
- `adminRoles`: array of strings. This uses the OpenID response against the claim set in `roleClaim`. If a user has any of these roles, then the user is an admin. Leave blank to disable (default is to not enable admin permissions).
- `enableFolderRoles`: boolean. Determines if role-based folder access should be used.
- `folderRoleMapping`: object in the format "role": string and "folders": array of strings. The user with this role will have access to the following folders if `enableFolderRoles` is enabled. To get the IDs of the folders, GET the `/Library/MediaFolders` URL with an API key. Look for the `Id` attribute.
- `enableLiveTvRoles`: boolean. Determines if role-based Live TV access should be used.
- `liveTvRoles`: array of strings. If `enableLiveTvRoles` is enabled, then the user's roles will be checked against these. If the user is granted permission, then the user will be able to view Live TV.
- `liveTvManagementRoles`: array of strings. If `enableLiveTvRoles` is enabled, then the user's roles will be checked against these. If the user is granted permission, then the user will be able to manage Live TV.
- `enableLiveTv`: boolean. Whether to allow Live TV by default. This applies even if `enableLiveTvRoles` is enabled.
- `enableLiveTvManagement`: boolean. Whether to allow Live TV management by default. This applies even if `enableLiveTvRoles` is enabled.
- `roleClaim`: string. This is the value in the OpenID response to check for roles. For Keycloak, it is `realm_access.roles` by default. The first element is the claim type, the subsequent values are to parse the JSON of the claim value. Use a "\\." to denote a literal ".". This expects a list of strings from the OIDC server.
- `oidScopes` : array of strings. each containing an additional scope name to include in the OIDC request.
- `oidScopes` : array of strings. Each contains an additional scope name to include in the OIDC request.
- For some OIDC providers (For example, [authelia](https://github.com/9p4/jellyfin-plugin-sso/issues/23#issuecomment-1112237616)), additional scopes may be required in order to validate group membership in role claim.
- Leave empty to only request the default scopes.
- `defaultProvider`: string. The set provider then gets assigned to the user after they have logged in. If it is not set, nothing is changed. With this, a user can login with SSO but is still able to log in via other providers later. See the `Unregister` endpoint.
- `defaultUsernameClaim`: string. The provider will use the claim to create the users' usernames. If not set, it fallbacks to `preferred_username`.
- `disableHttps`: boolean. Determines whether the OpenID discovery endpoint requires HTTPS.
- `doNotValidateEndpoints`: boolean. Determines whether the OpenID discovery process will validate endpoints. This may be required for Google.
- `doNotValidateIssuerName`: boolean. Determines whether the OpenID discovery process will validate the OpenID issuer name.
- GET `OID/Del/PROVIDER_NAME`: This removes a configuration for OpenID for a given provider name.
- GET `OID/Get`: Lists the configurations currently available.
- GET `OID/States`: Lists currently active OpenID flows in progress.
@@ -206,13 +249,15 @@ These all require authorization. Append an API key to the end of the request: `c
## Limitations
There is no GUI to sign in. You have to make it yourself! The buttons should redirect to something like this: [https://myjellyfin.example.com/sso/SAML/p/clientid](https://myjellyfin.example.com/sso/SAML/p/clientid) replacing `clientid` with the provider client ID and `SAML` with the auth scheme (either `SAML` or `OID`).
Logging in with an SSO account that has the same username as an existing Jellyfin account will override the permissions for the user. Use caution when overriding the administrator account!
~~Furthermore, there is no functional admin page (yet). PRs for this are welcome. In the meantime, you have to interact with the API to add or remove configurations.~~ Added by [matthewstrasiotto](https://github.com/matthewstrasiotto) in PR [#18](https://github.com/9p4/jellyfin-plugin-sso/pull/18) and [#27](https://github.com/9p4/jellyfin-plugin-sso/pull/27).
~~There is no GUI to sign in. You have to make it yourself! The buttons should redirect to something like this: [https://myjellyfin.example.com/sso/SAML/start/clientid](https://myjellyfin.example.com/sso/SAML/start/clientid) replacing `clientid` with the provider client ID and `SAML` with the auth scheme (either `SAML` or `OID`).~~
~~Furthermore, there is no functional admin page (yet). PRs for this are welcome. In the meantime, you have to interact with the API to add or remove configurations.~~ Added by [strazto](https://github.com/strazto) in PR [#18](https://github.com/9p4/jellyfin-plugin-sso/pull/18) and [#27](https://github.com/9p4/jellyfin-plugin-sso/pull/27).
There is also no logout callback. Logging out of Jellyfin will log you out of Jellyfin only, instead of the SSO provider as well.
~~This only supports Jellyfin on it's own domain (for now). This is because I'm using string concatenation for generating some URLs. A PR is welcome to patch this.~~ Fixed in [PR #1](https://github.com/9p4/jellyfin-plugin-sso/pull/1).
~~This only supports Jellyfin on its own domain (for now). This is because I'm using string concatenation for generating some URLs. A PR is welcome to patch this.~~ Fixed in [PR #1](https://github.com/9p4/jellyfin-plugin-sso/pull/1).
**This only works on the web UI**. ~~The user must open the Jellyfin web UI BEFORE using the SSO program to populate some values in the localStorage.~~ Fixed by implementing a comment by [Pfuenzle](https://github.com/Pfuenzle) in [Issue #5](https://github.com/9p4/jellyfin-plugin-sso/issues/5#issuecomment-1041864820).
@@ -224,14 +269,14 @@ This is built with .NET 6.0. Build with `dotnet publish .` for the debug release
### VSCode Workflow
An example `.vscode` configuration may be found at [matthewstrasiotto/jellyfin-plugin-sso-vscode](https://github.com/matthewstrasiotto/jellyfin-plugin-sso-vscode).
An example `.vscode` configuration may be found at [strazto/jellyfin-plugin-sso-vscode](https://github.com/strazto/jellyfin-plugin-sso-vscode).
From the root of this repo, you may clone that to `.vscode`
```bash
# From repo root
git clone https://github.com/matthewstrasiotto/jellyfin-plugin-sso-vscode .vscode
git clone https://github.com/strazto/jellyfin-plugin-sso-vscode .vscode
```
## Releasing
@@ -248,7 +293,7 @@ Anything tagged/released as a formal Github release will also be built and publi
If you wish to use releases from your own fork, refer to
[Installing](#installing), however, you will need to change the url to the
manifest file, https://raw.githubusercontent.com/9p4/jellyfin-plugin-sso/manifest-release/manifest.json
manifest file, `https://raw.githubusercontent.com/9p4/jellyfin-plugin-sso/manifest-release/manifest.json`
so that it refers to your fork.
## Credits and Thanks
+202 -82
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using IdentityModel.OidcClient;
@@ -13,6 +14,7 @@ using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Cryptography;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -34,6 +36,7 @@ public class SSOController : ControllerBase
private readonly ISessionManager _sessionManager;
private readonly IAuthorizationContext _authContext;
private readonly ILogger<SSOController> _logger;
private readonly ICryptoProvider _cryptoProvider;
private static readonly IDictionary<string, TimedAuthorizeState> StateManager = new Dictionary<string, TimedAuthorizeState>();
/// <summary>
@@ -43,11 +46,13 @@ public class SSOController : ControllerBase
/// <param name="sessionManager">Instance of the <see cref="ISessionManager"/> interface.</param>
/// <param name="authContext">Instance of the <see cref="IAuthorizationContext"/> interface.</param>
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
public SSOController(ILogger<SSOController> logger, ISessionManager sessionManager, IUserManager userManager, IAuthorizationContext authContext)
/// <param name="cryptoProvider">Instance of the <see cref="ICryptoProvider"/> interface.</param>
public SSOController(ILogger<SSOController> logger, ISessionManager sessionManager, IUserManager userManager, IAuthorizationContext authContext, ICryptoProvider cryptoProvider)
{
_sessionManager = sessionManager;
_userManager = userManager;
_authContext = authContext;
_cryptoProvider = cryptoProvider;
_logger = logger;
_logger.LogInformation("SSO Controller initialized");
}
@@ -60,7 +65,8 @@ public class SSOController : ControllerBase
/// <returns>A webpage that will complete the client-side flow.</returns>
// Actually a GET: https://github.com/IdentityModel/IdentityModel.OidcClient/issues/325
[HttpGet("OID/r/{provider}")]
public ActionResult OidPost(
[HttpGet("OID/redirect/{provider}")]
public async Task<ActionResult> OidPost(
[FromRoute] string provider,
[FromQuery] string state) // Although this is a GET function, this function is called `Post` for consistency with SAML
{
@@ -78,16 +84,18 @@ public class SSOController : ControllerBase
{
var options = new OidcClientOptions
{
Authority = config.OidEndpoint,
ClientId = config.OidClientId,
ClientSecret = config.OidSecret,
RedirectUri = GetRequestBase() + "/sso/OID/r/" + provider,
Authority = config.OidEndpoint?.Trim(),
ClientId = config.OidClientId?.Trim(),
ClientSecret = config.OidSecret?.Trim(),
RedirectUri = GetRequestBase() + $"/sso/OID/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "redirect" : "r")}/" + provider,
Scope = string.Join(" ", config.OidScopes.Prepend("openid profile")),
};
options.Policy.Discovery.ValidateEndpoints = false; // For Google and other providers with different endpoints
options.Policy.Discovery.ValidateEndpoints = !config.DoNotValidateEndpoints; // For Google and other providers with different endpoints
options.Policy.Discovery.RequireHttps = !config.DisableHttps;
options.Policy.Discovery.ValidateIssuerName = !config.DoNotValidateIssuerName;
var oidcClient = new OidcClient(options);
var currentState = StateManager[state].State;
var result = oidcClient.ProcessResponseAsync(Request.QueryString.Value, currentState).Result;
var result = await oidcClient.ProcessResponseAsync(Request.QueryString.Value, currentState).ConfigureAwait(false);
if (result.IsError)
{
return ReturnError(StatusCodes.Status400BadRequest, result.Error + " Try logging in again.");
@@ -102,12 +110,15 @@ public class SSOController : ControllerBase
StateManager[state].Folders = new List<string>();
}
StateManager[state].EnableLiveTv = config.EnableLiveTv;
StateManager[state].EnableLiveTvManagement = config.EnableLiveTvManagement;
foreach (var claim in result.User.Claims)
{
if (claim.Type == "preferred_username")
if (claim.Type == (config.DefaultUsernameClaim?.Trim() ?? "preferred_username"))
{
StateManager[state].Username = claim.Value;
if (config.Roles.Length == 0)
if (config.Roles == null || config.Roles.Length == 0)
{
StateManager[state].Valid = true;
}
@@ -116,69 +127,97 @@ public class SSOController : ControllerBase
// Role processing
// The regex matches any "." not preceded by a "\": a.b.c will be split into a, b, and c, but a.b\.c will be split into a, b.c (after processing the escaped dots)
// We have to first process the RoleClaim string
string[] segments = Regex.Split(config.RoleClaim, "(?<!\\\\)\\.");
// Now we make sure that any escaped "."s ("\.") are replaced with "."
for (int i = 0; i < segments.Length; i++)
{
segments[i] = segments[i].Replace("\\.", ".");
}
string[] segments = string.IsNullOrEmpty(config.RoleClaim) ? Array.Empty<string>() : Regex.Split(config.RoleClaim.Trim(), "(?<!\\\\)\\.");
if (claim.Type == segments[0])
if (segments.Any())
{
List<string> roles;
// If we are not using JSON values, just use the raw info from the claim value
if (segments.Length == 1)
// Now we make sure that any escaped "."s ("\.") are replaced with "."
segments = segments.Select(i => i.Replace("\\.", ".")).ToArray();
if (claim.Type == segments[0])
{
roles = new List<string> { claim.Value };
}
else
{
// We recursively traverse through the JSON data for the roles and parse it
var json = JsonConvert.DeserializeObject<IDictionary<string, object>>(claim.Value);
for (int i = 1; i < segments.Length - 1; i++)
List<string> roles;
// If we are not using JSON values, just use the raw info from the claim value
if (segments.Length == 1)
{
var segment = segments[i];
json = (json[segment] as JObject).ToObject<IDictionary<string, object>>();
roles = new List<string> { claim.Value };
}
else
{
// We recursively traverse through the JSON data for the roles and parse it
var json = JsonConvert.DeserializeObject<IDictionary<string, object>>(claim.Value);
for (int i = 1; i < segments.Length - 1; i++)
{
var segment = segments[i];
json = (json[segment] as JObject).ToObject<IDictionary<string, object>>();
}
// The final step is to take the JSON and turn it from a dictionary into a string
roles = (json[segments[^1]] as JArray).ToObject<List<string>>();
}
// The final step is to take the JSON and turn it from a dictionary into a string
roles = (json[segments[^1]] as JArray).ToObject<List<string>>();
}
foreach (string role in roles)
{
// Check if allowed to login based on roles
if (config.Roles.Length != 0)
foreach (string role in roles)
{
foreach (string validRoles in config.Roles)
// Check if allowed to login based on roles
if (config.Roles != null && config.Roles.Any())
{
if (role.Equals(validRoles))
foreach (string validRoles in config.Roles)
{
StateManager[state].Valid = true;
if (role.Equals(validRoles))
{
StateManager[state].Valid = true;
}
}
}
}
// Check if admin based on roles
if (config.AdminRoles.Length != 0)
{
foreach (string validAdminRoles in config.AdminRoles)
// Check if admin based on roles
if (config.AdminRoles != null && config.AdminRoles.Any())
{
if (role.Equals(validAdminRoles))
foreach (string validAdminRoles in config.AdminRoles)
{
StateManager[state].Admin = true;
if (role.Equals(validAdminRoles))
{
StateManager[state].Admin = true;
}
}
}
}
// Get allowed folders from roles
if (config.EnableFolderRoles)
{
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
// Get allowed folders from roles
if (config.EnableFolderRoles)
{
if (role.Equals(folderRoleMap.Role))
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
{
StateManager[state].Folders.AddRange(folderRoleMap.Folders);
if (role.Equals(folderRoleMap.Role?.Trim()))
{
StateManager[state].Folders.AddRange(folderRoleMap.Folders);
}
}
}
if (config.EnableLiveTvRoles)
{
// Check if allowed Live TV based on roles
if (config.LiveTvRoles != null && config.LiveTvRoles.Any())
{
foreach (string validLiveTvRoles in config.LiveTvRoles)
{
if (role.Equals(validLiveTvRoles))
{
StateManager[state].EnableLiveTv = true;
}
}
}
// Check if allowed Live TV management based on roles
if (config.LiveTvManagementRoles != null && config.LiveTvManagementRoles.Any())
{
foreach (string validLiveTvManagementRoles in config.LiveTvManagementRoles)
{
if (role.Equals(validLiveTvManagementRoles))
{
StateManager[state].EnableLiveTvManagement = true;
}
}
}
}
}
@@ -186,7 +225,7 @@ public class SSOController : ControllerBase
}
}
// If the provider doesn't support preferred_username, then use sub
// If the provider doesn't support the preferred username claim, then use the sub claim
if (!StateManager[state].Valid)
{
foreach (var claim in result.User.Claims)
@@ -232,6 +271,7 @@ public class SSOController : ControllerBase
/// <param name="isLinking">Whether or not this request is to link accounts (Rather than authenticate).</param>
/// <returns>An asynchronous result for the authentication.</returns>
[HttpGet("OID/p/{provider}")]
[HttpGet("OID/start/{provider}")]
public async Task<ActionResult> OidChallenge(string provider, [FromQuery] bool isLinking = false)
{
Invalidate();
@@ -249,10 +289,10 @@ public class SSOController : ControllerBase
{
var options = new OidcClientOptions
{
Authority = config.OidEndpoint,
ClientId = config.OidClientId,
ClientSecret = config.OidSecret,
RedirectUri = GetRequestBase() + "/sso/OID/r/" + provider,
Authority = config.OidEndpoint?.Trim(),
ClientId = config.OidClientId?.Trim(),
ClientSecret = config.OidSecret?.Trim(),
RedirectUri = GetRequestBase() + $"/sso/OID/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "redirect" : "r")}/" + provider,
Scope = string.Join(" ", config.OidScopes.Prepend("openid profile")),
};
options.Policy.Discovery.ValidateEndpoints = false; // For Google and other providers with different endpoints
@@ -366,7 +406,7 @@ public class SSOController : ControllerBase
{
Guid userId = await CreateCanonicalLinkAndUserIfNotExist("oid", provider, kvp.Value.Username);
var authenticationResult = await Authenticate(userId, kvp.Value.Admin, config.EnableAuthorization, config.EnableAllFolders, kvp.Value.Folders.ToArray(), response, config.DefaultProvider)
var authenticationResult = await Authenticate(userId, kvp.Value.Admin, config.EnableAuthorization, config.EnableAllFolders, kvp.Value.Folders.ToArray(), kvp.Value.EnableLiveTv, kvp.Value.EnableLiveTvManagement, response, config.DefaultProvider?.Trim())
.ConfigureAwait(false);
return Ok(authenticationResult);
}
@@ -386,6 +426,7 @@ public class SSOController : ControllerBase
/// </param>
/// <returns>A webpage that will complete the client-side flow.</returns>
[HttpPost("SAML/p/{provider}")]
[HttpPost("SAML/post/{provider}")]
public ActionResult SamlPost(string provider, [FromQuery] string relayState = null)
{
SamlConfig config;
@@ -407,10 +448,12 @@ public class SSOController : ControllerBase
{
var samlResponse = new Response(config.SamlCertificate, Request.Form["SAMLResponse"]);
bool valid = false;
// If no roles are configured, don't use RBAC
if (config.Roles.Length == 0)
{
return Content(WebResponse.Generator(data: Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(samlResponse.Xml)), provider: provider, baseUrl: GetRequestBase(), mode: "SAML", isLinking: isLinking), MediaTypeNames.Text.Html);
valid = true;
}
// Check if user is allowed to log in based on roles
@@ -420,11 +463,23 @@ public class SSOController : ControllerBase
{
if (allowedRole.Equals(role))
{
return Content(WebResponse.Generator(data: Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(samlResponse.Xml)), provider: provider, baseUrl: GetRequestBase(), mode: "SAML", isLinking: isLinking), MediaTypeNames.Text.Html);
valid = true;
}
}
}
if (valid)
{
return Content(
WebResponse.Generator(
data: Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(samlResponse.Xml)),
provider: provider,
baseUrl: GetRequestBase(),
mode: "SAML",
isLinking: isLinking),
MediaTypeNames.Text.Html);
}
_logger.LogWarning(
"SAML user: {UserId} has insufficient roles: {@Roles}. Expected any one of: {@ExpectedRoles}",
samlResponse.GetNameID(),
@@ -443,6 +498,7 @@ public class SSOController : ControllerBase
/// <param name="isLinking">Whether this flow intends to link an account, or initiate auth.</param>
/// <returns>A redirect to the SAML provider's auth page.</returns>
[HttpGet("SAML/p/{provider}")]
[HttpGet("SAML/start/{provider}")]
public RedirectResult SamlChallenge(string provider, [FromQuery] bool isLinking = false)
{
SamlConfig config;
@@ -464,10 +520,10 @@ public class SSOController : ControllerBase
}
var request = new AuthRequest(
config.SamlClientId,
GetRequestBase() + "/sso/SAML/p/" + provider);
config.SamlClientId.Trim(),
GetRequestBase() + $"/sso/SAML/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "post" : "p")}/" + provider);
return Redirect(request.GetRedirectUrl(config.SamlEndpoint, relayState));
return Redirect(request.GetRedirectUrl(config.SamlEndpoint.Trim(), relayState));
}
throw new ArgumentException("Provider does not exist");
@@ -539,6 +595,8 @@ public class SSOController : ControllerBase
if (config.Enabled)
{
bool isAdmin = false;
bool liveTv = config.EnableLiveTv;
bool liveTvManagement = config.EnableLiveTvManagement;
var samlResponse = new Response(config.SamlCertificate, response.Data);
List<string> folders;
if (!config.EnableFolderRoles)
@@ -552,11 +610,14 @@ public class SSOController : ControllerBase
foreach (string role in samlResponse.GetCustomAttributes("Role"))
{
foreach (string allowedRole in config.AdminRoles)
if (config.AdminRoles != null)
{
if (allowedRole.Equals(role))
foreach (string allowedRole in config.AdminRoles)
{
isAdmin = true;
if (allowedRole.Equals(role))
{
isAdmin = true;
}
}
}
@@ -570,11 +631,36 @@ public class SSOController : ControllerBase
}
}
}
if (config.EnableLiveTvRoles)
{
if (config.LiveTvRoles != null)
{
foreach (string allowedLiveTvRole in config.LiveTvRoles)
{
if (allowedLiveTvRole.Equals(role))
{
liveTv = true;
}
}
}
if (config.LiveTvManagementRoles != null)
{
foreach (string allowedLiveTvManagementRole in config.LiveTvManagementRoles)
{
if (allowedLiveTvManagementRole.Equals(role))
{
liveTvManagement = true;
}
}
}
}
}
Guid userId = await CreateCanonicalLinkAndUserIfNotExist("saml", provider, samlResponse.GetNameID());
var authenticationResult = await Authenticate(userId, isAdmin, config.EnableAuthorization, config.EnableAllFolders, folders.ToArray(), response, config.DefaultProvider)
var authenticationResult = await Authenticate(userId, isAdmin, config.EnableAuthorization, config.EnableAllFolders, folders.ToArray(), liveTv, liveTvManagement, response, config.DefaultProvider.Trim())
.ConfigureAwait(false);
return Ok(authenticationResult);
}
@@ -624,6 +710,22 @@ public class SSOController : ControllerBase
private async Task<Guid> CreateCanonicalLinkAndUserIfNotExist(string mode, string provider, string canonicalName)
{
User user = null;
user = _userManager.GetUserByName(canonicalName);
if (user == null)
{
_logger.LogInformation($"SSO user {canonicalName} doesn't exist, creating...");
user = await _userManager.CreateUserAsync(canonicalName).ConfigureAwait(false);
user.AuthenticationProviderId = GetType().FullName;
// https://jonathancrozier.com/blog/how-to-generate-a-cryptographically-secure-random-string-in-dot-net-with-c-sharp
user.Password = _cryptoProvider.CreatePasswordHash(Convert.ToBase64String(RandomNumberGenerator.GetBytes(64))).ToString();
// Make sure there aren't any trailing existing links
var links = GetCanonicalLinks(mode, provider);
links.Remove(canonicalName);
UpdateCanonicalLinkConfig(links, mode, provider);
}
Guid userId = Guid.Empty;
try
{
@@ -637,18 +739,7 @@ public class SSOController : ControllerBase
if (userId == Guid.Empty)
{
_logger.LogInformation("SSO user link doesn't exist, creating...");
User user = null;
user = _userManager.GetUserByName(canonicalName);
if (user == null)
{
_logger.LogInformation($"SSO user {canonicalName} doesn't exist, creating...");
user = await _userManager.CreateUserAsync(canonicalName).ConfigureAwait(false);
user.AuthenticationProviderId = GetType().FullName;
}
userId = user.Id;
CreateCanonicalLink(mode, provider, userId, canonicalName);
}
@@ -899,9 +990,11 @@ public class SSOController : ControllerBase
/// <param name="enableAuthorization">Determines whether RBAC is used for this user.</param>
/// <param name="enableAllFolders">Determines whether all folders are enabled.</param>
/// <param name="enabledFolders">Determines which folders should be enabled for this client.</param>
/// <param name="enableLiveTv">Determines whether live TV access is allowed for this user.</param>
/// <param name="enableLiveTvAdmin">Determines whether live TV can be managed by this user.</param>
/// <param name="authResponse">The client information to authenticate the user with.</param>
/// <param name="defaultProvider">The default provider of the user to be set after logging in.</param>
private async Task<AuthenticationResult> Authenticate(Guid userId, bool isAdmin, bool enableAuthorization, bool enableAllFolders, string[] enabledFolders, AuthResponse authResponse, string defaultProvider)
private async Task<AuthenticationResult> Authenticate(Guid userId, bool isAdmin, bool enableAuthorization, bool enableAllFolders, string[] enabledFolders, bool enableLiveTv, bool enableLiveTvAdmin, AuthResponse authResponse, string defaultProvider)
{
User user = _userManager.GetUserById(userId);
if (enableAuthorization)
@@ -914,6 +1007,9 @@ public class SSOController : ControllerBase
}
}
user.SetPermission(PermissionKind.EnableLiveTvAccess, enableLiveTv);
user.SetPermission(PermissionKind.EnableLiveTvManagement, enableLiveTvAdmin);
await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
var authRequest = new AuthenticationRequest();
@@ -948,7 +1044,19 @@ public class SSOController : ControllerBase
private string GetRequestBase()
{
return Request.Scheme + "://" + Request.Host + Request.PathBase;
int requestPort = Request.Host.Port ?? -1;
if ((requestPort == 80 && string.Equals(Request.Scheme, "http", StringComparison.OrdinalIgnoreCase)) || (requestPort == 443 && string.Equals(Request.Scheme, "https", StringComparison.OrdinalIgnoreCase)))
{
requestPort = -1;
}
return new UriBuilder
{
Scheme = Request.Scheme,
Host = Request.Host.Host,
Port = requestPort,
Path = Request.PathBase
}.ToString().TrimEnd('/');
}
private ContentResult ReturnError(int code, string message)
@@ -1009,6 +1117,8 @@ public class TimedAuthorizeState
Valid = false;
Admin = false;
IsLinking = false;
EnableLiveTv = false;
EnableLiveTvManagement = false;
}
/// <summary>
@@ -1046,4 +1156,14 @@ public class TimedAuthorizeState
/// Gets or sets the folders the user is allowed access to.
/// </summary>
public List<string> Folders { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user is allowed to view live TV.
/// </summary>
public bool EnableLiveTv { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user is allowed to manage live TV.
/// </summary>
public bool EnableLiveTvManagement { get; set; }
}
+70
View File
@@ -89,6 +89,31 @@ public class SamlConfig
/// </summary>
public bool EnableFolderRoles { get; set; }
/// <summary>
/// Gets or sets a value indicating whether RBAC is used to manage Live TV access.
/// </summary>
public bool EnableLiveTvRoles { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Live TV is enabled by default.
/// </summary>
public bool EnableLiveTv { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Live TV is allowed to be managed by default.
/// </summary>
public bool EnableLiveTvManagement { get; set; }
/// <summary>
/// Gets or sets the roles that are checked to determine whether the user is allowed to view Live TV.
/// </summary>
public string[] LiveTvRoles { get; set; }
/// <summary>
/// Gets or sets the roles that are checked to determine whether the user is allowed to manage Live TV.
/// </summary>
public string[] LiveTvManagementRoles { get; set; }
/// <summary>
/// Gets or sets which folders map to what roles in RBAC.
/// </summary>
@@ -178,6 +203,31 @@ public class OidConfig
/// </summary>
public bool EnableFolderRoles { get; set; }
/// <summary>
/// Gets or sets a value indicating whether RBAC is used to manage Live TV access.
/// </summary>
public bool EnableLiveTvRoles { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Live TV is enabled by default.
/// </summary>
public bool EnableLiveTv { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Live TV is allowed to be managed by default.
/// </summary>
public bool EnableLiveTvManagement { get; set; }
/// <summary>
/// Gets or sets the roles that are checked to determine whether the user is allowed to view Live TV.
/// </summary>
public string[] LiveTvRoles { get; set; }
/// <summary>
/// Gets or sets the roles that are checked to determine whether the user is allowed to manage Live TV.
/// </summary>
public string[] LiveTvManagementRoles { get; set; }
/// <summary>
/// Gets or sets which folders map to what roles in RBAC.
/// </summary>
@@ -217,6 +267,26 @@ public class OidConfig
}
set => _canonicalLinks = value;
}
/// <summary>
/// Gets or sets the default username claim when creating new accounts.
/// </summary>
public string DefaultUsernameClaim { get; set; }
/// <summary>
/// Gets or sets a value indicating whether HTTPS in the discovery endpoint is required.
/// </summary>
public bool DisableHttps { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the OpenID endpoints are validated.
/// </summary>
public bool DoNotValidateEndpoints { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the OpenID issuer name is validated.
/// </summary>
public bool DoNotValidateIssuerName { get; set; }
}
/// <summary>
+17 -17
View File
@@ -4,7 +4,7 @@ const ssoConfigurationPage = {
ApiClient.getPluginConfiguration(ssoConfigurationPage.pluginUniqueId).then(
(config) => {
ssoConfigurationPage.populateProviders(page, config.OidConfigs);
}
},
);
const folder_container = page.querySelector("#EnabledFolders");
@@ -43,7 +43,7 @@ const ssoConfigurationPage = {
return ApiClient.getJSON(
ApiClient.getUrl("Library/MediaFolders", {
IsHidden: false,
})
}),
).then((folders) => {
ssoConfigurationPage._populateFolders(container, folders);
});
@@ -119,8 +119,8 @@ const ssoConfigurationPage = {
.then(() =>
ssoConfigurationPage.populateEnabledFolders(
enabled_folders,
checklist
)
checklist,
),
);
elem.querySelector(".sso-role-mapping-name").value = mapping["Role"];
@@ -128,7 +128,7 @@ const ssoConfigurationPage = {
.querySelector(".sso-remove-role-mapping")
.addEventListener(
"click",
ssoConfigurationPage.handleRoleMappingRemove
ssoConfigurationPage.handleRoleMappingRemove,
);
return elem;
@@ -168,11 +168,11 @@ const ssoConfigurationPage = {
const oidc_form = page.querySelector("#sso-new-oidc-provider");
const text_fields = [...oidc_form.querySelectorAll(text_class)].map(
(e) => e.id
(e) => e.id,
);
const json_fields = [...oidc_form.querySelectorAll(json_class)].map(
(e) => e.id
(e) => e.id,
);
const text_list_fields = [
@@ -180,7 +180,7 @@ const ssoConfigurationPage = {
].map((e) => e.id);
const check_fields = [...oidc_form.querySelectorAll(toggle_class)].map(
(e) => e.id
(e) => e.id,
);
const output = {
@@ -230,7 +230,7 @@ const ssoConfigurationPage = {
if (provider[id])
ssoConfigurationPage.fillTextList(
provider[id],
page.querySelector("#" + id)
page.querySelector("#" + id),
);
});
@@ -238,7 +238,7 @@ const ssoConfigurationPage = {
if (provider[id]) {
ssoConfigurationPage.populateEnabledFolders(
provider[id],
page.querySelector(`#${id}`)
page.querySelector(`#${id}`),
);
}
});
@@ -252,20 +252,20 @@ const ssoConfigurationPage = {
if (provider[id])
ssoConfigurationPage.populateRoleMappings(provider[id], elem);
});
}
},
);
},
deleteProvider: (page, provider_name) => {
if (
!window.confirm(
`Are you sure you want to delete the provider ${provider_name}?`
`Are you sure you want to delete the provider ${provider_name}?`,
)
) {
return;
}
return new Promise((resolve) => {
ApiClient.getPluginConfiguration(
ssoConfigurationPage.pluginUniqueId
ssoConfigurationPage.pluginUniqueId,
).then((config) => {
if (!config.OidConfigs.hasOwnProperty(provider_name)) {
resolve();
@@ -275,7 +275,7 @@ const ssoConfigurationPage = {
delete config.OidConfigs[provider_name];
ApiClient.updatePluginConfiguration(
ssoConfigurationPage.pluginUniqueId,
config
config,
).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
ssoConfigurationPage.loadConfiguration(page);
@@ -292,7 +292,7 @@ const ssoConfigurationPage = {
const form_elements = ssoConfigurationPage.listArgumentsByType(page);
ApiClient.getPluginConfiguration(
ssoConfigurationPage.pluginUniqueId
ssoConfigurationPage.pluginUniqueId,
).then((config) => {
var current_config = {};
if (config.OidConfigs.hasOwnProperty(provider_name)) {
@@ -315,7 +315,7 @@ const ssoConfigurationPage = {
form_elements.text_list_fields.forEach((id) => {
current_config[id] = ssoConfigurationPage.parseTextList(
page.querySelector("#" + id)
page.querySelector("#" + id),
);
});
@@ -334,7 +334,7 @@ const ssoConfigurationPage = {
ApiClient.updatePluginConfiguration(
ssoConfigurationPage.pluginUniqueId,
config
config,
).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
ssoConfigurationPage.loadConfiguration(page);
+167 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>SSO</title>
@@ -358,6 +358,109 @@
</div>
</div>
<div
class="checkboxContainer checkboxContainer-withDescription"
>
<label>
<input
is="emby-checkbox"
id="EnableLiveTvRoles"
name="EnableLiveTvRoles"
type="checkbox"
class="sso-toggle"
/>
<span>Enable Live TV RBAC</span>
</label>
<div class="fieldDescription checkboxFieldDescription">
Determines whether the roles will be used to grant Live TV
privileges.
</div>
</div>
<div class="inputContainer">
<label
class="inputLabel inputLabelUnfocused"
for="LiveTvRoles"
>Live TV Roles:</label
>
<textarea
is="emby-textarea"
id="LiveTvRoles"
type="text"
class="sso-line-list emby-textarea"
></textarea>
<div class="fieldDescription">
A list of roles, one role per-line to look for in the OpenID
response.
<br />
Like <strong>"Roles"</strong>, but having any of the roles
confers Live TV privileges.
</div>
</div>
<div class="inputContainer">
<label
class="inputLabel inputLabelUnfocused"
for="LiveTvManagementRoles"
>Live TV Management Roles:</label
>
<textarea
is="emby-textarea"
id="LiveTvManagementRoles"
type="text"
class="sso-line-list emby-textarea"
></textarea>
<div class="fieldDescription">
A list of roles, one role per-line to look for in the OpenID
response.
<br />
Like <strong>"Roles"</strong>, but having any of the roles
confers Live TV administration privileges.
</div>
</div>
<div
class="checkboxContainer checkboxContainer-withDescription"
>
<label>
<input
is="emby-checkbox"
id="EnableLiveTv"
name="EnableLiveTv"
type="checkbox"
class="sso-toggle"
/>
<span>Enable Live TV Access By Default</span>
</label>
<div class="fieldDescription checkboxFieldDescription">
Determines whether the user can view Live TV by default.
<br />
This value is still used if <strong>Live TV RBAC</strong> is
enabled!
</div>
</div>
<div
class="checkboxContainer checkboxContainer-withDescription"
>
<label>
<input
is="emby-checkbox"
id="EnableLiveTvManagement"
name="EnableLiveTvManagement"
type="checkbox"
class="sso-toggle"
/>
<span>Enable Live TV Management By Default</span>
</label>
<div class="fieldDescription checkboxFieldDescription">
Determines whether the user can manage Live TV by default.
<br />
This value is still used if <strong>Live TV RBAC</strong> is
enabled!
</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="RoleClaim"
>Role Claim:</label
@@ -437,6 +540,69 @@
</div>
</div>
<div class="inputContainer">
<label
class="inputLabel inputLabelUnfocused"
for="DefaultUsernameClaim"
>Set default username claim:</label
>
<input
is="emby-input"
id="DefaultUsernameClaim"
type="text"
class="sso-text"
/>
<div class="fieldDescription">
The default username claim to use from OpenID by default. If
it is not set, it defaults to
<code>preferred_username</code>.
</div>
</div>
<div class="checkboxContainer">
<label>
<input
is="emby-checkbox"
id="DisableHttps"
name="DisableHttps"
type="checkbox"
class="sso-toggle"
/>
<span>Disable OpenID HTTPS Discovery (Insecure)</span>
</label>
<div class="fieldDescription checkboxFieldDescription"></div>
</div>
<div
class="checkboxContainer checkboxContainer-withDescription"
>
<label>
<input
is="emby-checkbox"
id="DoNotValidateEndpoints"
name="DoNotValidateEndpoints"
type="checkbox"
class="sso-toggle"
/>
<span>Do Not Validate OpenID Endpoints (Insecure)</span>
</label>
<div class="fieldDescription checkboxFieldDescription">
May be required for Google OpenID
</div>
</div>
<div class="checkboxContainer">
<label>
<input
is="emby-checkbox"
id="DoNotValidateIssuerName"
name="DoNotValidateIssuerName"
type="checkbox"
class="sso-toggle"
/>
<span>Do Not Validate OpenID Issuer Name (Insecure)</span>
</label>
</div>
<button
id="SaveProvider"
is="emby-button"
+2 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<!-- Polyfill styles that are missing when serving without dashboard -->
@@ -10,7 +10,7 @@
const view = document.querySelector("#sso-config-page");
document.querySelector("#theme-style").href = ApiClient.getUrl(
"/web/themes/dark/theme.css"
"/web/themes/dark/theme.css",
);
const homeButton = document.querySelector("a.emby-button.home");
+10 -10
View File
@@ -15,7 +15,7 @@ const ssoConfigLinking = {
ssoConfigLinking.loadProviderList(
provider_list_oid,
config_names,
"oid"
"oid",
);
});
});
@@ -24,7 +24,7 @@ const ssoConfigLinking = {
ssoConfigLinking.loadProviderList(
provider_list_saml,
config_names,
"saml"
"saml",
);
});
});
@@ -51,7 +51,7 @@ const ssoConfigLinking = {
></div>
`;
var add_provider = provider_config.querySelector(
".sso-provider-add-link"
".sso-provider-add-link",
);
//const provider_name_css = ssoConfigLinking.safeCSSId(provider_name);
@@ -60,7 +60,7 @@ const ssoConfigLinking = {
add_provider.classList.add("sso-provider");
add_provider.href = ApiClient.getUrl(
`/SSO/${provider_mode}/p/${provider_name}?isLinking=true`
`/SSO/${provider_mode}/p/${provider_name}?isLinking=true`,
);
container.appendChild(provider_config);
@@ -74,20 +74,20 @@ const ssoConfigLinking = {
type: "GET",
url: ApiClient.getUrl(`sso/${provider_mode}/links/${currentUserId}`),
},
true
true,
).then((resp) => {
resp.json().then((provider_map) => {
console.log({ provider_map, currentUserId });
Object.keys(provider_map).forEach((provider_name) => {
const provider_container = container.querySelector(
`.sso-provider-existing-links-container[data-provider="${provider_name}"]`
`.sso-provider-existing-links-container[data-provider="${provider_name}"]`,
);
ssoConfigLinking.populateExistingLinks(
provider_container,
provider_mode,
provider_name,
provider_map[provider_name]
provider_map[provider_name],
);
});
});
@@ -99,7 +99,7 @@ const ssoConfigLinking = {
container,
provider_mode,
provider_name,
canonical_names
canonical_names,
) => {
container
.querySelectorAll(".sso-provider-link-checkbox-wrapper")
@@ -158,7 +158,7 @@ const ssoConfigLinking = {
return ApiClient.fetch({
type: "DELETE",
url: ApiClient.getUrl(
`sso/${provider_mode}/link/${provider_name}/${currentUserId}/${canonical_name}`
`sso/${provider_mode}/link/${provider_name}/${currentUserId}/${canonical_name}`,
),
});
});
@@ -181,6 +181,6 @@ export default function (view) {
view
.querySelector("#btn-delete-selected-links")
.addEventListener("click", (e) =>
ssoConfigLinking.handleDeleteButtonPressed(e, view)
ssoConfigLinking.handleDeleteButtonPressed(e, view),
);
}
+4 -4
View File
@@ -66,7 +66,7 @@ export async function serverAddress({ basePath = "/web" }) {
url: obj.url,
config: obj.response.json(),
};
})
}),
);
})
.then((configs) => {
@@ -130,11 +130,11 @@ var localApiClient = new jellyfinApiclient.ApiClient(
appName,
appVersion,
getDeviceName(),
deviceId
deviceId,
);
localApiClient.setAuthenticationInfo(
current_server.AccessToken,
current_server.UserId
current_server.UserId,
);
var connections = new jellyfinApiclient.ConnectionManager(
@@ -143,7 +143,7 @@ var connections = new jellyfinApiclient.ConnectionManager(
appVersion,
getDeviceName(),
deviceId,
capabilities
capabilities,
);
connections.addApiClient(localApiClient);
+3 -1
View File
@@ -229,7 +229,9 @@ Emby Button
justify-content: center;
font-size: 82%;
border-radius: 100em;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12),
box-shadow:
0 4px 5px 0 rgba(0, 0, 0, 0.14),
0 1px 10px 0 rgba(0, 0, 0, 0.12),
0 2px 4px -1px rgba(0, 0, 0, 0.2);
background: #03a9f4;
font-weight: bold;
+2 -2
View File
@@ -493,7 +493,7 @@ async function main() {
jfCreds['Servers'][0]['UserId'] = responseJson['User']['Id'];
localStorage.setItem('jellyfin_credentials', JSON.stringify(jfCreds));
localStorage.setItem('enableAutoLogin', 'true');
window.location.replace('" + baseUrl + @"');
window.location.replace('" + baseUrl + @"/web/index.html');
}
document.addEventListener('DOMContentLoaded', function () {
@@ -501,6 +501,6 @@ document.addEventListener('DOMContentLoaded', function () {
});
// https://stackoverflow.com/a/25435165
</script><iframe class='docs-texteventtarget-iframe' sandbox='allow-same-origin allow-forms allow-scripts' src='" + baseUrl + "' style='position: absolute;width:0;height:0;border:0;'></iframe></body></html>";
</script><iframe class='docs-texteventtarget-iframe' sandbox='allow-same-origin allow-forms allow-scripts' src='" + baseUrl + "/web/index.html' style='position: absolute;width:0;height:0;border:0;'></iframe></body></html>";
}
}
+4 -1
View File
@@ -1,7 +1,7 @@
name: "SSO Authentication"
guid: "505ce9d1-d916-42fa-86ca-673ef241d7df"
imageUrl: "https://raw.githubusercontent.com/9p4/jellyfin-plugin-sso/main/img/logo.png"
version: "3.4.0.0"
version: "3.5.1.1"
targetAbi: "10.8.0.0"
framework: "net6.0"
owner: "9p4"
@@ -15,6 +15,9 @@ artifacts:
- "IdentityModel.OidcClient.dll"
- "IdentityModel.dll"
changelog: |
3.5.1.1: Change iframe URL to point to the web UI instead of the root
3.5.1.0: Improved paths! No more obscure "p" versus "r" URLs! Improve final redirect for automatic authentication. Add more configuration options for OpenID discovery.
3.5.0.0: Add support for Live TV authentication. Fix various null pointer bugs.
3.4.0.0: Add user self-service for linking existing accounts + managing existing links. Allow IDP accounts to be linked to jellyfin accounts with a different display-name.
3.3.0.0: Add fallback authentication provider. Add OpenID admin page.
3.2.0.0: Switch to hashmaps (BREAKING) for performance. Dump expected permissions in logs on error.
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1691218994,
"narHash": "sha256-46GJ5vLf9H+Oh7Jii2gJI9GATJHGbx2iQpon5nUSFPI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0d2fb29f5071a12d7983319c2c2576be6a130582",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+10
View File
@@ -0,0 +1,10 @@
{
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShell.x86_64-linux =
pkgs.mkShell { buildInputs = [ pkgs.nodePackages.prettier pkgs.dotnet-sdk ]; };
};
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

+6 -4
View File
@@ -17,6 +17,7 @@ This section is broken into providers that support Role-Based Access Control (RB
- ✅ Google OIDC
- ❗ Usernames are numeric
- ❗ Requires disabling validating OpenID endpoints
## General Options, when RBAC is supported
@@ -52,7 +53,7 @@ identity_providers:
secret: <redacted>
authorization_policy: one_factor
redirect_uris:
- https://jellyfin.example.com/sso/OID/r/authelia
- https://jellyfin.example.com/sso/OID/redirect/authelia
```
### Jellyfin's Config
@@ -113,6 +114,7 @@ Now we can add this property mapping to authentik's Jellyfin OAuth provider:
![image](img/authentik-config-04.jpg)
- Edit / Update your Jellyfin OAuth provider
- Verify your **"Redirect URIs/Origins (RegEx)"** follows the format: `https://domain.tld/sso/OID/redirect/Authentik`.
- Under **"Advanced Protocol Settings"**, add the **Group Membership** Scope
![image](img/authentik-config-05.jpg)
@@ -144,7 +146,7 @@ Ensure that the following configuration options are set:
- Access Type: Confidential
- Standard Flow Enabled
- Redirect URI: https://myjellyfin.example.com/sso/OID/r/PROVIDER_NAME
- Redirect URI: https://myjellyfin.example.com/sso/OID/redirect/PROVIDER_NAME
- Base URL: https://myjellyfin.example.com
Press the "Save" button at the bottom of the page and open the "Credentials" tab. Note down the secret.
@@ -178,9 +180,9 @@ Ensure that the following configuration options are set:
- Sign Documents on
- Sign Assertions off
- Client Signature Required off
- Redirect URI: [https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME)
- Redirect URI: [https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME)
- Base URL: [https://myjellyfin.example.com](https://myjellyfin.example.com)
- Master SAML processing URL: [https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/p/PROVIDER_NAME)
- Master SAML processing URL: [https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME](https://myjellyfin.example.com/sso/SAML/start/PROVIDER_NAME)
Press the "Save" button at the bottom of the page.