Skip to content

About

A Jellyfin plugin for Cloudflare Access - JWT-based authentication, allowing secure access validation with customizable token settings.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Jellyfin Cloudflare Access Authentication Plugin

This plugin integrates Cloudflare Access with Jellyfin, enabling JWT-based authentication. With this setup, users only need to authenticate once through Cloudflare Access, eliminating the need for repeated authentication within Jellyfin.

Features

  • Cloudflare Access Integration: Leverages JWT tokens from Cloudflare Access for secure user authentication.
  • Customizable Security Settings: Offers configurable token parameters to align with specific security requirements.

Caveats

  • Login Form Requirement: Users are still required to enter a value in the Jellyfin login form and press the login button, even though authentication is managed by Cloudflare.
  • Device Compatibility: Using Jellyfin behind Cloudflare Access may be incompatible with smart TVs or other devices relying on native apps instead of web browsers.

Prerequisites

Installation

Step 1: Download the Plugin

  • Visit the Releases page.
  • Download the latest release ZIP file.

Step 2: Install the Plugin

  • Extract the contents of the ZIP file.
  • Place the extracted folder into the plugins directory of your Jellyfin server. For more detailed installation instructions, refer to the official Jellyfin plugin installation guide.
  • Restart the Jellyfin server to load the new plugin.

Docker Installation

For Jellyfin running in Docker, the plugin directory inside the container is /config/plugins/. You need to create a subfolder named CFAuth/ and place the DLLs there.

Option A: Host volume mount (recommended)

# Create plugin directory on host
mkdir -p /your/jellyfin/plugins/CFAuth

# Copy DLLs from the release ZIP
unzip cfauth_1.2.0.0.zip -d /your/jellyfin/plugins/CFAuth/

# Restart your container (ensure you have -v /your/jellyfin/plugins:/config/plugins)
docker restart jellyfin

Option B: Copy into running container

# Create directory in container
docker exec jellyfin mkdir -p /config/plugins/CFAuth

# Copy DLLs
docker cp Jellyfin.Plugin.CFAuth.dll jellyfin:/config/plugins/CFAuth/
docker cp JWTValidation.dll jellyfin:/config/plugins/CFAuth/
docker cp Microsoft.IdentityModel.Abstractions.dll jellyfin:/config/plugins/CFAuth/
docker cp Microsoft.IdentityModel.JsonWebTokens.dll jellyfin:/config/plugins/CFAuth/
docker cp Microsoft.IdentityModel.Logging.dll jellyfin:/config/plugins/CFAuth/
docker cp Microsoft.IdentityModel.Tokens.dll jellyfin:/config/plugins/CFAuth/
docker cp System.IdentityModel.Tokens.Jwt.dll jellyfin:/config/plugins/CFAuth/

# Restart container
docker restart jellyfin

Important: Do not include Jellyfin.Database.Implementations.dll in the plugin folder — it conflicts with the version bundled in the Jellyfin container.

Jellyfin Version Compatibility

Plugin Version Jellyfin Version .NET Runtime
1.2.x 10.11.x .NET 9
1.1.x 10.10.x .NET 8
1.0.x 10.10.x .NET 8

Configuration

Step 1: Access Plugin Settings

  • Log in to your Jellyfin dashboard.
  • Navigate to Dashboard > Plugins.
  • Locate the Cloudflare Access Authentication Plugin and click on Settings.

Step 2: Configure Token Settings

  • Provide your Cloudflare Access JWT settings, including:
    • Teamname: The name of your Cloudflare Access team.
    • Audience: The audience claim expected in the token. You can specify multiple audiences separated by commas.
    • CookieName: The name of the cookie that contains the token. The default value typically works well.
    • HeaderName: The name of the header that contains the token. Again, the default value usually suffices.
  • Save the settings.

Note: Only one of either the cookie or the header must be present, with the cookie taking precedence if both are available.

Usage

Once configured, incoming requests to your Jellyfin server will be authenticated using JWT tokens issued by Cloudflare Access.

Note: If you have other applications, such as Jellyseerr, that authenticate through Jellyfin, make sure the plugin is configured to accept all relevant audience claims. Audience claims serve as identifiers for the intended recipients of the token. You can configure these by accessing the settings in your Cloudflare Access application and ensuring that all necessary audiences are listed in the plugin configuration. Additionally, these applications must forward the appropriate headers or cookies for authentication. Please note that I had to manually patch Jellyseerr to forward the headers; this patch is not included in this plugin.

Support

For issues or feature requests, please open an issue on the GitHub repository.

License

This project is licensed under the GPLv3 License.

Note: While I am not planning any further changes, I will address issues as they arise, and community contributions are highly encouraged.

About

A Jellyfin plugin for Cloudflare Access - JWT-based authentication, allowing secure access validation with customizable token settings.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages