| Crates.io | oidc_pages |
| lib.rs | oidc_pages |
| version | 2.0.0 |
| created_at | 2024-07-07 15:59:57.522798+00 |
| updated_at | 2025-02-09 00:37:23.584219+00 |
| description | Serve static HTML with OIDC for authorization and authentication |
| homepage | |
| repository | https://github.com/newAM/oidc_pages |
| max_upload_size | |
| id | 1294976 |
| size | 228,008 |
OIDC Pages is a static HTML document server that integrates OpenID Connect (OIDC) for authentication and per-document authorization (permissions). OIDC Pages is designed to work seamlessly with documentation tools such as Sphinx, Doxygen, and mdbook, and can be used with any static HTML content.

roles_path setting in your configuration file.roles_path typically involves inspecting the return data from your OIDC provider. This can be done by examining the responses from a working application.These features may or may not happen.
Please report vulnerabilities to my git committer email.
This is designed to work with NixOS, but should work on any Linux OS with systemd.
You need to bring a reverse proxy for TLS, I suggest nginx.
https://pages.company.comhttps://pages.company.comhttps://pages.company.com/callbackOnOffStandard flow (all others disabled)admin role can view all pages<client_id> -> Client scopes
-> <client_id>-dedicated -> Configure a new mapper -> Audienceaud-mapper-<client_id><client_id>OnOnOffOnCreate the OAuth2 client:
kanidm system oauth2 create pages "pages.domain.name" https://pages.domain.name
kanidm system oauth2 update-scope-map pages oidc_pages_users email openid profile groups
kanidm system oauth2 get pages
kanidm system oauth2 show-basic-secret pages
<SECRET>
Create permission groups:
kanidm group create 'oidc_pages_users'
kanidm group create 'oidc_pages_pagename'
Setup the claim map:
kanidm system oauth2 update-claim-map-join 'pages' 'pages_roles' array
kanidm system oauth2 update-claim-map 'pages' 'pages_roles' 'oidc_pages_pagename' 'pagename'
Add users to the groups:
kanidm person update myusername --legalname "Personal Name" --mail "user@example.com"
kanidm group add-members 'oidc_pages_users' 'myusername'
kanidm group add-members 'oidc_pages_pagename' 'myusername'
Reference nixos/module.nix for a complete list of options,
below is an example of my configuration.
{
oidc_pages,
config,
...
}: let
pagesDomain = "pages.company.com";
in {
# import the module, this adds the "services.oidc_pages" options
imports = [oidc_pages.nixosModules.default];
# add the overlay, this puts "oidc_pages" into "pkgs"
nixpkgs.overlays = [oidc_pages.overlays.default];
# use nix-sops to manage secrets declaratively
# https://github.com/Mic92/sops-nix
sops.secrets.oidc_pages.mode = "0400";
# reference module for descriptions of configuration
services.oidc_pages = {
enable = true;
environmentFiles = [config.sops.secrets.oidc_pages.path];
# give nginx access to oidc_pages.socket
socketUser = config.services.nginx.user;
settings = {
public_url = "https://${pagesDomain}";
client_id = "pages";
pages_path = "/var/www/pages";
log_level = "info";
# provider specific:
# - keycloak: "https://sso.company.com/realms/company"
# - kanidm: "https://sso.company.com/oauth2/openid/${client_id}"
issuer_url = "";
# provider specific:
# - keycloak: ["roles"]
# - kanidm: []
additional_scopes = [];
# provider specific:
# - keycloak: ["resource_access" client_id "roles"]
# - kanidm: ["pages_roles"]
roles_path = [];
};
};
# use NGINX as a reverse proxy to provide a TLS (https) interface
networking.firewall.allowedTCPPorts = [443];
services.nginx = {
enable = true;
virtualHosts."${pagesDomain}" = {
onlySSL = true;
locations."/".proxyPass = "http://unix:${config.services.oidc_pages.bindPath}";
};
};
}