mirror of
https://github.com/9p4/jellyfin-plugin-sso.git
synced 2026-09-19 13:12:19 +00:00
Compare commits
137
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1e157bac2 | ||
|
|
83deeb253c | ||
|
|
ca187a7b5e | ||
|
|
05213dc1ee | ||
|
|
f7a0c94452 | ||
|
|
475048a32e | ||
|
|
781e07b2ce | ||
|
|
fed7e764a8 | ||
|
|
f0def6fd8d | ||
|
|
8e128932c4 | ||
|
|
5b3d70d328 | ||
|
|
be26670e1f | ||
|
|
547eabf55f | ||
|
|
48d75325b5 | ||
|
|
cdce0e583d | ||
|
|
0e897f922f | ||
|
|
afbab1073e | ||
|
|
87425aae36 | ||
|
|
9be9a1fed8 | ||
|
|
3b47851131 | ||
|
|
337ea0ba04 | ||
|
|
c37e3e3a71 | ||
|
|
8f86ce5101 | ||
|
|
d2c77db404 | ||
|
|
fc3976dcc8 | ||
|
|
fc58b8e80f | ||
|
|
da21ebffa3 | ||
|
|
0d18ebae03 | ||
|
|
77e2a229f2 | ||
|
|
71bb9a2f14 | ||
|
|
8baa922eea | ||
|
|
0738ad85f7 | ||
|
|
8d049705c4 | ||
|
|
3459baffdf | ||
|
|
de6cd5d5c2 | ||
|
|
299d3436ec | ||
|
|
5808f34064 | ||
|
|
5ed4c8bbcc | ||
|
|
f78a0f3108 | ||
|
|
aa0e361265 | ||
|
|
efc997c39e | ||
|
|
caab66b653 | ||
|
|
79ac628c4c | ||
|
|
fe3ca6337d | ||
|
|
f761dea356 | ||
|
|
55f58ecedd | ||
|
|
556feba864 | ||
|
|
1f08ccd213 | ||
|
|
f1f57723c3 | ||
|
|
216908acd5 | ||
|
|
9365ca2a33 | ||
|
|
ae0ee62f21 | ||
|
|
728a994728 | ||
|
|
9c0597a5bc | ||
|
|
fb9335d908 | ||
|
|
cbbafc976b | ||
|
|
f7bde6f1a0 | ||
|
|
d7351ef596 | ||
|
|
07315a124c | ||
|
|
9e96bd5218 | ||
|
|
6f77735248 | ||
|
|
73b6c17518 | ||
|
|
86dcd4c579 | ||
|
|
553c88873e | ||
|
|
cc86549c2e | ||
|
|
a2064c1f17 | ||
|
|
2cf4230bd6 | ||
|
|
91c57b18f5 | ||
|
|
feb56ebdd6 | ||
|
|
2d6e2fc938 | ||
|
|
ef085e9fa3 | ||
|
|
95d2c36e2c | ||
|
|
b8e56cefab | ||
|
|
e65f358c79 | ||
|
|
cd35ef45ae | ||
|
|
b5068f53a6 | ||
|
|
6f584597f6 | ||
|
|
42fba8656a | ||
|
|
618bcdbd8a | ||
|
|
2e8c19d631 | ||
|
|
19a6b49afa | ||
|
|
5b26808f0e | ||
|
|
2724d64de8 | ||
|
|
63ec46db4a | ||
|
|
4c891d8ef0 | ||
|
|
29189a9af0 | ||
|
|
3894048168 | ||
|
|
d51e5069d6 | ||
|
|
5149cef625 | ||
|
|
9be3e8e9c4 | ||
|
|
db203808f2 | ||
|
|
ec82bf7fbc | ||
|
|
87edc5f90a | ||
|
|
304170e214 | ||
|
|
9321c25f20 | ||
|
|
ebf7eef83e | ||
|
|
065ea8b5cd | ||
|
|
0476f817a6 | ||
|
|
3bb241b6d2 | ||
|
|
cb26ba9852 | ||
|
|
1b6761bf73 | ||
|
|
eeabc3cc46 | ||
|
|
e65c5add95 | ||
|
|
fce636bddd | ||
|
|
94d1c7a95a | ||
|
|
a1a355591c | ||
|
|
71802d954c | ||
|
|
f37e8dd3bb | ||
|
|
9b667b3175 | ||
|
|
2c3fc4d8e1 | ||
|
|
f897704100 | ||
|
|
d0b9b10a36 | ||
|
|
172f22e19f | ||
|
|
5777c8038e | ||
|
|
95776b427b | ||
|
|
b82a3867e4 | ||
|
|
657f90ef13 | ||
|
|
dd01e729b8 | ||
|
|
f2452103bf | ||
|
|
076cb1b893 | ||
|
|
defab9c4e8 | ||
|
|
2ead846ed8 | ||
|
|
8b755361b4 | ||
|
|
340eb2c6c3 | ||
|
|
08d24ba0db | ||
|
|
0d19a3376f | ||
|
|
1de72effca | ||
|
|
698fbce81b | ||
|
|
c6cac45004 | ||
|
|
dfd519ae9d | ||
|
|
40120dd127 | ||
|
|
d78e8c88a3 | ||
|
|
42b567d018 | ||
|
|
5bedf010b7 | ||
|
|
05fabf97fc | ||
|
|
ae063abea4 | ||
|
|
fa46806dc5 |
@@ -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']
|
||||
@@ -0,0 +1,4 @@
|
||||
contact_links:
|
||||
- name: Question
|
||||
url: https://github.com/9p4/jellyfin-plugin-sso/discussions
|
||||
about: Please ask and answer questions here.
|
||||
@@ -3,12 +3,12 @@ on:
|
||||
inputs:
|
||||
dotnet-version:
|
||||
required: false
|
||||
default: "6.0.x"
|
||||
default: "9.0.x"
|
||||
description: "The .NET version to setup for the build"
|
||||
type: string
|
||||
dotnet-target:
|
||||
required: false
|
||||
default: "net6.0"
|
||||
default: "net9.0"
|
||||
description: "The .NET target to set for JPRM"
|
||||
type: string
|
||||
|
||||
@@ -25,15 +25,15 @@ jobs:
|
||||
dotnet-version: "${{ inputs.dotnet-version }}"
|
||||
|
||||
- name: Build Jellyfin Plugin
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@b9e92867a6aa279d611a5ea80cf61f6358838c39
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1
|
||||
id: jprm
|
||||
with:
|
||||
dotnet-target: "${{ inputs.dotnet-target }}"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag=v4.6.2
|
||||
with:
|
||||
name: build-artifact
|
||||
retention-days: 30
|
||||
if-no-files-found: error
|
||||
path: ${{ steps.jprm.outputs.artifact }}
|
||||
path: ${{ steps.jprm.outputs.artifact }}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
name: Lint Commit Messages
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
commitlint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wagoid/commitlint-github-action@4caf21aed4a778f940d0b17eb109942ef167bb27
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 9.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
|
||||
@@ -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}'
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 9.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build Dotnet
|
||||
@@ -30,12 +30,12 @@ jobs:
|
||||
updateFile: true
|
||||
- name: "JPRM: Build"
|
||||
id: jrpm
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@b9e92867a6aa279d611a5ea80cf61f6358838c39
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@9497a0a499416cc572ed2e07a391d9f943a37b4d # v1.1.1
|
||||
with:
|
||||
version: "0.0.0.9000"
|
||||
verbosity: debug
|
||||
path: .
|
||||
dotnet-target: "net6.0"
|
||||
dotnet-target: "net9.0"
|
||||
output: _dist
|
||||
- name: Prepare GitHub Release assets
|
||||
run: |-
|
||||
|
||||
@@ -10,15 +10,15 @@ jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
dotnet-version: "6.0.*"
|
||||
dotnet-target: "net6.0"
|
||||
dotnet-version: "9.0.*"
|
||||
dotnet-target: "net9.0"
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v2.1.0
|
||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
||||
with:
|
||||
name: build-artifact
|
||||
- name: Prepare GitHub Release assets
|
||||
|
||||
+76
@@ -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
@@ -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)!
|
||||
@@ -22,6 +22,8 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
Project archived because I'm tired of working on this after all the years.
|
||||
|
||||
This plugin allows users to sign in through an SSO provider (such as Google, Microsoft, or your own provider). This enables one-click signin.
|
||||
|
||||
https://user-images.githubusercontent.com/17993169/149681516-f93b43f5-fa5c-4c1f-a909-e5414878a864.mp4
|
||||
@@ -32,9 +34,9 @@ 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!**
|
||||
**[This is for Jellyfin >=10.8](https://github.com/9p4/jellyfin-plugin-sso/issues/3) and only on the Web UI or clients supporting [Quick Connect](https://jellyfin.org/docs/general/server/quick-connect)**
|
||||
|
||||
**This README reflects the branch it is currently on! Switch tags to view version-specific documentation!**
|
||||
|
||||
@@ -46,11 +48,13 @@ This is 100% alpha software! PRs are welcome to improve the code.
|
||||
- authentik
|
||||
- Keycloak
|
||||
- OIDC & SAML
|
||||
- Pocket ID
|
||||
- Kanidm
|
||||
- Google OpenID: Works, but usernames are all numeric
|
||||
|
||||
## Supported Protocols
|
||||
|
||||
- [OpenID](https://openid.net/what-is-openid/)
|
||||
- [OpenID](https://openid.net/developers/how-connect-works/)
|
||||
- [SAML](https://www.cloudflare.com/learning/access-management/what-is-saml/)
|
||||
|
||||
## Security
|
||||
@@ -91,6 +95,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
|
||||
<form action="https://jellyfin.example.com/sso/OID/start/PROVIDER_NAME">
|
||||
<button class="raised block emby-button button-submit">
|
||||
Sign in with SSO
|
||||
</button>
|
||||
</form>
|
||||
```
|
||||
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
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 +137,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/post/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 +153,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 +166,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.
|
||||
@@ -151,14 +184,20 @@ These all require authorization. Append an API key to the end of the request: `c
|
||||
- `samlClientId`: string. The SAML client ID.
|
||||
- `samlCertificate`: string. The base64 encoded SAML certificate.
|
||||
- `enabled`: boolean. Determines if the provider is enabled or not.
|
||||
- `enableAuthorization`: boolean: Determines if the plugin sets permissions for the user. If false, the user will start with no permissions and an administrator will add permissions. The permissions of existing users will not be rewritten on subsequent logins.
|
||||
- `enableAuthorization`: boolean: Determines if the plugin sets permissions for the user. If false, the user will start with no permissions and an administrator will add permissions. If disabled, then the permissions of users will not be modified and the Jellyfin defaults will be used instead.
|
||||
- `enableAllFolders`: boolean. Determines if the client logging in is allowed access to all folders.
|
||||
- `enabledFolders`: array of strings. If `enableAllFolders` is set to false, then this will be used to determine what folders the users who log in through this provider are allowed to use.
|
||||
- `roles`: array of strings. This validates the SAML response against the `Role` attribute. If a user has any of these roles, then the user is authenticated. Leave blank to disable role checking.
|
||||
- `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.
|
||||
- `schemeOverride`: string. Sets the scheme for URLs used. Can be useful if the plugin refuses to use HTTPS URLs.
|
||||
- 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 +205,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.
|
||||
@@ -184,19 +223,29 @@ These all require authorization. Append an API key to the end of the request: `c
|
||||
- `oidClientId`: string. The OpenID client ID.
|
||||
- `oidSecret`: string. The OpenID secret.
|
||||
- `enabled`: boolean. Determines if the provider is enabled or not.
|
||||
- `enableAuthorization`: boolean: Determines if the plugin sets permissions for the user. If false, the user will start with no permissions and an administrator will add permissions. The permissions of existing users will not be rewritten on subsequent logins.
|
||||
- `enableAuthorization`: boolean: Determines if the plugin sets permissions for the user. If false, the user will start with no permissions and an administrator will add permissions. If disabled, then the permissions of users will not be modified and the Jellyfin defaults will be used instead.
|
||||
- `enableAllFolders`: boolean. Determines if the client logging in is allowed access to all folders.
|
||||
- `enabledFolders`: array of strings. If `enableAllFolders` is set to false, then this will be used to determine what folders the users who log in through this provider are allowed to use.
|
||||
- `roles`: array of strings. This validates the OpenID response against the claim set in `roleClaim`. If a user has any of these roles, then the user is authenticated. Leave blank to disable role checking. This currently only works for Keycloak (to my knowledge).
|
||||
- `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`.
|
||||
- `avatarUrlFormat`: string. The URL format for the users avatars. OIDC claims can be used by using the `@{claim_type}` syntax. If not set, the avatars won't change.
|
||||
- `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.
|
||||
- `schemeOverride`: string. Sets the scheme for URLs used. Can be useful if the plugin refuses to use HTTPS URLs.
|
||||
- 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.
|
||||
@@ -207,32 +256,38 @@ 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).
|
||||
|
||||
# Contributing
|
||||
|
||||
## Dependencies
|
||||
|
||||
This project uses Nix flakes to manage development dependencies. Run `nix develop` to use the same toolchain versions.
|
||||
|
||||
## Building
|
||||
|
||||
This is built with .NET 6.0. Build with `dotnet publish .` for the debug release in the `SSO-Auth` directory. Copy over the `IdentityModel.OidcClient.dll`, the `IdentityModel.dll` and the `SSO-Auth.dll` files in the `/bin/Debug/net6.0/publish` directory to a new folder in your Jellyfin configuration: `config/plugins/sso`.
|
||||
|
||||
### 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
|
||||
@@ -249,7 +304,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
|
||||
@@ -258,7 +313,7 @@ Much thanks to the [Jellyfin LDAP plugin](https://github.com/jellyfin/jellyfin-p
|
||||
|
||||
I use the [AspNet SAML](https://github.com/jitbit/AspNetSaml/) library for the SAML side of things (patched to work with Base64 on non-Windows machines).
|
||||
|
||||
I use the [IdentityModel OIDC Client](https://github.com/IdentityModel/IdentityModel.OidcClient/) library for the OpenID side of things.
|
||||
I use the [Duende IdentityModel OIDC Client](https://github.com/DuendeSoftware/foss) library for the OpenID side of things.
|
||||
|
||||
Thanks to these projects, without which I would have been pulling my hair out implementing these protocols from scratch.
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Please email all security vulnerabilities and issues found to the email "contact at ersei dot net". If using LLMs/AI to find the issues, first verify the issue exists manually. Please do not publicly disclose security vulnerabilities until after a stable release for the fix has been released for 30 days.
|
||||
|
||||
The latest released version is the only supported version.
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30114.105
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SSO-Auth", "SSO-Auth\SSO-Auth.csproj", "{C30A5CFB-B27E-4E83-9E96-1E0362B36748}"
|
||||
EndProject
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data;
|
||||
using Jellyfin.Database.Implementations.Enums;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
|
||||
+472
-115
@@ -1,27 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Mime;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using IdentityModel.OidcClient;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Duende.IdentityModel.OidcClient;
|
||||
using Jellyfin.Data;
|
||||
using Jellyfin.Database.Implementations.Entities;
|
||||
using Jellyfin.Database.Implementations.Enums;
|
||||
using Jellyfin.Plugin.SSO_Auth.Config;
|
||||
using Jellyfin.Plugin.SSO_Auth.Helpers;
|
||||
using MediaBrowser.Common.Api;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SSO_Auth.Lib;
|
||||
|
||||
namespace Jellyfin.Plugin.SSO_Auth.Api;
|
||||
|
||||
@@ -36,24 +43,45 @@ public class SSOController : ControllerBase
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IAuthorizationContext _authContext;
|
||||
private readonly ILogger<SSOController> _logger;
|
||||
private readonly ILoggerFactory _loggerFactory;
|
||||
private readonly ICryptoProvider _cryptoProvider;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private static readonly IDictionary<string, TimedAuthorizeState> StateManager = new Dictionary<string, TimedAuthorizeState>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SSOController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger{SSOController}"/> interface.</param>
|
||||
/// <param name="loggerFactory">Instance of the <see cref="ILoggerFactory"/> interface.</param>
|
||||
/// <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>
|
||||
/// <param name="cryptoProvider">Instance of the <see cref="ICryptoProvider"/> interface.</param>
|
||||
public SSOController(ILogger<SSOController> logger, ISessionManager sessionManager, IUserManager userManager, IAuthorizationContext authContext, ICryptoProvider cryptoProvider)
|
||||
/// <param name="providerManager">Instance of the <see cref="IProviderManager"/> interface.</param>
|
||||
/// <param name="httpClientFactory">Instance of the <see cref="IHttpClientFactory"/> interface.</param>
|
||||
/// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
public SSOController(
|
||||
ILogger<SSOController> logger,
|
||||
ILoggerFactory loggerFactory,
|
||||
ISessionManager sessionManager,
|
||||
IUserManager userManager,
|
||||
IAuthorizationContext authContext,
|
||||
ICryptoProvider cryptoProvider,
|
||||
IProviderManager providerManager,
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_sessionManager = sessionManager;
|
||||
_userManager = userManager;
|
||||
_authContext = authContext;
|
||||
_cryptoProvider = cryptoProvider;
|
||||
_logger = logger;
|
||||
_loggerFactory = loggerFactory;
|
||||
_providerManager = providerManager;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_logger.LogInformation("SSO Controller initialized");
|
||||
}
|
||||
|
||||
@@ -65,7 +93,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
|
||||
{
|
||||
@@ -81,109 +110,201 @@ public class SSOController : ControllerBase
|
||||
|
||||
if (config.Enabled)
|
||||
{
|
||||
var options = new OidcClientOptions
|
||||
if (string.IsNullOrEmpty(state))
|
||||
{
|
||||
Authority = config.OidEndpoint,
|
||||
ClientId = config.OidClientId,
|
||||
ClientSecret = config.OidSecret,
|
||||
RedirectUri = GetRequestBase() + "/sso/OID/r/" + provider,
|
||||
Scope = string.Join(" ", config.OidScopes.Prepend("openid profile")),
|
||||
};
|
||||
options.Policy.Discovery.ValidateEndpoints = false; // For Google and other providers with different endpoints
|
||||
var oidcClient = new OidcClient(options);
|
||||
var currentState = StateManager[state].State;
|
||||
var result = oidcClient.ProcessResponseAsync(Request.QueryString.Value, currentState).Result;
|
||||
if (result.IsError)
|
||||
{
|
||||
return ReturnError(StatusCodes.Status400BadRequest, result.Error + " Try logging in again.");
|
||||
return BadRequest("Missing state");
|
||||
}
|
||||
|
||||
if (!config.EnableFolderRoles)
|
||||
if (!StateManager.TryGetValue(state, out var timedState))
|
||||
{
|
||||
StateManager[state].Folders = new List<string>(config.EnabledFolders);
|
||||
return BadRequest("Invalid or expired state");
|
||||
}
|
||||
|
||||
var scopes = config.OidScopes == null ? new string[2] : config.OidScopes;
|
||||
var options = new OidcClientOptions
|
||||
{
|
||||
Authority = config.OidEndpoint?.Trim(),
|
||||
ClientId = config.OidClientId?.Trim(),
|
||||
ClientSecret = config.OidSecret?.Trim(),
|
||||
RedirectUri = GetRequestBase(config.SchemeOverride, config.PortOverride) + $"/sso/OID/{(Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase) ? "redirect" : "r")}/" + provider,
|
||||
Scope = string.Join(" ", scopes.Prepend("openid profile")),
|
||||
DisablePushedAuthorization = config.DisablePushedAuthorization,
|
||||
LoggerFactory = _loggerFactory,
|
||||
LoadProfile = !config.DoNotLoadProfile,
|
||||
HttpClientFactory = o =>
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
string version = fvi.FileVersion;
|
||||
client.DefaultRequestHeaders.UserAgent.ParseAdd($"Jellyfin-Plugin-SSO-Auth +{version} (https://github.com/9p4/jellyfin-plugin-sso)");
|
||||
return client;
|
||||
}
|
||||
};
|
||||
var oidEndpointUri = new Uri(config.OidEndpoint?.Trim());
|
||||
options.Policy.Discovery.AdditionalEndpointBaseAddresses.Add(oidEndpointUri.GetLeftPart(UriPartial.Authority));
|
||||
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 = timedState.State;
|
||||
var result = await oidcClient.ProcessResponseAsync(Request.QueryString.Value, currentState).ConfigureAwait(false);
|
||||
|
||||
if (result.IsError)
|
||||
{
|
||||
return ReturnError(StatusCodes.Status400BadRequest, $"Error logging in: {result.Error} - {result.ErrorDescription}");
|
||||
}
|
||||
|
||||
if (!config.EnableFolderRoles && config.EnabledFolders != null)
|
||||
{
|
||||
timedState.Folders = new List<string>(config.EnabledFolders);
|
||||
}
|
||||
else
|
||||
{
|
||||
StateManager[state].Folders = new List<string>();
|
||||
timedState.Folders = new List<string>();
|
||||
}
|
||||
|
||||
timedState.EnableLiveTv = config.EnableLiveTv;
|
||||
timedState.EnableLiveTvManagement = config.EnableLiveTvManagement;
|
||||
|
||||
if (config.AvatarUrlFormat is not null)
|
||||
{
|
||||
timedState.AvatarURL = result.User.Claims.Aggregate(
|
||||
config.AvatarUrlFormat,
|
||||
(s, claim) => s.Contains($"@{{{claim.Type}}}") ? s.Replace($"@{{{claim.Type}}}", claim.Value) : s);
|
||||
}
|
||||
|
||||
foreach (var claim in result.User.Claims)
|
||||
{
|
||||
if (claim.Type == (config.DefaultUsernameClaim ?? "preferred_username"))
|
||||
if (claim.Type == (config.DefaultUsernameClaim?.Trim() ?? "preferred_username"))
|
||||
{
|
||||
StateManager[state].Username = claim.Value;
|
||||
if (config.Roles.Length == 0)
|
||||
timedState.Username = claim.Value;
|
||||
if (config.Roles == null || config.Roles.Length == 0)
|
||||
{
|
||||
StateManager[state].Valid = true;
|
||||
timedState.Valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 };
|
||||
}
|
||||
|
||||
// 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)
|
||||
else
|
||||
{
|
||||
foreach (string validRoles in config.Roles)
|
||||
// We recursively traverse through the JSON data for the roles and parse it
|
||||
var json = JsonConvert.DeserializeObject<IDictionary<string, object>>(claim.Value);
|
||||
if (json is null)
|
||||
{
|
||||
if (role.Equals(validRoles))
|
||||
roles = new List<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool missingSegment = false;
|
||||
for (int i = 1; i < segments.Length - 1; i++)
|
||||
{
|
||||
StateManager[state].Valid = true;
|
||||
var segment = segments[i];
|
||||
if (!json.TryGetValue(segment, out var nextToken) || nextToken is not JObject nextObject)
|
||||
{
|
||||
missingSegment = true;
|
||||
break;
|
||||
}
|
||||
|
||||
json = nextObject.ToObject<IDictionary<string, object>>();
|
||||
if (json is null)
|
||||
{
|
||||
missingSegment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (missingSegment || !json.TryGetValue(segments[^1], out var rolesToken) || rolesToken is not JArray rolesArray)
|
||||
{
|
||||
roles = new List<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The final step is to take the JSON and turn it from a dictionary into a string
|
||||
roles = rolesArray.ToObject<List<string>>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if admin based on roles
|
||||
if (config.AdminRoles.Length != 0)
|
||||
foreach (string role in roles)
|
||||
{
|
||||
foreach (string validAdminRoles in config.AdminRoles)
|
||||
// Check if allowed to login based on roles
|
||||
if (config.Roles != null && config.Roles.Any())
|
||||
{
|
||||
if (role.Equals(validAdminRoles))
|
||||
foreach (string validRoles in config.Roles)
|
||||
{
|
||||
StateManager[state].Admin = true;
|
||||
if (role.Equals(validRoles))
|
||||
{
|
||||
timedState.Valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get allowed folders from roles
|
||||
if (config.EnableFolderRoles)
|
||||
{
|
||||
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
|
||||
// Check if admin based on roles
|
||||
if (config.AdminRoles != null && config.AdminRoles.Any())
|
||||
{
|
||||
if (role.Equals(folderRoleMap.Role))
|
||||
foreach (string validAdminRoles in config.AdminRoles)
|
||||
{
|
||||
StateManager[state].Folders.AddRange(folderRoleMap.Folders);
|
||||
if (role.Equals(validAdminRoles))
|
||||
{
|
||||
timedState.Admin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get allowed folders from roles
|
||||
if (config.EnableFolderRoles)
|
||||
{
|
||||
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
|
||||
{
|
||||
if (role.Equals(folderRoleMap.Role?.Trim()))
|
||||
{
|
||||
timedState.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))
|
||||
{
|
||||
timedState.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))
|
||||
{
|
||||
timedState.EnableLiveTvManagement = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,33 +313,33 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
|
||||
// If the provider doesn't support the preferred username claim, then use the sub claim
|
||||
if (!StateManager[state].Valid)
|
||||
if (!timedState.Valid)
|
||||
{
|
||||
foreach (var claim in result.User.Claims)
|
||||
{
|
||||
if (claim.Type == "sub")
|
||||
{
|
||||
StateManager[state].Username = claim.Value;
|
||||
timedState.Username = claim.Value;
|
||||
if (config.Roles.Length == 0)
|
||||
{
|
||||
StateManager[state].Valid = true;
|
||||
timedState.Valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isLinking = StateManager[state].IsLinking;
|
||||
bool isLinking = timedState.IsLinking;
|
||||
|
||||
if (StateManager[state].Valid)
|
||||
if (timedState.Valid)
|
||||
{
|
||||
_logger.LogInformation($"Is request linking: {isLinking}");
|
||||
return Content(WebResponse.Generator(data: state, provider: provider, baseUrl: GetRequestBase(), mode: "OID", isLinking: isLinking), MediaTypeNames.Text.Html);
|
||||
return Content(WebResponse.Generator(data: state, provider: provider, baseUrl: GetRequestBase(config.SchemeOverride, config.PortOverride), mode: "OID", isLinking: isLinking), MediaTypeNames.Text.Html);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"OpenID user {Username} has one or more incorrect role claims: {@Claims}. Expected any one of: {@ExpectedClaims}",
|
||||
StateManager[state].Username,
|
||||
timedState.Username,
|
||||
result.User.Claims.Select(o => new { o.Type, o.Value }),
|
||||
config.Roles);
|
||||
|
||||
@@ -237,6 +358,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();
|
||||
@@ -252,17 +374,49 @@ public class SSOController : ControllerBase
|
||||
|
||||
if (config.Enabled)
|
||||
{
|
||||
bool newPath = config.NewPath;
|
||||
if (!isLinking)
|
||||
{
|
||||
newPath = Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase);
|
||||
config.NewPath = newPath;
|
||||
}
|
||||
|
||||
string redirectUri = GetRequestBase(config.SchemeOverride, config.PortOverride) + $"/sso/OID/{(newPath ? "redirect" : "r")}/" + provider;
|
||||
|
||||
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 = redirectUri,
|
||||
Scope = string.Join(" ", config.OidScopes.Prepend("openid profile")),
|
||||
DisablePushedAuthorization = config.DisablePushedAuthorization,
|
||||
LoggerFactory = _loggerFactory,
|
||||
LoadProfile = !config.DoNotLoadProfile,
|
||||
HttpClientFactory = o =>
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
string version = fvi.FileVersion;
|
||||
|
||||
client.DefaultRequestHeaders.UserAgent.ParseAdd($"Jellyfin-Plugin-SSO-Auth +{version} (https://github.com/9p4/jellyfin-plugin-sso)");
|
||||
return client;
|
||||
}
|
||||
};
|
||||
options.Policy.Discovery.ValidateEndpoints = false; // For Google and other providers with different endpoints
|
||||
var oidEndpointUri = new Uri(config.OidEndpoint?.Trim());
|
||||
options.Policy.Discovery.AdditionalEndpointBaseAddresses.Add(oidEndpointUri.GetLeftPart(UriPartial.Authority));
|
||||
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 state = await oidcClient.PrepareLoginAsync().ConfigureAwait(false);
|
||||
|
||||
if (state.IsError)
|
||||
{
|
||||
return ReturnError(StatusCodes.Status400BadRequest, $"Error preparing login: {state.Error} - {state.ErrorDescription}");
|
||||
}
|
||||
|
||||
StateManager.Add(state.State, new TimedAuthorizeState(state, DateTime.Now));
|
||||
|
||||
// Track whether this is a linking request or not.
|
||||
@@ -278,7 +432,7 @@ public class SSOController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="provider">The name of the provider to add.</param>
|
||||
/// <param name="config">The OID configuration (deserialized from a JSON post).</param>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpPost("OID/Add/{provider}")]
|
||||
public void OidAdd(string provider, [FromBody] OidConfig config)
|
||||
{
|
||||
@@ -291,7 +445,7 @@ public class SSOController : ControllerBase
|
||||
/// Deletes an OpenID provider.
|
||||
/// </summary>
|
||||
/// <param name="provider">Name of provider to delete.</param>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpGet("OID/Del/{provider}")]
|
||||
public void OidDel(string provider)
|
||||
{
|
||||
@@ -304,7 +458,7 @@ public class SSOController : ControllerBase
|
||||
/// Lists the OpenID providers configured. Requires administrator privileges.
|
||||
/// </summary>
|
||||
/// <returns>The list of OpenID configurations.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpGet("OID/Get")]
|
||||
public ActionResult OidProviders()
|
||||
{
|
||||
@@ -335,7 +489,7 @@ public class SSOController : ControllerBase
|
||||
/// This is a debug endpoint to list all running OpenID flows. Requires administrator privileges.
|
||||
/// </summary>
|
||||
/// <returns>The list of OpenID flows in progress.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpGet("OID/States")]
|
||||
public ActionResult OidStates()
|
||||
{
|
||||
@@ -371,8 +525,19 @@ 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(),
|
||||
kvp.Value.AvatarURL)
|
||||
.ConfigureAwait(false);
|
||||
StateManager.Remove(kvp.Key);
|
||||
return Ok(authenticationResult);
|
||||
}
|
||||
}
|
||||
@@ -391,6 +556,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;
|
||||
@@ -412,10 +578,17 @@ public class SSOController : ControllerBase
|
||||
{
|
||||
var samlResponse = new Response(config.SamlCertificate, Request.Form["SAMLResponse"]);
|
||||
|
||||
if (!samlResponse.IsValid())
|
||||
{
|
||||
return Problem("Invalid SAML signature");
|
||||
}
|
||||
|
||||
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
|
||||
@@ -425,11 +598,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(config.SchemeOverride, config.PortOverride),
|
||||
mode: "SAML",
|
||||
isLinking: isLinking),
|
||||
MediaTypeNames.Text.Html);
|
||||
}
|
||||
|
||||
_logger.LogWarning(
|
||||
"SAML user: {UserId} has insufficient roles: {@Roles}. Expected any one of: {@ExpectedRoles}",
|
||||
samlResponse.GetNameID(),
|
||||
@@ -448,6 +633,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;
|
||||
@@ -462,6 +648,14 @@ public class SSOController : ControllerBase
|
||||
|
||||
if (config.Enabled)
|
||||
{
|
||||
bool newPath = config.NewPath;
|
||||
if (!isLinking)
|
||||
{
|
||||
newPath = Request.Path.Value.Contains("/start/", StringComparison.InvariantCultureIgnoreCase);
|
||||
config.NewPath = newPath;
|
||||
}
|
||||
|
||||
string redirectUri = GetRequestBase(config.SchemeOverride, config.PortOverride) + $"/sso/SAML/{(newPath ? "post" : "p")}/" + provider;
|
||||
string relayState = null;
|
||||
if (isLinking)
|
||||
{
|
||||
@@ -469,10 +663,10 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
|
||||
var request = new AuthRequest(
|
||||
config.SamlClientId,
|
||||
GetRequestBase() + "/sso/SAML/p/" + provider);
|
||||
config.SamlClientId.Trim(),
|
||||
redirectUri);
|
||||
|
||||
return Redirect(request.GetRedirectUrl(config.SamlEndpoint, relayState));
|
||||
return Redirect(request.GetRedirectUrl(config.SamlEndpoint.Trim(), relayState));
|
||||
}
|
||||
|
||||
throw new ArgumentException("Provider does not exist");
|
||||
@@ -484,7 +678,7 @@ public class SSOController : ControllerBase
|
||||
/// <param name="provider">The provider name to add.</param>
|
||||
/// <param name="newConfig">The SAML configuration object (deserialized) from JSON.</param>
|
||||
/// <returns>The success result.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpPost("SAML/Add/{provider}")]
|
||||
public OkResult SamlAdd(string provider, [FromBody] SamlConfig newConfig)
|
||||
{
|
||||
@@ -499,7 +693,7 @@ public class SSOController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="provider">The ID of the provider to delete.</param>
|
||||
/// <returns>The success result.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpGet("SAML/Del/{provider}")]
|
||||
public OkResult SamlDel(string provider)
|
||||
{
|
||||
@@ -513,7 +707,7 @@ public class SSOController : ControllerBase
|
||||
/// Returns a list of all SAML providers configured. Requires administrator privileges.
|
||||
/// </summary>
|
||||
/// <returns>A list of all of the Saml providers available.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpGet("SAML/Get")]
|
||||
public ActionResult SamlProviders()
|
||||
{
|
||||
@@ -544,9 +738,17 @@ 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);
|
||||
|
||||
if (!samlResponse.IsValid())
|
||||
{
|
||||
return Problem("Invalid SAML signature");
|
||||
}
|
||||
|
||||
List<string> folders;
|
||||
if (!config.EnableFolderRoles)
|
||||
if (!config.EnableFolderRoles && config.EnabledFolders != null)
|
||||
{
|
||||
folders = new List<string>(config.EnabledFolders);
|
||||
}
|
||||
@@ -557,21 +759,52 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.EnableFolderRoles)
|
||||
{
|
||||
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
|
||||
if (config.FolderRoleMapping != null)
|
||||
{
|
||||
if (folderRoleMap.Role.Equals(role))
|
||||
foreach (FolderRoleMap folderRoleMap in config.FolderRoleMapping)
|
||||
{
|
||||
folders.AddRange(folderRoleMap.Folders);
|
||||
if (folderRoleMap.Role.Equals(role))
|
||||
{
|
||||
folders.AddRange(folderRoleMap.Folders);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -579,7 +812,17 @@ public class SSOController : ControllerBase
|
||||
|
||||
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(),
|
||||
null)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(authenticationResult);
|
||||
}
|
||||
@@ -593,7 +836,7 @@ public class SSOController : ControllerBase
|
||||
/// <param name="username">The username to switch to the new provider.</param>
|
||||
/// <param name="provider">The new provider to switch to.</param>
|
||||
/// <returns>Whether this API endpoint succeeded.</returns>
|
||||
[Authorize(Policy = "RequiresElevation")]
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
[HttpPost("Unregister/{username}")]
|
||||
public ActionResult Unregister(string username, [FromBody] string provider)
|
||||
{
|
||||
@@ -630,7 +873,28 @@ public class SSOController : ControllerBase
|
||||
private async Task<Guid> CreateCanonicalLinkAndUserIfNotExist(string mode, string provider, string canonicalName)
|
||||
{
|
||||
User user = null;
|
||||
user = _userManager.GetUserByName(canonicalName);
|
||||
|
||||
// First try to get the user by its id in case it was already registered before
|
||||
Guid userId = Guid.Empty;
|
||||
try
|
||||
{
|
||||
userId = GetCanonicalLink(mode, provider, canonicalName);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
userId = Guid.Empty;
|
||||
}
|
||||
|
||||
// No userId found? Let's try and find the user by name instead
|
||||
if (userId == Guid.Empty)
|
||||
{
|
||||
user = _userManager.GetUserByName(canonicalName);
|
||||
}
|
||||
else
|
||||
{
|
||||
user = _userManager.GetUserById(userId);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogInformation($"SSO user {canonicalName} doesn't exist, creating...");
|
||||
@@ -645,7 +909,7 @@ public class SSOController : ControllerBase
|
||||
UpdateCanonicalLinkConfig(links, mode, provider);
|
||||
}
|
||||
|
||||
Guid userId = Guid.Empty;
|
||||
userId = Guid.Empty;
|
||||
try
|
||||
{
|
||||
userId = GetCanonicalLink(mode, provider, canonicalName);
|
||||
@@ -685,7 +949,7 @@ public class SSOController : ControllerBase
|
||||
/// <param name="jellyfinUserId">The user ID within jellyfin to link to the provider.</param>
|
||||
/// <param name="authResponse">The client information to authenticate the user with.</param>
|
||||
/// <returns>Whether this API endpoint succeeded.</returns>
|
||||
[Authorize(Policy = "DefaultAuthorization")]
|
||||
[Authorize]
|
||||
[HttpPost("{mode}/Link/{provider}/{jellyfinUserId}")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
@@ -715,7 +979,7 @@ public class SSOController : ControllerBase
|
||||
/// <param name="jellyfinUserId">The user ID within jellyfin to unlink from the provider.</param>
|
||||
/// <param name="canonicalName">The user ID within jellyfin to unlink.</param>
|
||||
/// <returns>Whether this API endpoint succeeded.</returns>
|
||||
[Authorize(Policy = "DefaultAuthorization")]
|
||||
[Authorize]
|
||||
[HttpDelete("{mode}/Link/{provider}/{jellyfinUserId}/{canonicalName}")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
@@ -745,7 +1009,7 @@ public class SSOController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="jellyfinUserId">The user ID within jellyfin for which to return the links.</param>
|
||||
/// <returns>A dictionary of provider : link mappings.</returns>
|
||||
[Authorize(Policy = "DefaultAuthorization")]
|
||||
[Authorize]
|
||||
[HttpGet("saml/links/{jellyfinUserId}")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public async Task<ActionResult<SerializableDictionary<string, IEnumerable<string>>>> GetSamlLinksByUser(Guid jellyfinUserId)
|
||||
@@ -773,7 +1037,7 @@ public class SSOController : ControllerBase
|
||||
/// </summary>
|
||||
/// <param name="jellyfinUserId">The user ID within jellyfin for which to return the links.</param>
|
||||
/// <returns>A dictionary of provider : link mappings.</returns>
|
||||
[Authorize(Policy = "DefaultAuthorization")]
|
||||
[Authorize]
|
||||
[HttpGet("oid/links/{jellyfinUserId}")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
public async Task<ActionResult<SerializableDictionary<string, IEnumerable<string>>>> GetOidLinksByUser(Guid jellyfinUserId)
|
||||
@@ -821,7 +1085,11 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
|
||||
var samlResponse = new Response(config.SamlCertificate, response.Data);
|
||||
// TODO: Does saml response require further validation?
|
||||
|
||||
if (!samlResponse.IsValid())
|
||||
{
|
||||
return Problem("Invalid SAML signature");
|
||||
}
|
||||
|
||||
string providerUserId = samlResponse.GetNameID();
|
||||
|
||||
@@ -909,9 +1177,12 @@ 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)
|
||||
/// <param name="avatarUrl">The new avatar url for the user.</param>
|
||||
private async Task<AuthenticationResult> Authenticate(Guid userId, bool isAdmin, bool enableAuthorization, bool enableAllFolders, string[] enabledFolders, bool enableLiveTv, bool enableLiveTvAdmin, AuthResponse authResponse, string defaultProvider, string avatarUrl)
|
||||
{
|
||||
User user = _userManager.GetUserById(userId);
|
||||
if (enableAuthorization)
|
||||
@@ -924,6 +1195,59 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
if (avatarUrl is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = _httpClientFactory.CreateClient();
|
||||
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
string version = fvi.FileVersion;
|
||||
client.DefaultRequestHeaders.UserAgent.ParseAdd($"Jellyfin-Plugin-SSO-Auth +{version} (https://github.com/9p4/jellyfin-plugin-sso)");
|
||||
|
||||
var avatarResponse = await client.GetAsync(avatarUrl);
|
||||
|
||||
if (!avatarResponse.Content.Headers.TryGetValues("content-type", out var contentTypeList))
|
||||
{
|
||||
throw new Exception("Cannot get Content-Type of image : " + avatarUrl);
|
||||
}
|
||||
|
||||
var contentType = contentTypeList.First();
|
||||
if (!contentType.StartsWith("image"))
|
||||
{
|
||||
throw new Exception("Content type of avatar URL is not an image, got : " + contentType);
|
||||
}
|
||||
|
||||
var extension = contentType.Split("/").Last();
|
||||
var stream = await avatarResponse.Content.ReadAsStreamAsync();
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
var userDataPath =
|
||||
Path.Combine(
|
||||
_serverConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath,
|
||||
user.Username);
|
||||
if (user.ProfileImage is not null)
|
||||
{
|
||||
await _userManager.ClearProfileImageAsync(user).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
user.ProfileImage = new ImageInfo(Path.Combine(userDataPath, "profile" + extension));
|
||||
|
||||
await _providerManager.SaveImage(stream, contentType, user.ProfileImage.Path)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
user.SetPermission(PermissionKind.EnableLiveTvAccess, enableLiveTv);
|
||||
user.SetPermission(PermissionKind.EnableLiveTvManagement, enableLiveTvAdmin);
|
||||
|
||||
await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
|
||||
|
||||
var authRequest = new AuthenticationRequest();
|
||||
@@ -956,17 +1280,32 @@ public class SSOController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
private string GetRequestBase()
|
||||
private string GetRequestBase(string schemeOverride = null, int? portOverride = null)
|
||||
{
|
||||
int requestPort = Request.Host.Port ?? -1;
|
||||
int requestPort;
|
||||
|
||||
if (portOverride != null)
|
||||
{
|
||||
requestPort = portOverride.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (schemeOverride != "http" && schemeOverride != "https")
|
||||
{
|
||||
schemeOverride = null;
|
||||
}
|
||||
|
||||
return new UriBuilder
|
||||
{
|
||||
Scheme = Request.Scheme,
|
||||
Scheme = schemeOverride ?? Request.Scheme,
|
||||
Host = Request.Host.Host,
|
||||
Port = requestPort,
|
||||
Path = Request.PathBase
|
||||
@@ -1031,6 +1370,9 @@ public class TimedAuthorizeState
|
||||
Valid = false;
|
||||
Admin = false;
|
||||
IsLinking = false;
|
||||
EnableLiveTv = false;
|
||||
EnableLiveTvManagement = false;
|
||||
AvatarURL = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1068,4 +1410,19 @@ 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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user avatar url.
|
||||
/// </summary>
|
||||
public string AvatarURL { get; set; }
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -101,6 +126,21 @@ public class SamlConfig
|
||||
/// </summary>
|
||||
public string DefaultProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the redirect scheme override.
|
||||
/// </summary>
|
||||
public string SchemeOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the redirect port override.
|
||||
/// </summary>
|
||||
public int? PortOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the new, more descriptive paths are to be used.
|
||||
/// </summary>
|
||||
public bool NewPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a mapping of canonical names from the provider to jellyfin user ids.
|
||||
/// </summary>
|
||||
@@ -178,6 +218,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>
|
||||
@@ -200,6 +265,21 @@ public class OidConfig
|
||||
/// </summary>
|
||||
public string DefaultProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the redirect scheme override.
|
||||
/// </summary>
|
||||
public string SchemeOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the redirect port override.
|
||||
/// </summary>
|
||||
public int? PortOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the new, more descriptive paths are to be used.
|
||||
/// </summary>
|
||||
public bool NewPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a mapping of canonical names from the provider to jellyfin user ids.
|
||||
/// </summary>
|
||||
@@ -222,6 +302,36 @@ public class OidConfig
|
||||
/// Gets or sets the default username claim when creating new accounts.
|
||||
/// </summary>
|
||||
public string DefaultUsernameClaim { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the URL format of the new user avatar.
|
||||
/// </summary>
|
||||
public string AvatarUrlFormat { 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 pushed authorization is required.
|
||||
/// </summary>
|
||||
public bool DisablePushedAuthorization { 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>
|
||||
/// Gets or sets a value indicating whether the UserInfo endpoint is used to get profile data.
|
||||
/// </summary>
|
||||
public bool DoNotLoadProfile { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+27
-19
@@ -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)) {
|
||||
@@ -301,12 +301,20 @@ const ssoConfigurationPage = {
|
||||
|
||||
form_elements.text_fields.forEach((id) => {
|
||||
const value = page.querySelector("#" + id).value;
|
||||
if (value) current_config[id] = page.querySelector("#" + id).value;
|
||||
if (value) {
|
||||
current_config[id] = page.querySelector("#" + id).value;
|
||||
} else {
|
||||
current_config[id] = null;
|
||||
}
|
||||
});
|
||||
|
||||
form_elements.json_fields.forEach((id) => {
|
||||
const value = page.querySelector("#" + id).value;
|
||||
if (value) current_config[id] = JSON.parse(value);
|
||||
if (value) {
|
||||
current_config[id] = JSON.parse(value);
|
||||
} else {
|
||||
current_config[id] = null;
|
||||
}
|
||||
});
|
||||
|
||||
form_elements.check_fields.forEach((id) => {
|
||||
@@ -315,7 +323,7 @@ const ssoConfigurationPage = {
|
||||
|
||||
form_elements.text_list_fields.forEach((id) => {
|
||||
current_config[id] = ssoConfigurationPage.parseTextList(
|
||||
page.querySelector("#" + id)
|
||||
page.querySelector("#" + id),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -334,7 +342,7 @@ const ssoConfigurationPage = {
|
||||
|
||||
ApiClient.updatePluginConfiguration(
|
||||
ssoConfigurationPage.pluginUniqueId,
|
||||
config
|
||||
config,
|
||||
).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
ssoConfigurationPage.loadConfiguration(page);
|
||||
|
||||
+244
-11
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SSO</title>
|
||||
@@ -73,7 +73,7 @@
|
||||
<div class="collapseContent">
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="selectProvider"
|
||||
>Name of OID Provider:
|
||||
>Name of OpenID Provider:
|
||||
</label>
|
||||
<select
|
||||
is="emby-select"
|
||||
@@ -123,7 +123,7 @@
|
||||
<label
|
||||
class="inputLabel inputLabelUnfocused"
|
||||
for="OidProviderName"
|
||||
>Name of OID Provider:</label
|
||||
>Name of OpenID Provider:</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
@@ -133,20 +133,20 @@
|
||||
class="sso-text"
|
||||
/>
|
||||
<div class="fieldDescription">
|
||||
The name used by Jellyfin to identify the OID provider.
|
||||
The name used by Jellyfin to identify the OpenID provider.
|
||||
<br />
|
||||
If an OID provider with a matching name does not exist, a
|
||||
If an OpenID provider with a matching name does not exist, a
|
||||
new provider with this name will be created.
|
||||
<br />
|
||||
If an OID provider with a matching name already exists, the
|
||||
settings for that provider will be updated.
|
||||
If an OpenID provider with a matching name already exists,
|
||||
the settings for that provider will be updated.
|
||||
</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label
|
||||
class="inputLabel inputLabelUnfocused"
|
||||
for="OidEndpoint"
|
||||
>OID Endpoint:</label
|
||||
>OpenID Endpoint:</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
@@ -181,7 +181,7 @@
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="OidSecret"
|
||||
>OID Secret:</label
|
||||
>OpenID client secret:</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
@@ -191,7 +191,7 @@
|
||||
class="sso-text"
|
||||
/>
|
||||
<div class="fieldDescription">
|
||||
The OpenID secret. Randomly generated & shared.
|
||||
The OpenID client secret. Randomly generated & shared.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
@@ -377,7 +480,9 @@
|
||||
list of strings from the OIDC server.
|
||||
<br />
|
||||
For Keycloak, it is <code>realm_access.roles</code> by
|
||||
default.
|
||||
default for realm roles. For client roles, it is
|
||||
<code>resource_access.>clientId<.roles</code>
|
||||
(e.g. resource_access.jellyfin.roles)
|
||||
<br />
|
||||
For Authelia, it is <code>groups</code>
|
||||
</div>
|
||||
@@ -456,6 +561,134 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label
|
||||
class="inputLabel inputLabelUnfocused"
|
||||
for="AvatarUrlFormat"
|
||||
>Set avatar url format</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
id="AvatarUrlFormat"
|
||||
type="text"
|
||||
class="sso-text"
|
||||
/>
|
||||
<div class="fieldDescription">
|
||||
The url of the avatar with sso variable format: example :
|
||||
<code>https://example.com/@{user_id}.png</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">
|
||||
<label>
|
||||
<input
|
||||
is="emby-checkbox"
|
||||
id="DisablePushedAuthorization"
|
||||
name="DisablePushedAuthorization"
|
||||
type="checkbox"
|
||||
class="sso-toggle"
|
||||
/>
|
||||
<span
|
||||
>Disable Pushed Authorization (Insecure). May be needed
|
||||
for Authelia.</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>
|
||||
<div
|
||||
class="checkboxContainer checkboxContainer-withDescription"
|
||||
>
|
||||
<label>
|
||||
<input
|
||||
is="emby-checkbox"
|
||||
id="DoNotLoadProfile"
|
||||
name="DoNotLoadProfile"
|
||||
type="checkbox"
|
||||
class="sso-toggle"
|
||||
/>
|
||||
<span>Do Not Load Profile Information</span>
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">
|
||||
May be required for Cloudflare OpenID
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="RoleClaim"
|
||||
>Scheme Override</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
id="SchemeOverride"
|
||||
type="text"
|
||||
class="sso-text"
|
||||
/>
|
||||
<div class="fieldDescription">
|
||||
If the plugin is redirecting to an insecure URL, set this to
|
||||
"https"
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="RoleClaim"
|
||||
>Port Override</label
|
||||
>
|
||||
<input
|
||||
is="emby-input"
|
||||
id="PortOverride"
|
||||
type="text"
|
||||
class="sso-text"
|
||||
/>
|
||||
<div class="fieldDescription">
|
||||
If the plugin is redirecting to an incorrect port, set this
|
||||
to the appropiate port
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
id="SaveProvider"
|
||||
is="emby-button"
|
||||
|
||||
@@ -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");
|
||||
@@ -61,14 +61,14 @@
|
||||
is="emby-linkbutton"
|
||||
href="https://github.com/9p4/jellyfin-plugin-sso"
|
||||
class="button-link"
|
||||
>help page</a
|
||||
>homepage</a
|
||||
>
|
||||
and
|
||||
<a
|
||||
is="emby-linkbutton"
|
||||
href="https://github.com/9p4/jellyfin-plugin-sso/projects/1"
|
||||
href="https://github.com/9p4/jellyfin-plugin-sso/issues"
|
||||
class="button-link"
|
||||
>roadmap
|
||||
>issue tracker
|
||||
</a>
|
||||
for more information.
|
||||
</p>
|
||||
|
||||
+10
-10
@@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>SSO_Auth</RootNamespace>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Library.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace SSO_Auth.Lib
|
||||
|
||||
module Say =
|
||||
let hello name =
|
||||
printfn "Hello %s" name
|
||||
@@ -1,10 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Jellyfin.Plugin.SSO_Auth</RootNamespace>
|
||||
<AssemblyVersion>3.3.0.0</AssemblyVersion>
|
||||
<FileVersion>3.3.0.0</FileVersion>
|
||||
<AssemblyVersion>4.0.0.4</AssemblyVersion>
|
||||
<FileVersion>4.0.0.4</FileVersion>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
@@ -29,19 +29,23 @@
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="IdentityModel.OidcClient" Version="5.0.0" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.*-*" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.0" />
|
||||
<PackageReference Include="Duende.IdentityModel.OidcClient" Version="6.0.1" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.11.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.11.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
|
||||
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="Lib\Lib.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class Response
|
||||
/// <param name="certificateBytes">The certificate formatted as an array of bytes.</param>
|
||||
public Response(byte[] certificateBytes)
|
||||
{
|
||||
_certificate = new X509Certificate2(certificateBytes);
|
||||
_certificate = X509CertificateLoader.LoadCertificate(certificateBytes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -83,4 +83,4 @@ public class SSOViewsController : ControllerBase
|
||||
{
|
||||
return ServeView(viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -238,36 +240,42 @@ Emby Button
|
||||
/* fonts.scss */
|
||||
|
||||
html {
|
||||
font-family: "Noto Sans", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR",
|
||||
"Noto Sans SC", "Noto Sans TC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
|
||||
"Noto Sans TC", sans-serif;
|
||||
text-size-adjust: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
html[lang|="ja"] {
|
||||
font-family: "Noto Sans", "Noto Sans JP", "Noto Sans HK", "Noto Sans KR",
|
||||
"Noto Sans SC", "Noto Sans TC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans JP", "Noto Sans HK", "Noto Sans KR", "Noto Sans SC",
|
||||
"Noto Sans TC", sans-serif;
|
||||
}
|
||||
|
||||
html[lang|="ko"] {
|
||||
font-family: "Noto Sans", "Noto Sans KR", "Noto Sans HK", "Noto Sans JP",
|
||||
"Noto Sans SC", "Noto Sans TC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans KR", "Noto Sans HK", "Noto Sans JP", "Noto Sans SC",
|
||||
"Noto Sans TC", sans-serif;
|
||||
}
|
||||
|
||||
html[lang|="zh-CN"] {
|
||||
font-family: "Noto Sans", "Noto Sans SC", "Noto Sans HK", "Noto Sans JP",
|
||||
"Noto Sans KR", "Noto Sans TC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans SC", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR",
|
||||
"Noto Sans TC", sans-serif;
|
||||
}
|
||||
|
||||
html[lang|="zh-TW"] {
|
||||
font-family: "Noto Sans", "Noto Sans TC", "Noto Sans HK", "Noto Sans JP",
|
||||
"Noto Sans KR", "Noto Sans SC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans TC", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR",
|
||||
"Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
html[lang|="zh-HK"] {
|
||||
font-family: "Noto Sans", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR",
|
||||
"Noto Sans SC", "Noto Sans TC", sans-serif;
|
||||
font-family:
|
||||
"Noto Sans", "Noto Sans HK", "Noto Sans JP", "Noto Sans KR", "Noto Sans SC",
|
||||
"Noto Sans TC", sans-serif;
|
||||
}
|
||||
|
||||
.layout-tv {
|
||||
|
||||
+101
-91
@@ -1,3 +1,5 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Jellyfin.Plugin.SSO_Auth;
|
||||
|
||||
/// <summary>
|
||||
@@ -9,7 +11,16 @@ public static class WebResponse
|
||||
/// The shared HTML between all of the responses.
|
||||
/// </summary>
|
||||
public static readonly string Base = @"<!DOCTYPE html>
|
||||
<html><head></head><body>
|
||||
<html><head>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<style>
|
||||
body {
|
||||
background: #101010;
|
||||
color: #d1cfce;
|
||||
font-family: Noto Sans, Noto Sans HK, Noto Sans JP, Noto Sans KR, Noto Sans SC, Noto Sans TC, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<p>Logging in...</p>
|
||||
<noscript>Please enable Javascript to complete the login</noscript>
|
||||
<script>
|
||||
@@ -35,25 +46,14 @@ function isTv() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isWeb0s()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isWeb0s();
|
||||
}
|
||||
|
||||
function isWeb0s() {
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
if (userAgent.indexOf('netcast') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('web0s') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return userAgent.indexOf('netcast') !== -1
|
||||
|| userAgent.indexOf('web0s') !== -1;
|
||||
}
|
||||
|
||||
function isMobile(userAgent) {
|
||||
@@ -100,11 +100,7 @@ function hasKeyboard(browser) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.tv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !!browser.tv;
|
||||
}
|
||||
|
||||
function iOSversion() {
|
||||
@@ -147,8 +143,12 @@ function web0sVersion(browser) {
|
||||
|
||||
// The next is only valid for the app
|
||||
|
||||
if (browser.versionMajor >= 79) {
|
||||
return 6;
|
||||
if (browser.versionMajor >= 94) {
|
||||
return 23;
|
||||
} else if (browser.versionMajor >= 87) {
|
||||
return 22;
|
||||
} else if (browser.versionMajor >= 79) {
|
||||
return 6;
|
||||
} else if (browser.versionMajor >= 68) {
|
||||
return 5;
|
||||
} else if (browser.versionMajor >= 53) {
|
||||
@@ -179,14 +179,11 @@ let _supportsCssAnimation;
|
||||
let _supportsCssAnimationWithPrefix;
|
||||
function supportsCssAnimation(allowPrefix) {
|
||||
// TODO: Assess if this is still needed, as all of our targets should natively support CSS animations.
|
||||
if (allowPrefix) {
|
||||
if (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false) {
|
||||
return _supportsCssAnimationWithPrefix;
|
||||
}
|
||||
} else {
|
||||
if (_supportsCssAnimation === true || _supportsCssAnimation === false) {
|
||||
return _supportsCssAnimation;
|
||||
}
|
||||
if (allowPrefix && (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false)) {
|
||||
return _supportsCssAnimationWithPrefix;
|
||||
}
|
||||
if (_supportsCssAnimation === true || _supportsCssAnimation === false) {
|
||||
return _supportsCssAnimation;
|
||||
}
|
||||
|
||||
let animation = false;
|
||||
@@ -198,8 +195,8 @@ function supportsCssAnimation(allowPrefix) {
|
||||
}
|
||||
|
||||
if (animation === false && allowPrefix) {
|
||||
for (let i = 0; i < domPrefixes.length; i++) {
|
||||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
||||
for (const domPrefix of domPrefixes) {
|
||||
if (elm.style[domPrefix + 'AnimationName'] !== undefined) {
|
||||
animation = true;
|
||||
break;
|
||||
}
|
||||
@@ -218,25 +215,25 @@ function supportsCssAnimation(allowPrefix) {
|
||||
const uaMatch = function (ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
const match = /(edg)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(edga)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(edgios)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(edge)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(opera)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(opr)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(chrome)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(safari)[ /]([\w.]+)/.exec(ua) ||
|
||||
/(firefox)[ /]([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
const match = /(chrome)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(edg)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(edga)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(edgios)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(edge)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(opera)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(opr)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(safari)[ /]([\w.]+)/.exec(ua)
|
||||
|| /(firefox)[ /]([\w.]+)/.exec(ua)
|
||||
|| ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)
|
||||
|| [];
|
||||
|
||||
const versionMatch = /(version)[ /]([\w.]+)/.exec(ua);
|
||||
|
||||
let platform_match = /(ipad)/.exec(ua) ||
|
||||
/(iphone)/.exec(ua) ||
|
||||
/(windows)/.exec(ua) ||
|
||||
/(android)/.exec(ua) ||
|
||||
[];
|
||||
let platform_match = /(ipad)/.exec(ua)
|
||||
|| /(iphone)/.exec(ua)
|
||||
|| /(windows)/.exec(ua)
|
||||
|| /(android)/.exec(ua)
|
||||
|| [];
|
||||
|
||||
let browser = match[1] || '';
|
||||
|
||||
@@ -255,7 +252,7 @@ const uaMatch = function (ua) {
|
||||
|
||||
version = version || match[2] || '0';
|
||||
|
||||
let versionMajor = parseInt(version.split('.')[0]);
|
||||
let versionMajor = parseInt(version.split('.')[0], 10);
|
||||
|
||||
if (isNaN(versionMajor)) {
|
||||
versionMajor = 0;
|
||||
@@ -313,7 +310,9 @@ if (userAgent.toLowerCase().indexOf('xbox') !== -1) {
|
||||
browser.tv = true;
|
||||
}
|
||||
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
||||
browser.hisense = userAgent.toLowerCase().includes('hisense');
|
||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || window.tizen != null;
|
||||
browser.vidaa = userAgent.toLowerCase().includes('vidaa');
|
||||
browser.web0s = isWeb0s();
|
||||
browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1);
|
||||
|
||||
@@ -324,7 +323,7 @@ if (browser.web0s) {
|
||||
delete browser.safari;
|
||||
|
||||
const v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
||||
browser.tizenVersion = parseInt(v[1]);
|
||||
browser.tizenVersion = parseInt(v[1], 10);
|
||||
} else {
|
||||
browser.orsay = userAgent.toLowerCase().indexOf('smarthub') !== -1;
|
||||
}
|
||||
@@ -340,11 +339,9 @@ if (browser.mobile || browser.tv) {
|
||||
browser.slow = true;
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
||||
browser.touch = true;
|
||||
}
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (typeof document !== 'undefined' && ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
||||
browser.touch = true;
|
||||
}
|
||||
|
||||
browser.keyboard = hasKeyboard(browser);
|
||||
@@ -361,39 +358,41 @@ if (browser.iOS) {
|
||||
}
|
||||
|
||||
function getDeviceName() {
|
||||
var deviceName = '';
|
||||
if (browser.tizen) {
|
||||
deviceName = 'Samsung Smart TV';
|
||||
} else if (browser.web0s) {
|
||||
deviceName = 'LG Smart TV';
|
||||
} else if (browser.operaTv) {
|
||||
deviceName = 'Opera TV';
|
||||
} else if (browser.xboxOne) {
|
||||
deviceName = 'Xbox One';
|
||||
} else if (browser.ps4) {
|
||||
deviceName = 'Sony PS4';
|
||||
} else if (browser.chrome) {
|
||||
deviceName = 'Chrome';
|
||||
} else if (browser.edgeChromium) {
|
||||
deviceName = 'Edge Chromium';
|
||||
} else if (browser.edge) {
|
||||
deviceName = 'Edge';
|
||||
} else if (browser.firefox) {
|
||||
deviceName = 'Firefox';
|
||||
} else if (browser.opera) {
|
||||
deviceName = 'Opera';
|
||||
} else if (browser.safari) {
|
||||
deviceName = 'Safari';
|
||||
} else {
|
||||
deviceName = 'Web Browser';
|
||||
}
|
||||
var deviceName = '';
|
||||
if (!deviceName) {
|
||||
if (browser.tizen) {
|
||||
deviceName = 'Samsung Smart TV';
|
||||
} else if (browser.web0s) {
|
||||
deviceName = 'LG Smart TV';
|
||||
} else if (browser.operaTv) {
|
||||
deviceName = 'Opera TV';
|
||||
} else if (browser.xboxOne) {
|
||||
deviceName = 'Xbox One';
|
||||
} else if (browser.ps4) {
|
||||
deviceName = 'Sony PS4';
|
||||
} else if (browser.chrome) {
|
||||
deviceName = 'Chrome';
|
||||
} else if (browser.edgeChromium) {
|
||||
deviceName = 'Edge Chromium';
|
||||
} else if (browser.edge) {
|
||||
deviceName = 'Edge';
|
||||
} else if (browser.firefox) {
|
||||
deviceName = 'Firefox';
|
||||
} else if (browser.opera) {
|
||||
deviceName = 'Opera';
|
||||
} else if (browser.safari) {
|
||||
deviceName = 'Safari';
|
||||
} else {
|
||||
deviceName = 'Web Browser';
|
||||
}
|
||||
|
||||
if (browser.ipad) {
|
||||
deviceName += ' iPad';
|
||||
} else if (browser.iphone) {
|
||||
deviceName += ' iPhone';
|
||||
} else if (browser.android) {
|
||||
deviceName += ' Android';
|
||||
if (browser.ipad) {
|
||||
deviceName += ' iPad';
|
||||
} else if (browser.iphone) {
|
||||
deviceName += ' iPhone';
|
||||
} else if (browser.android) {
|
||||
deviceName += ' Android';
|
||||
}
|
||||
}
|
||||
|
||||
return deviceName;
|
||||
@@ -416,6 +415,14 @@ const sleep = (milliseconds) => {
|
||||
/// <returns>A string with the HTML to serve to the client.</returns>
|
||||
public static string Generator(string data, string provider, string baseUrl, string mode, bool isLinking = false)
|
||||
{
|
||||
// Strip out the protocol (http:// or https://) and convert the domain to Punycode
|
||||
var idnMapping = new IdnMapping();
|
||||
var protocolSeparatorIndex = baseUrl.IndexOf("//");
|
||||
var protocol = baseUrl.Substring(0, protocolSeparatorIndex + 2);
|
||||
var domain = baseUrl.Substring(protocolSeparatorIndex + 2);
|
||||
var punycodeDomain = idnMapping.GetAscii(domain);
|
||||
var punycodeBaseUrl = protocol + punycodeDomain;
|
||||
|
||||
return Base + @"
|
||||
async function link(request) {
|
||||
const jfCredentialsString = localStorage.getItem(""jellyfin_credentials"");
|
||||
@@ -429,7 +436,7 @@ async function link(request) {
|
||||
if (jfUser == null) return;
|
||||
if (jfToken == null) return;
|
||||
|
||||
const url = '" + $"{baseUrl}/sso/{mode}/Link/{provider}/" + @"' + jfUser;
|
||||
const url = '" + $"{punycodeBaseUrl}/sso/{mode}/Link/{provider}/" + @"' + jfUser;
|
||||
|
||||
return new Promise(resolve => {
|
||||
var xhr = new XMLHttpRequest();
|
||||
@@ -453,6 +460,9 @@ async function link(request) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
localStorage.removeItem('jellyfin_credentials');
|
||||
document.getElementById('iframe-main').src = '" + punycodeBaseUrl + @"/web/index.html';
|
||||
|
||||
var data = '" + data + @"';
|
||||
while (localStorage.getItem(""_deviceId2"") == null ||
|
||||
localStorage.getItem(""jellyfin_credentials"") == null ||
|
||||
@@ -469,7 +479,7 @@ async function main() {
|
||||
|
||||
if (" + $"{isLinking}".ToLower() + @") await link(request);
|
||||
|
||||
var url = '" + baseUrl + "/sso/" + mode + "/Auth/" + provider + @"';
|
||||
var url = '" + punycodeBaseUrl + "/sso/" + mode + "/Auth/" + provider + @"';
|
||||
|
||||
let response = await new Promise(resolve => {
|
||||
var xhr = new XMLHttpRequest();
|
||||
@@ -493,7 +503,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('" + punycodeBaseUrl + @"/web/index.html');
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
@@ -501,6 +511,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 id='iframe-main' class='docs-texteventtarget-iframe' sandbox='allow-same-origin allow-forms allow-scripts' src='' style='position: absolute;width:0;height:0;border:0;'></iframe></body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
+16
-5
@@ -1,9 +1,9 @@
|
||||
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"
|
||||
targetAbi: "10.8.0.0"
|
||||
framework: "net6.0"
|
||||
version: "4.0.0.4"
|
||||
targetAbi: "10.11.0.0"
|
||||
framework: "net9.0"
|
||||
owner: "9p4"
|
||||
overview: "Authenticate users against an SSO provider."
|
||||
description: |
|
||||
@@ -12,9 +12,20 @@ description: |
|
||||
category: "Authentication"
|
||||
artifacts:
|
||||
- "SSO-Auth.dll"
|
||||
- "IdentityModel.OidcClient.dll"
|
||||
- "IdentityModel.dll"
|
||||
- "Duende.IdentityModel.OidcClient.dll"
|
||||
- "Duende.IdentityModel.dll"
|
||||
changelog: |
|
||||
4.0.0.4: Fix security issue in SAML
|
||||
4.0.0.0: Jellyfin 10.11
|
||||
3.5.3.0: Allow for OID-provided avatars, various bugfixes and workarounds
|
||||
3.5.2.4: Updates for Jellyfin 10.9
|
||||
3.5.2.3: Improve OpenID discovery policy security rules, fix iOS login bugs related to cache
|
||||
3.5.2.2: Fix linking page when using new paths
|
||||
3.5.2.1: Hotfix for SAML null checks
|
||||
3.5.2.0: Allow overriding the scheme used for generating URLs.
|
||||
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
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1760934318,
|
||||
"narHash": "sha256-/oUYsC0lUCBory65VK+UHqCCsCspbL1Vgfcf1KUYqVw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "87848bf0cc4f87717fc813a4575f07330c3e743c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -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_9 ]; };
|
||||
};
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
+68
-61
@@ -1,68 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||
<!-- disable warning SA1202: 'public' members must come before 'private' members -->
|
||||
<Rule Id="SA1202" Action="Info" />
|
||||
<!-- disable warning SA1204: Static members must appear before non-static members -->
|
||||
<Rule Id="SA1204" Action="Info" />
|
||||
<!-- disable warning SA1404: Code analysis suppression should have justification -->
|
||||
<Rule Id="SA1404" Action="Info" />
|
||||
<RuleSet Name="Rules for Jellyfin.Server"
|
||||
Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||
<!-- disable warning SA1202: 'public' members must come before 'private' members -->
|
||||
<Rule Id="SA1202" Action="Info" />
|
||||
<!-- disable warning SA1204: Static members must appear before non-static members -->
|
||||
<Rule Id="SA1204" Action="Info" />
|
||||
<!-- disable warning SA1404: Code analysis suppression should have justification -->
|
||||
<Rule Id="SA1404" Action="Info" />
|
||||
|
||||
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
|
||||
<Rule Id="SA1009" Action="None" />
|
||||
<!-- disable warning SA1101: Prefix local calls with 'this.' -->
|
||||
<Rule Id="SA1101" Action="None" />
|
||||
<!-- disable warning SA1108: Block statements should not contain embedded comments -->
|
||||
<Rule Id="SA1108" Action="None" />
|
||||
<!-- disable warning SA1128:: Put constructor initializers on their own line -->
|
||||
<Rule Id="SA1128" Action="None" />
|
||||
<!-- disable warning SA1130: Use lambda syntax -->
|
||||
<Rule Id="SA1130" Action="None" />
|
||||
<!-- disable warning SA1200: 'using' directive must appear within a namespace declaration -->
|
||||
<Rule Id="SA1200" Action="None" />
|
||||
<!-- disable warning SA1309: Fields must not begin with an underscore -->
|
||||
<Rule Id="SA1309" Action="None" />
|
||||
<!-- disable warning SA1413: Use trailing comma in multi-line initializers -->
|
||||
<Rule Id="SA1413" Action="None" />
|
||||
<!-- disable warning SA1512: Single-line comments must not be followed by blank line -->
|
||||
<Rule Id="SA1512" Action="None" />
|
||||
<!-- disable warning SA1515: Single-line comment should be preceded by blank line -->
|
||||
<Rule Id="SA1515" Action="None" />
|
||||
<!-- disable warning SA1600: Elements should be documented -->
|
||||
<Rule Id="SA1600" Action="None" />
|
||||
<!-- disable warning SA1633: The file header is missing or not located at the top of the file -->
|
||||
<Rule Id="SA1633" Action="None" />
|
||||
</Rules>
|
||||
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
|
||||
<Rule Id="SA1009" Action="None" />
|
||||
<!-- disable warning SA1101: Prefix local calls with 'this.' -->
|
||||
<Rule Id="SA1101" Action="None" />
|
||||
<!-- disable warning SA1108: Block statements should not contain embedded comments -->
|
||||
<Rule Id="SA1108" Action="None" />
|
||||
<!-- disable warning SA1128:: Put constructor initializers on their own line -->
|
||||
<Rule Id="SA1128" Action="None" />
|
||||
<!-- disable warning SA1130: Use lambda syntax -->
|
||||
<Rule Id="SA1130" Action="None" />
|
||||
<!-- disable warning SA1200: 'using' directive must appear within a namespace declaration -->
|
||||
<Rule Id="SA1200" Action="None" />
|
||||
<!-- disable warning SA1309: Fields must not begin with an underscore -->
|
||||
<Rule Id="SA1309" Action="None" />
|
||||
<!-- disable warning SA1402: File may only contain a single type -->
|
||||
<Rule Id="SA1402" Action="None" />
|
||||
<!-- disable warning SA1413: Use trailing comma in multi-line initializers -->
|
||||
<Rule Id="SA1413" Action="None" />
|
||||
<!-- disable warning SA1512: Single-line comments must not be followed by blank line -->
|
||||
<Rule Id="SA1512" Action="None" />
|
||||
<!-- disable warning SA1515: Single-line comment should be preceded by blank line -->
|
||||
<Rule Id="SA1515" Action="None" />
|
||||
<!-- disable warning SA1600: Elements should be documented -->
|
||||
<Rule Id="SA1600" Action="None" />
|
||||
<!-- disable warning SA1633: The file header is missing or not located at the top of the
|
||||
file -->
|
||||
<Rule Id="SA1633" Action="None" />
|
||||
<!-- disable warning SA1649: File name should match first type name -->
|
||||
<Rule Id="SA1649" Action="None" />
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="Microsoft.CodeAnalysis.FxCopAnalyzers" RuleNamespace="Microsoft.Design">
|
||||
<!-- disable warning CA1031: Do not catch general exception types -->
|
||||
<Rule Id="CA1031" Action="Info" />
|
||||
<!-- disable warning CA1032: Implement standard exception constructors -->
|
||||
<Rule Id="CA1032" Action="Info" />
|
||||
<!-- disable warning CA1062: Validate arguments of public methods -->
|
||||
<Rule Id="CA1062" Action="Info" />
|
||||
<!-- disable warning CA1716: Identifiers should not match keywords -->
|
||||
<Rule Id="CA1716" Action="Info" />
|
||||
<!-- disable warning CA1720: Identifiers should not contain type names -->
|
||||
<Rule Id="CA1720" Action="Info" />
|
||||
<!-- disable warning CA1812: internal class that is apparently never instantiated.
|
||||
<Rules AnalyzerId="Microsoft.CodeAnalysis.FxCopAnalyzers" RuleNamespace="Microsoft.Design">
|
||||
<!-- disable warning CA1031: Do not catch general exception types -->
|
||||
<Rule Id="CA1031" Action="Info" />
|
||||
<!-- disable warning CA1032: Implement standard exception constructors -->
|
||||
<Rule Id="CA1032" Action="Info" />
|
||||
<!-- disable warning CA1062: Validate arguments of public methods -->
|
||||
<Rule Id="CA1062" Action="Info" />
|
||||
<!-- disable warning CA1716: Identifiers should not match keywords -->
|
||||
<Rule Id="CA1716" Action="Info" />
|
||||
<!-- disable warning CA1720: Identifiers should not contain type names -->
|
||||
<Rule Id="CA1720" Action="Info" />
|
||||
<!-- disable warning CA1812: internal class that is apparently never instantiated.
|
||||
If so, remove the code from the assembly.
|
||||
If this class is intended to contain only static members, make it static -->
|
||||
<Rule Id="CA1812" Action="Info" />
|
||||
<!-- disable warning CA1822: Member does not access instance data and can be marked as static -->
|
||||
<Rule Id="CA1822" Action="Info" />
|
||||
<!-- disable warning CA2000: Dispose objects before losing scope -->
|
||||
<Rule Id="CA2000" Action="Info" />
|
||||
<Rule Id="CA1812" Action="Info" />
|
||||
<!-- disable warning CA1822: Member does not access instance data and can be marked as
|
||||
static -->
|
||||
<Rule Id="CA1822" Action="Info" />
|
||||
<!-- disable warning CA2000: Dispose objects before losing scope -->
|
||||
<Rule Id="CA2000" Action="Info" />
|
||||
|
||||
<!-- disable warning CA1054: Change the type of parameter url from string to System.Uri -->
|
||||
<Rule Id="CA1054" Action="None" />
|
||||
<!-- disable warning CA1055: URI return values should not be strings -->
|
||||
<Rule Id="CA1055" Action="None" />
|
||||
<!-- disable warning CA1056: URI properties should not be strings -->
|
||||
<Rule Id="CA1056" Action="None" />
|
||||
<!-- disable warning CA1303: Do not pass literals as localized parameters -->
|
||||
<Rule Id="CA1303" Action="None" />
|
||||
<!-- disable warning CA1308: Normalize strings to uppercase -->
|
||||
<Rule Id="CA1308" Action="None" />
|
||||
</Rules>
|
||||
<!-- disable warning CA1054: Change the type of parameter url from string to System.Uri -->
|
||||
<Rule Id="CA1054" Action="None" />
|
||||
<!-- disable warning CA1055: URI return values should not be strings -->
|
||||
<Rule Id="CA1055" Action="None" />
|
||||
<!-- disable warning CA1056: URI properties should not be strings -->
|
||||
<Rule Id="CA1056" Action="None" />
|
||||
<!-- disable warning CA1303: Do not pass literals as localized parameters -->
|
||||
<Rule Id="CA1303" Action="None" />
|
||||
<!-- disable warning CA1308: Normalize strings to uppercase -->
|
||||
<Rule Id="CA1308" Action="None" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
|
||||
+110
-5
@@ -2,6 +2,8 @@
|
||||
|
||||
This plugin has been tested to work against various providers, though not all providers provide support for all of this plugins' features.
|
||||
|
||||
❗ Before you proceed, make sure you have another admin account if you are going to link SSO provider to the only admin account on the server, permission might get overwritten (see [#212](https://github.com/9p4/jellyfin-plugin-sso/issues/212)).
|
||||
|
||||
## TOC / Tested Providers:
|
||||
|
||||
This section is broken into providers that support Role-Based Access Control (RBAC), and those that do not
|
||||
@@ -10,13 +12,15 @@ This section is broken into providers that support Role-Based Access Control (RB
|
||||
|
||||
- ✅ [Authelia](#authelia)
|
||||
- ✅ [authentik](#authentik)
|
||||
- [✅ Keycloak](#keycloak-oidc)
|
||||
- ✅ [Keycloak](#keycloak-oidc)
|
||||
- Both [OIDC](#keycloak-oidc) & [SAML](#keycloak-saml)
|
||||
- ✅ [Pocket ID](#pocket-id)
|
||||
|
||||
### No RBAC Support
|
||||
|
||||
- ✅ Google OIDC
|
||||
- ❗ Usernames are numeric
|
||||
- ❗ Requires disabling validating OpenID endpoints
|
||||
|
||||
## General Options, when RBAC is supported
|
||||
|
||||
@@ -41,6 +45,25 @@ Authelia is simple to configure, and RBAC is straightforward.
|
||||
|
||||
Below is the `identity_providers` section of an Authelia config:
|
||||
|
||||
### Authelia v4.38 and above
|
||||
|
||||
```yaml
|
||||
identity_providers:
|
||||
oidc:
|
||||
# hmac secret and private key given by env variables
|
||||
clients:
|
||||
- client_id: jellyfin
|
||||
client_name: My media server
|
||||
# Client secret should be randomly generated
|
||||
client_secret: <redacted>
|
||||
token_endpoint_auth_method: client_secret_post
|
||||
authorization_policy: one_factor
|
||||
redirect_uris:
|
||||
- https://jellyfin.example.com/sso/OID/redirect/authelia
|
||||
```
|
||||
|
||||
### Authelia v4.37 and below
|
||||
|
||||
```yaml
|
||||
identity_providers:
|
||||
oidc:
|
||||
@@ -52,7 +75,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
|
||||
@@ -68,6 +91,7 @@ authelia:
|
||||
OidSecret: <redacted>
|
||||
RoleClaim: groups
|
||||
OidScopes: ["groups"]
|
||||
DisablePushedAuthorization: true
|
||||
```
|
||||
|
||||
## authentik
|
||||
@@ -113,6 +137,7 @@ Now we can add this property mapping to authentik's Jellyfin OAuth provider:
|
||||

|
||||
|
||||
- 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
|
||||
|
||||

|
||||
@@ -132,6 +157,8 @@ authentik:
|
||||
OidScopes: ["groups"]
|
||||
```
|
||||
|
||||
If you recieve the error `Error processing request.` from Jellyfin when attempting to login and the Jellyfin logs show `Error loading discovery document: Endpoint belongs to different authority` try setting `Do not validate endpoints` in the plugin settings.
|
||||
|
||||
## Keycloak OIDC
|
||||
|
||||
Keycloak in general is a little more complicated than other providers. Ensure that you have a realm created and have some usable users.
|
||||
@@ -144,7 +171,8 @@ 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
|
||||
- Redirect URI (for Android app): org.jellyfin.mobile://login-callback
|
||||
- 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 +206,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.
|
||||
|
||||
@@ -198,3 +226,80 @@ keycloak:
|
||||
SamlClientId: <same-as-in-keycloak>
|
||||
SamlCertificate: <copied-from-xml-file>
|
||||
```
|
||||
|
||||
## Pocket ID
|
||||
|
||||
A simple and easy-to-use OIDC provider that allows users to authenticate with their passkeys to your services.
|
||||
|
||||
### Pocket ID Config
|
||||
|
||||
1. Login to you Pocket ID admin account
|
||||
1. Go to `Administration -> OCID Clients`
|
||||
1. Click `Add OCID Client`
|
||||
1. Give the client a name e.g. `Jellyfin`
|
||||
1. Set the `Clent Launch URL` to your Jellyfin endpoint
|
||||
1. Set the callbak url to `https://jellyfin.example.com/sso/OID/redirect/pocketid`. The `pocketid` part must match the `Name of OpenID Provider` in the Jellyfin SSO provider
|
||||
1. (optional) Enable PKCE if Jellyfin is an https endpoint
|
||||
1. (optional) Set a logo
|
||||
1. (optional) Set `Allowed User Groups`
|
||||
|
||||
### Jellyfin's Config
|
||||
|
||||
```yaml
|
||||
pocketid:
|
||||
OidEndpoint: https://pocketid.example.com/.well-known/openid-configuration
|
||||
OidClientId: <pocket-id-client-id>
|
||||
OidSecret: <pocket-id-secret>
|
||||
EnableAuthorization: true # (optional) If you want Jellyfin to read group permissions from pocket id
|
||||
RoleClaim: groups # (optional) If you want Jellyfin to be able to read group assignments from pocket id
|
||||
AdminRoles: admin # (optional) The pocket id group which will give a user Jellyfin admin privilges
|
||||
Roles: users # (optional) The pocket id group which will give a user Jellyfin access
|
||||
AvatarUrlFormat: @{picture} # (optional) This will pull each users pocket id photo into Jellyfin
|
||||
```
|
||||
|
||||
## Kanidm
|
||||
|
||||
Kanidm is a modern and simple identity management platform written in rust.
|
||||
|
||||
### Kanidm Config
|
||||
|
||||
```shell
|
||||
kanidm system oauth2 create jellyfin "Jellyfin" https://jellyfin.example.com/
|
||||
|
||||
# Set this to drop the trailing @idm.example.com in usernames
|
||||
kanidm system oauth2 prefer-short-username jellyfin
|
||||
|
||||
kanidm system oauth2 add-redirect-url jellyfin https://jellyfin.example.com/sso/OID/redirect/kanidm
|
||||
kanidm system oauth2 add-redirect-url jellyfin https://jellyfin.example.com/sso/OID/r/kanidm
|
||||
|
||||
# Optionally setup groups for Jellyfin
|
||||
kanidm group create jellyfin_admins
|
||||
kanidm group create jellyfin_users
|
||||
|
||||
kanidm system oauth2 update-scope-map jellyfin jellyfin_admins openid profile groups
|
||||
kanidm system oauth2 update-scope-map jellyfin jellyfin_users openid profile groups
|
||||
```
|
||||
|
||||
Get the secret used in the Jellyfin config with `kanidm system oauth2 show-basic-secret jellyfin`.
|
||||
|
||||
### Jellyfin's Config
|
||||
|
||||
```yaml
|
||||
kanidm:
|
||||
OidEndpoint: https://idm.example.com/oauth2/openid/jellyfin/
|
||||
OidClientId: jellyfin
|
||||
OidSecret: <kanidm-secret>
|
||||
# (optional) If you want Jellyfin to read group permissions from kanidm
|
||||
EnableAuthorization: true
|
||||
OidScopes:
|
||||
- groups
|
||||
RoleClaim: groups
|
||||
AdminsRoles:
|
||||
- jellyfin_admins@idm.example.com
|
||||
Roles:
|
||||
- jellyfin_users@idm.example.com
|
||||
# If in your setup admin accounts aren't members of the users group you need to add the admins group to roles as well
|
||||
- jellyfin_admins@idm.example.com
|
||||
# (optional) If you want the name attribute instead of the spn attribute as username
|
||||
DefaultUsernameClaim: preferred_username
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user