diff --git a/hosts/hainich/services/wink.nix b/hosts/hainich/services/wink.nix index 5ef3bdb..f279632 100644 --- a/hosts/hainich/services/wink.nix +++ b/hosts/hainich/services/wink.nix @@ -48,5 +48,30 @@ forceSSL = true; enableACME = true; }; - + + services.oauth2_proxy = + let keycloakurl = "https://auth.infra4future.de/auth/realms/forfuture/protocol/openid-connect"; + in { + enable = true; + nginx.virtualHosts = [ "wink.hacc.space" ]; + + # for the keycloak side of the configuration, see the documentation at + # https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/oauth_provider#keycloak-auth-provider + provider = "keycloak"; + clientID = ""; # TODO + loginURL = "${keycloakurl}/auth"; + redeemURL = "${keycloakurl}/token"; + profileURL = "${keycloakurl}/userinfo"; + validateURL = "${keycloakurl}/userinfo"; + + # must contain OAUTH2_PROXY_COOKIE_SECRET and OAUTH2_PROXY_CLIENT_SECRET + keyFile = "/var/lib/oauth2_proxy/secrets"; + + extraConfig = { + # log format (default would also log ip addresses / users) + auth_logging_format = "[{{.Timestamp}}] [{{.Status}}] {{.Message}}"; + allowed_group = "hacc"; + }; + }; + }