diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 41c3d3a237d67b8cd0f27f8e06280771229ccd4a..0000000000000000000000000000000000000000 --- a/flake.lock +++ /dev/null @@ -1,27 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1752012998, - "narHash": "sha256-Q82Ms+FQmgOBkdoSVm+FBpuFoeUAffNerR5yVV7SgT8=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "2a2130494ad647f953593c4e84ea4df839fbd68c", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index b27572c6dbe6243a55b1dc9fee75af3ab3a684f5..0000000000000000000000000000000000000000 --- a/flake.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - outputs = - { - self, - nixpkgs, - }: - let - systems = [ - "x86_64-linux" - "i686-linux" - "x86_64-darwin" - "aarch64-linux" - "armv6l-linux" - "armv7l-linux" - ]; - forAllSystems = f: nixpkgs.lib.genAttrs systems f; - in - { - overlays.default = import ./nix/overlay.nix; - nixosModules.oidc-playground = import ./nix/module.nix; - nixosModules.default = self.nixosModules.oidc-playground; - packages = forAllSystems (system: import ./nix { pkgs = import nixpkgs { inherit system; }; }); - nixosConfigurations.oidcVM = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./nix/vm.nix - { - virtualisation.vmVariant.virtualisation = { - cores = 2; - memorySize = 2048; - graphics = false; - }; - system.stateVersion = "23.11"; - } - ]; - }; - apps = forAllSystems ( - system: - let - pkgs = import nixpkgs { inherit system; }; - in - { - vm = { - type = "app"; - program = "${pkgs.writeShellScript "vm" '' - nixos-rebuild build-vm --flake .#oidcVM - ./result/bin/run-nixos-vm - rm nixos.qcow2 - ''}"; - }; - } - ); - }; -} diff --git a/go.mod.sri b/go.mod.sri deleted file mode 100644 index 8c1ef3bf8d1fc770d2a6b4716a8c3b5fcda7f847..0000000000000000000000000000000000000000 --- a/go.mod.sri +++ /dev/null @@ -1 +0,0 @@ -sha256-e0SQe88PGnJ6R7sZFUagVdCoPkYDLM3zEL2u9RW1vw0= \ No newline at end of file diff --git a/main.go b/main.go index 1058143487dfe29aad786849ecbaece9bac8bbb0..0f4240dc0d1ab48969c9aab39a907c608344d64d 100644 --- a/main.go +++ b/main.go @@ -281,9 +281,9 @@ fs := flag.NewFlagSet("oidc", flag.ExitOnError) fs.StringVar(&args.clientProvider, "client-provider", "", "Default client provider (e.g. https://accounts.google.com)") fs.StringVar(&args.clientID, "client-id", "", "Default client ID") fs.StringVar(&args.clientSecret, "client-secret", "", "Default client secret") - fs.IntVar(&args.port, "port", 6432, "Port to run on") + fs.IntVar(&args.port, "port", 8000, "Port to run on") fs.StringVar(&args.scopes, "scopes", "profile email", "Default scopes") - fs.StringVar(&args.origin, "origin", "http://localhost:6432", "Web origin") + fs.StringVar(&args.origin, "origin", "http://localhost:8000", "Web origin") fs.String("config", ".env", "Env config") if err := ff.Parse(fs, os.Args[1:], ff.WithEnvVarPrefix("OIDC"), diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 42268e486cb5bb39c7077934b059cd26829c8253..0000000000000000000000000000000000000000 --- a/nix/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - pkgs ? import { }, -}: -let - oidc-playground = pkgs.callPackage ./pkg.nix { inherit pkgs; }; -in -{ - inherit oidc-playground; - default = oidc-playground; -} diff --git a/nix/module.nix b/nix/module.nix deleted file mode 100644 index 66c530d2035c34055508c7ce3725db4150248040..0000000000000000000000000000000000000000 --- a/nix/module.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.services.oidc-playground; - pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; -in -{ - options.services.oidc-playground = { - enable = lib.mkEnableOption "OIDC Playground"; - package = lib.mkOption { - type = lib.types.package; - default = pkg; - description = "OIDC Playground package"; - }; - user = lib.mkOption { - type = lib.types.str; - default = "oidc-playground"; - description = "User to run as"; - }; - group = lib.mkOption { - type = lib.types.str; - default = "oidc-playground"; - description = "Group to run as"; - }; - port = lib.mkOption { - type = lib.types.port; - default = 6432; - description = "Port to serve on"; - }; - origin = lib.mkOption { - type = lib.types.str; - default = "http://localhost:6432"; - description = "Web origin"; - }; - issuer = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - example = "https://auth.example.com"; - description = "Default issuer URL"; - }; - scopes = lib.mkOption { - type = lib.types.str; - default = "profile email"; - description = "Default OIDC scopes"; - }; - }; - config = lib.mkIf cfg.enable { - systemd.services.oidc-playground = { - description = "OIDC Playground Service"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - ExecStart = - let - args = - [ - "--port=${builtins.toString cfg.port}" - "--origin=${cfg.origin}" - "--scopes=${lib.escapeShellArg cfg.scopes}" - ] - ++ lib.optionals (cfg.issuer != null) [ - "--client-provider=${cfg.issuer}" - ]; - in - "${lib.getExe cfg.package} ${lib.concatStringsSep " " args}"; - Restart = "always"; - User = cfg.user; - Group = cfg.group; - }; - }; - users = { - users.${cfg.user} = { - isSystemUser = true; - group = cfg.group; - }; - groups.${cfg.group} = { }; - }; - }; -} diff --git a/nix/overlay.nix b/nix/overlay.nix deleted file mode 100644 index 9d261ab9edc39eb6a16231263786bc7a143b7421..0000000000000000000000000000000000000000 --- a/nix/overlay.nix +++ /dev/null @@ -1,7 +0,0 @@ -final: prev: { - nixosModules = prev.nixosModules or { } // { - mazanoke = import ./module.nix; - }; - - oidc-playground = final.callPackage ./pkg.nix { }; -} diff --git a/nix/pkg.nix b/nix/pkg.nix deleted file mode 100644 index bbbb643b1860ba95c01da227eee367baa3d9d9c5..0000000000000000000000000000000000000000 --- a/nix/pkg.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - pkgs ? import { }, -}: -let - name = "oidc-playground"; -in -pkgs.buildGoModule { - pname = name; - version = "main"; - src = pkgs.nix-gitignore.gitignoreSource [ ] ( - builtins.path { - inherit name; - path = ../.; - } - ); - vendorHash = pkgs.lib.fileContents ../go.mod.sri; - env.CGO_ENABLED = 0; - flags = [ "-trimpath" ]; - ldflags = [ - "-s" - "-w" - "-extldflags -static" - ]; - meta = { - description = "OIDC Playground"; - homepage = "https://git.jolheiser.com/oidc"; - mainProgram = "oidc"; - }; -} diff --git a/nix/vm.nix b/nix/vm.nix deleted file mode 100644 index 3e64d39e613ddc0e1e64f9eeb15809aa603368ad..0000000000000000000000000000000000000000 --- a/nix/vm.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - imports = [ ./module.nix ]; - services.getty.autologinUser = "root"; - services.oidc-playground = - let - port = 8080; - in - { - enable = true; - scopes = "email profile foo bar"; - issuer = "https://accounts.google.com"; - inherit port; - origin = "http://localhost:${builtins.toString port}"; - }; -}