2024-06-04 18:45:28 +03:00
|
|
|
{ config, depot, ... }:
|
2021-10-16 20:39:49 +03:00
|
|
|
let
|
2023-08-31 01:55:45 +03:00
|
|
|
inherit (depot.lib.meta) domain;
|
2021-10-16 20:39:49 +03:00
|
|
|
login = x: "https://login.${domain}/auth/realms/master/protocol/openid-connect/${x}";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
age.secrets.oauth2_proxy-secrets = {
|
2024-07-23 20:13:56 +03:00
|
|
|
file = ../../../secrets/oauth2_proxy-secrets.age;
|
2021-10-16 20:39:49 +03:00
|
|
|
owner = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
2021-12-02 22:37:38 +02:00
|
|
|
|
2024-06-04 15:36:27 +03:00
|
|
|
services.oauth2-proxy = {
|
2021-10-16 20:39:49 +03:00
|
|
|
enable = true;
|
2024-06-04 19:10:58 +03:00
|
|
|
nginx.domain = config.services.keycloak.settings.hostname;
|
2021-10-16 20:39:49 +03:00
|
|
|
approvalPrompt = "auto";
|
|
|
|
provider = "keycloak";
|
|
|
|
scope = "openid";
|
|
|
|
clientID = "net.privatevoid.admin-interfaces1";
|
|
|
|
keyFile = config.age.secrets.oauth2_proxy-secrets.path;
|
|
|
|
loginURL = login "auth";
|
|
|
|
redeemURL = login "token";
|
|
|
|
validateURL = login "userinfo";
|
|
|
|
cookie = {
|
|
|
|
secure = true;
|
|
|
|
domain = ".${domain}";
|
|
|
|
};
|
|
|
|
email.domains = [ domain ];
|
|
|
|
extraConfig = {
|
|
|
|
keycloak-group = "/admins";
|
|
|
|
skip-provider-button = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|