diff --git a/.editorconfig b/.editorconfig index 62ca398ae0..97f305618c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,9 @@ insert_final_newline = true [*.html] indent_size = 2 +[schemas/*.json] +indent_size = 2 + [*.{yaml,yml}] indent_size = 2 diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 9453956fa7..6455f0395c 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -28,9 +28,9 @@ runs: - name: Setup node uses: actions/setup-node@v4 with: - node-version-file: web/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: web/package-lock.json + cache-dependency-path: package-lock.json - name: Setup go uses: actions/setup-go@v5 with: @@ -44,7 +44,7 @@ runs: run: | export PSQL_TAG=${{ inputs.postgresql_version }} docker compose -f .github/actions/setup/docker-compose.yml up -d - cd web && npm ci + npm ci - name: Generate config shell: uv run python {0} run: | diff --git a/.github/workflows/_reusable-docker-build-single.yaml b/.github/workflows/_reusable-docker-build-single.yaml index a3b12c36c1..3669dda740 100644 --- a/.github/workflows/_reusable-docker-build-single.yaml +++ b/.github/workflows/_reusable-docker-build-single.yaml @@ -1,5 +1,5 @@ # Re-usable workflow for a single-architecture build -name: Single-arch Container build +name: "Single-arch Container build" on: workflow_call: @@ -42,7 +42,7 @@ jobs: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3.6.0 - uses: docker/setup-buildx-action@v3 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: @@ -64,12 +64,12 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: make empty clients + - name: Make empty clients if: ${{ inputs.release }} run: | mkdir -p ./gen-ts-api mkdir -p ./gen-go-api - - name: generate ts client + - name: Generate TypeScript API Client if: ${{ !inputs.release }} run: make gen-client-ts - name: Build Docker Image diff --git a/.github/workflows/_reusable-docker-build.yaml b/.github/workflows/_reusable-docker-build.yaml index c781b9400c..76f5df1a0d 100644 --- a/.github/workflows/_reusable-docker-build.yaml +++ b/.github/workflows/_reusable-docker-build.yaml @@ -1,5 +1,5 @@ # Re-usable workflow for a multi-architecture build -name: Multi-arch container build +name: "Multi-arch container build" on: workflow_call: @@ -49,7 +49,7 @@ jobs: shouldPush: ${{ steps.ev.outputs.shouldPush }} steps: - uses: actions/checkout@v4 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: @@ -69,7 +69,7 @@ jobs: tag: ${{ fromJson(needs.get-tags.outputs.tags) }} steps: - uses: actions/checkout@v4 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: diff --git a/.github/workflows/api-py-publish.yml b/.github/workflows/api-py-publish.yml index 61a94331a4..e7bdc7e62c 100644 --- a/.github/workflows/api-py-publish.yml +++ b/.github/workflows/api-py-publish.yml @@ -1,4 +1,5 @@ -name: authentik-api-py-publish +name: "Python API Publish" + on: push: branches: [main] @@ -7,6 +8,7 @@ on: workflow_dispatch: jobs: build: + name: "Build and Publish" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest permissions: @@ -30,7 +32,7 @@ jobs: uses: actions/setup-python@v5 with: python-version-file: "pyproject.toml" - - name: Generate API Client + - name: Generate Python API Client run: make gen-client-py - name: Publish package working-directory: gen-py-api/ diff --git a/.github/workflows/api-ts-publish.yml b/.github/workflows/api-ts-publish.yml index 7176cb5ed1..52280da779 100644 --- a/.github/workflows/api-ts-publish.yml +++ b/.github/workflows/api-ts-publish.yml @@ -1,4 +1,4 @@ -name: authentik-api-ts-publish +name: "TypeScript API Publish" on: push: branches: [main] @@ -7,6 +7,7 @@ on: workflow_dispatch: jobs: build: + name: "Build and Publish" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest steps: @@ -20,9 +21,9 @@ jobs: token: ${{ steps.generate_token.outputs.token }} - uses: actions/setup-node@v4 with: - node-version-file: web/package.json + node-version-file: package.json registry-url: "https://registry.npmjs.org" - - name: Generate API Client + - name: Generate TypeScript API Client run: make gen-client-ts - name: Publish package working-directory: gen-ts-api/ diff --git a/.github/workflows/ci-aws-cfn.yml b/.github/workflows/ci-aws-cfn.yml index 7b5fe19219..a41156103f 100644 --- a/.github/workflows/ci-aws-cfn.yml +++ b/.github/workflows/ci-aws-cfn.yml @@ -1,4 +1,4 @@ -name: authentik-ci-aws-cfn +name: "authentik CI AWS CloudFormation" on: push: @@ -18,6 +18,7 @@ env: jobs: check-changes-applied: + name: "Check changes applied" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -36,6 +37,7 @@ jobs: uv run make aws-cfn git diff --exit-code ci-aws-cfn-mark: + name: "CI AWS CloudFormation Mark" if: always() needs: - check-changes-applied diff --git a/.github/workflows/ci-main-daily.yml b/.github/workflows/ci-main-daily.yml index b7df695153..1353edc547 100644 --- a/.github/workflows/ci-main-daily.yml +++ b/.github/workflows/ci-main-daily.yml @@ -1,5 +1,5 @@ --- -name: authentik-ci-main-daily +name: "authentik CI Main Daily" on: workflow_dispatch: @@ -9,6 +9,7 @@ on: jobs: test-container: + name: "Test Container ${{ matrix.version }}" runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index d60efd7ccb..d714e6ca36 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -1,5 +1,5 @@ --- -name: authentik-ci-main +name: "authentik CI Main" on: push: @@ -19,6 +19,7 @@ env: jobs: lint: + name: "Lint" strategy: fail-fast: false matrix: @@ -33,9 +34,10 @@ jobs: - uses: actions/checkout@v4 - name: Setup authentik env uses: ./.github/actions/setup - - name: run job + - name: Run job ${{ matrix.job }} run: uv run make ci-${{ matrix.job }} test-migrations: + name: "Test Migrations" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -44,6 +46,7 @@ jobs: - name: run migrations run: uv run python -m lifecycle.migrate test-make-seed: + name: "Test Make Seed" runs-on: ubuntu-latest steps: - id: seed @@ -52,7 +55,7 @@ jobs: outputs: seed: ${{ steps.seed.outputs.seed }} test-migrations-from-stable: - name: test-migrations-from-stable - PostgreSQL ${{ matrix.psql }} - Run ${{ matrix.run_id }}/5 + name: "Test Migrations From Stable - PostgreSQL ${{ matrix.psql }} - Run ${{ matrix.run_id }}/5" runs-on: ubuntu-latest timeout-minutes: 20 needs: test-make-seed @@ -67,7 +70,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: checkout stable + - name: Checkout Stable run: | # Copy current, latest config to local # Temporarly comment the .github backup while migrating to uv @@ -84,9 +87,9 @@ jobs: with: postgresql_version: ${{ matrix.psql }} continue-on-error: true - - name: run migrations to stable + - name: Run migrations to stable run: poetry run python -m lifecycle.migrate - - name: checkout current code + - name: Checkout current code run: | set -x git fetch @@ -97,10 +100,10 @@ jobs: uses: ./.github/actions/setup with: postgresql_version: ${{ matrix.psql }} - - name: migrate to latest + - name: Migrate to latest run: | uv run python -m lifecycle.migrate - - name: run tests + - name: Run tests env: # Test in the main database that we just migrated from the previous stable version AUTHENTIK_POSTGRESQL__TEST__NAME: authentik @@ -110,7 +113,7 @@ jobs: run: | uv run make ci-test test-unittest: - name: test-unittest - PostgreSQL ${{ matrix.psql }} - Run ${{ matrix.run_id }}/5 + name: "Unit tests - PostgreSQL ${{ matrix.psql }} - Run ${{ matrix.run_id }}/5" runs-on: ubuntu-latest timeout-minutes: 20 needs: test-make-seed @@ -146,6 +149,7 @@ jobs: file: unittest.xml token: ${{ secrets.CODECOV_TOKEN }} test-integration: + name: "Integration tests" runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -154,7 +158,7 @@ jobs: uses: ./.github/actions/setup - name: Create k8s Kind Cluster uses: helm/kind-action@v1.12.0 - - name: run integration + - name: Run integration run: | uv run coverage run manage.py test tests/integration uv run coverage xml @@ -170,49 +174,50 @@ jobs: file: unittest.xml token: ${{ secrets.CODECOV_TOKEN }} test-e2e: - name: test-e2e (${{ matrix.job.name }}) + name: "Test E2E (${{ matrix.job.name }})" runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: false matrix: job: - - name: proxy + - name: Proxy Provider glob: tests/e2e/test_provider_proxy* - - name: oauth + - name: OAuth2 Provider glob: tests/e2e/test_provider_oauth2* tests/e2e/test_source_oauth* - - name: oauth-oidc + - name: OIDC Provider glob: tests/e2e/test_provider_oidc* - - name: saml + - name: SAML Provider glob: tests/e2e/test_provider_saml* tests/e2e/test_source_saml* - - name: ldap + - name: LDAP Provider glob: tests/e2e/test_provider_ldap* tests/e2e/test_source_ldap* - - name: radius + - name: RADIUS Provider glob: tests/e2e/test_provider_radius* - - name: scim + - name: SCIM Source glob: tests/e2e/test_source_scim* - - name: flows + - name: Flows glob: tests/e2e/test_flows* steps: - uses: actions/checkout@v4 - name: Setup authentik env uses: ./.github/actions/setup - - name: Setup e2e env (chrome, etc) + - name: Setup E2E env (chrome, etc) run: | docker compose -f tests/e2e/docker-compose.yml up -d --quiet-pull - id: cache-web uses: actions/cache@v4 with: path: web/dist - key: ${{ runner.os }}-web-${{ hashFiles('web/package-lock.json', 'web/src/**') }} - - name: prepare web ui + key: ${{ runner.os }}-web-${{ hashFiles('./package-lock.json', 'web/src/**') }} + - name: Prepare Web UI if: steps.cache-web.outputs.cache-hit != 'true' - working-directory: web run: | npm ci - make -C .. gen-client-ts - npm run build - - name: run e2e + make gen-client-ts + npm run build -w @goauthentik/web + + npm run typecheck + - name: Run E2E tests run: | uv run coverage run manage.py test ${{ matrix.job.glob }} uv run coverage xml @@ -228,6 +233,7 @@ jobs: file: unittest.xml token: ${{ secrets.CODECOV_TOKEN }} ci-core-mark: + name: "CI Core Mark" if: always() needs: - lint @@ -242,6 +248,7 @@ jobs: with: jobs: ${{ toJSON(needs) }} build: + name: "Build" permissions: # Needed to upload container images to ghcr.io packages: write @@ -255,6 +262,7 @@ jobs: image_name: ghcr.io/goauthentik/dev-server release: false pr-comment: + name: "PR Comment" needs: - build runs-on: ubuntu-latest @@ -267,7 +275,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: diff --git a/.github/workflows/ci-outpost.yml b/.github/workflows/ci-outpost.yml index 4369d97404..658a406bf7 100644 --- a/.github/workflows/ci-outpost.yml +++ b/.github/workflows/ci-outpost.yml @@ -1,5 +1,5 @@ --- -name: authentik-ci-outpost +name: "authentik CI Outpost" on: push: @@ -14,6 +14,7 @@ on: jobs: lint-golint: + name: "Lint Go" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -26,7 +27,7 @@ jobs: mkdir -p web/dist mkdir -p website/help touch web/dist/test website/help/test - - name: Generate API + - name: Generate Go API Client run: make gen-client-go - name: golangci-lint uses: golangci/golangci-lint-action@v7 @@ -35,6 +36,7 @@ jobs: args: --timeout 5000s --verbose skip-cache: true test-unittest: + name: "Unit Test Go" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -43,12 +45,13 @@ jobs: go-version-file: "go.mod" - name: Setup authentik env uses: ./.github/actions/setup - - name: Generate API + - name: Generate Go API Client run: make gen-client-go - name: Go unittests run: | go test -timeout 0 -v -race -coverprofile=coverage.out -covermode=atomic -cover ./... ci-outpost-mark: + name: "CI Outpost Mark" if: always() needs: - lint-golint @@ -59,6 +62,7 @@ jobs: with: jobs: ${{ toJSON(needs) }} build-container: + name: "Build Container" timeout-minutes: 120 needs: - ci-outpost-mark @@ -85,7 +89,7 @@ jobs: uses: docker/setup-qemu-action@v3.6.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: @@ -99,7 +103,7 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Generate API + - name: Generate Go API Client run: make gen-client-go - name: Build Docker Image id: push @@ -122,6 +126,7 @@ jobs: subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true build-binary: + name: "Build Binary" timeout-minutes: 120 needs: - ci-outpost-mark @@ -140,21 +145,22 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-node@v4 + with: + node-version-file: package.json + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies + run: npm ci - uses: actions/setup-go@v5 with: go-version-file: "go.mod" - - uses: actions/setup-node@v4 - with: - node-version-file: web/package.json - cache: "npm" - cache-dependency-path: web/package-lock.json - - name: Generate API + - name: Generate Go API Client run: make gen-client-go - name: Build web - working-directory: web/ run: | npm ci - npm run build-proxy + npm run build-proxy -w @goauthentik/web - name: Build outpost run: | set -x diff --git a/.github/workflows/ci-web.yml b/.github/workflows/ci-web.yml index 7df25a961b..6f8c57590f 100644 --- a/.github/workflows/ci-web.yml +++ b/.github/workflows/ci-web.yml @@ -1,4 +1,4 @@ -name: authentik-ci-web +name: CI Web UI on: push: @@ -13,54 +13,50 @@ on: jobs: lint: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - command: - - lint - - lint:lockfile - - tsc - - prettier-check - project: - - web - include: - - command: tsc - project: web - - command: lit-analyse - project: web - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: ${{ matrix.project }}/package.json - cache: "npm" - cache-dependency-path: ${{ matrix.project }}/package-lock.json - - working-directory: ${{ matrix.project }}/ - run: | - npm ci - - name: Generate API - run: make gen-client-ts - - name: Lint - working-directory: ${{ matrix.project }}/ - run: npm run ${{ matrix.command }} - build: + name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: web/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: web/package-lock.json - - working-directory: web/ + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies run: npm ci - - name: Generate API + - name: Generate TypeScript API + run: make gen-client-ts + - name: Build + run: | + npm run build -w @goauthentik/web + - name: Type check + run: | + npm run typecheck + - name: Lint + run: | + npm run lint -w @goauthentik/web + npm run lint:lockfile -w @goauthentik/web + npm run lit-analyse -w @goauthentik/web + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: package.json + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies + run: npm ci + - name: Generate TypeScript API run: make gen-client-ts - name: build - working-directory: web/ - run: npm run build + run: | + npm run build -w @goauthentik/web + npm run typecheck ci-web-mark: + name: CI Web Mark if: always() needs: - build @@ -71,6 +67,7 @@ jobs: with: jobs: ${{ toJSON(needs) }} test: + name: Test needs: - ci-web-mark runs-on: ubuntu-latest @@ -78,13 +75,12 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: web/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: web/package-lock.json - - working-directory: web/ + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies run: npm ci - - name: Generate API + - name: Generate TypeScript API run: make gen-client-ts - - name: test - working-directory: web/ - run: npm run test || exit 0 + - name: Test Web UI + run: npm run test -w @goauthentik/web || exit 0 diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 7f565f1ff0..047c87c1b0 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -1,4 +1,4 @@ -name: authentik-ci-website +name: CI Docs Website on: push: @@ -13,55 +13,59 @@ on: jobs: lint: + name: "Lint" runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - command: - - lint:lockfile - - prettier-check steps: - uses: actions/checkout@v4 - - working-directory: website/ - run: npm ci - - name: Lint - working-directory: website/ - run: npm run ${{ matrix.command }} + - uses: actions/setup-node@v4 + with: + node-version-file: package.json + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies + run: | + npm ci + - name: Generate TypeScript API + run: make gen-client-ts + - name: Lint Docs + run: | + npm run lint:prettier:check + npm run lint:lockfile -w @goauthentik/docs test: + name: "Test Docs" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: website/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: website/package-lock.json - - working-directory: website/ - run: npm ci - - name: test - working-directory: website/ - run: npm test + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies + run: | + npm ci + - name: Generate TypeScript API + run: make gen-client-ts + - name: Test Docs + run: | + npm run test -w @goauthentik/docs build: + name: "Build Docs" runs-on: ubuntu-latest - name: ${{ matrix.job }} - strategy: - fail-fast: false - matrix: - job: - - build steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version-file: website/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: website/package-lock.json - - working-directory: website/ + cache-dependency-path: package-lock.json + - name: Install Node.js dependencies run: npm ci - - name: build - working-directory: website/ - run: npm run ${{ matrix.job }} + - name: Build + run: | + npm run build -w @goauthentik/docs ci-website-mark: + name: "CI Website Mark" if: always() needs: - lint diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c8c0cc11fb..3e62e173ee 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,7 +10,7 @@ on: jobs: analyze: - name: Analyze + name: "Analyze" runs-on: ubuntu-latest permissions: actions: read diff --git a/.github/workflows/gen-update-webauthn-mds.yml b/.github/workflows/gen-update-webauthn-mds.yml index 3770358793..d05d5e7238 100644 --- a/.github/workflows/gen-update-webauthn-mds.yml +++ b/.github/workflows/gen-update-webauthn-mds.yml @@ -1,4 +1,4 @@ -name: authentik-gen-update-webauthn-mds +name: "authentik CI Update WebAuthn MDS" on: workflow_dispatch: schedule: @@ -11,6 +11,7 @@ env: jobs: build: + name: "Update WebAuthn MDS" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/gha-cache-cleanup.yml b/.github/workflows/gha-cache-cleanup.yml index 473625d1cc..9478cd2948 100644 --- a/.github/workflows/gha-cache-cleanup.yml +++ b/.github/workflows/gha-cache-cleanup.yml @@ -1,6 +1,6 @@ --- # See https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries -name: Cleanup cache after PR is closed +name: "Post-PR Closed Cache Cleanup" on: pull_request: types: @@ -12,6 +12,7 @@ permissions: jobs: cleanup: + name: "Cleanup Cache" runs-on: ubuntu-latest steps: - name: Check out code diff --git a/.github/workflows/ghcr-retention.yml b/.github/workflows/ghcr-retention.yml index 2ee1d65b96..01955da51b 100644 --- a/.github/workflows/ghcr-retention.yml +++ b/.github/workflows/ghcr-retention.yml @@ -1,4 +1,4 @@ -name: ghcr-retention +name: "authentik GHCR Retention Policy" on: # schedule: @@ -8,7 +8,7 @@ on: jobs: clean-ghcr: if: ${{ github.repository != 'goauthentik/authentik-internal' }} - name: Delete old unused container images + name: "Delete old unused container images" runs-on: ubuntu-latest steps: - id: generate_token diff --git a/.github/workflows/image-compress.yml b/.github/workflows/image-compress.yml index d7b55fa468..e6f15f2cc2 100644 --- a/.github/workflows/image-compress.yml +++ b/.github/workflows/image-compress.yml @@ -1,5 +1,5 @@ --- -name: authentik-compress-images +name: "authentik CI Image Compression" on: push: @@ -20,7 +20,7 @@ on: jobs: compress: - name: compress + name: "Compress Docker images" runs-on: ubuntu-latest # Don't run on forks. Token will not be available. Will run on main and open a PR anyway if: | diff --git a/.github/workflows/publish-source-docs.yml b/.github/workflows/publish-source-docs.yml index 097857dbc4..cc4c6c9706 100644 --- a/.github/workflows/publish-source-docs.yml +++ b/.github/workflows/publish-source-docs.yml @@ -1,4 +1,4 @@ -name: authentik-publish-source-docs +name: "authentik Publish Source Docs" on: push: @@ -12,6 +12,7 @@ env: jobs: publish-source-docs: + name: "Publish" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest timeout-minutes: 120 @@ -19,11 +20,11 @@ jobs: - uses: actions/checkout@v4 - name: Setup authentik env uses: ./.github/actions/setup - - name: generate docs + - name: Generate docs run: | uv run make migrate uv run ak build_source_docs - - name: Publish + - name: Deploy to Netlify uses: netlify/actions/cli@master with: args: deploy --dir=source_docs --prod diff --git a/.github/workflows/release-next-branch.yml b/.github/workflows/release-next-branch.yml index 3b8385ef19..dc65c04caf 100644 --- a/.github/workflows/release-next-branch.yml +++ b/.github/workflows/release-next-branch.yml @@ -1,4 +1,4 @@ -name: authentik-on-release-next-branch +name: "authentik on Release Next Branch" on: schedule: @@ -11,6 +11,7 @@ permissions: jobs: update-next: + name: "Update Next Branch" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest environment: internal-production diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 824038774c..93358822cc 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -1,5 +1,5 @@ --- -name: authentik-on-release +name: "Release publish" on: release: @@ -7,6 +7,7 @@ on: jobs: build-server: + name: "Build server" uses: ./.github/workflows/_reusable-docker-build.yaml secrets: inherit permissions: @@ -21,6 +22,7 @@ jobs: registry_dockerhub: true registry_ghcr: true build-outpost: + name: "Build outpost" runs-on: ubuntu-latest permissions: # Needed to upload container images to ghcr.io @@ -45,14 +47,14 @@ jobs: uses: docker/setup-qemu-action@v3.6.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} with: image-name: ghcr.io/goauthentik/${{ matrix.type }},beryju/authentik-${{ matrix.type }} - - name: make empty clients + - name: Make empty clients run: | mkdir -p ./gen-ts-api mkdir -p ./gen-go-api @@ -85,6 +87,7 @@ jobs: subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true build-outpost-binary: + name: "Build outpost binary" timeout-minutes: 120 runs-on: ubuntu-latest permissions: @@ -106,14 +109,13 @@ jobs: go-version-file: "go.mod" - uses: actions/setup-node@v4 with: - node-version-file: web/package.json + node-version-file: package.json cache: "npm" - cache-dependency-path: web/package-lock.json + cache-dependency-path: package-lock.json - name: Build web - working-directory: web/ run: | npm ci - npm run build-proxy + npm run build-proxy -w @goauthentik/web - name: Build outpost run: | set -x @@ -129,6 +131,7 @@ jobs: asset_name: authentik-outpost-${{ matrix.type }}_${{ matrix.goos }}_${{ matrix.goarch }} tag: ${{ github.ref }} upload-aws-cfn-template: + name: "Upload AWS CloudFormation template" permissions: # Needed for AWS login id-token: write @@ -150,6 +153,7 @@ jobs: aws s3 cp --acl=public-read lifecycle/aws/template.yaml s3://authentik-cloudformation-templates/authentik.ecs.${{ github.ref }}.yaml aws s3 cp --acl=public-read lifecycle/aws/template.yaml s3://authentik-cloudformation-templates/authentik.ecs.latest.yaml test-release: + name: "Test release" needs: - build-server - build-outpost @@ -166,6 +170,7 @@ jobs: docker compose start postgresql redis docker compose run -u root server test-all sentry-release: + name: "Sentry release" needs: - build-server - build-outpost @@ -173,7 +178,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 198570d8e7..1fd3b58aef 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -1,5 +1,5 @@ --- -name: authentik-on-tag +name: "authentik on Tag Release" on: push: @@ -8,7 +8,7 @@ on: jobs: build: - name: Create Release from Tag + name: "Create Release from Tag" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,7 +20,7 @@ jobs: with: app_id: ${{ secrets.GH_APP_ID }} private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} - - name: prepare variables + - name: Prepare variables uses: ./.github/actions/docker-push-variables id: ev env: diff --git a/.github/workflows/repo-mirror.yml b/.github/workflows/repo-mirror.yml index f9e64b7546..1765c98355 100644 --- a/.github/workflows/repo-mirror.yml +++ b/.github/workflows/repo-mirror.yml @@ -1,13 +1,15 @@ -name: "authentik-repo-mirror" +name: "authentik Repository Mirror" on: [push, delete] jobs: to_internal: + name: "Mirror to internal repository" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + name: "Checkout repository" with: fetch-depth: 0 - if: ${{ env.MIRROR_KEY != '' }} diff --git a/.github/workflows/repo-stale.yml b/.github/workflows/repo-stale.yml index 9e2c5f444e..570eb79f1d 100644 --- a/.github/workflows/repo-stale.yml +++ b/.github/workflows/repo-stale.yml @@ -1,4 +1,4 @@ -name: "authentik-repo-stale" +name: "authentik Repository Stale Issues" on: schedule: @@ -11,6 +11,7 @@ permissions: jobs: stale: + name: "Stale Issues" if: ${{ github.repository != 'goauthentik/authentik-internal' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index a1a7509f27..0d5220346b 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -1,4 +1,4 @@ -name: authentik-semgrep +name: "authentik CI Semgrep" on: workflow_dispatch: {} pull_request: {} @@ -13,7 +13,7 @@ on: - cron: '12 15 * * *' jobs: semgrep: - name: semgrep/ci + name: "semgrep/ci" runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/translation-advice.yml b/.github/workflows/translation-advice.yml index c79c450474..f454df4a07 100644 --- a/.github/workflows/translation-advice.yml +++ b/.github/workflows/translation-advice.yml @@ -1,4 +1,4 @@ -name: authentik-translation-advice +name: "authentik Translations Advice" on: pull_request: @@ -16,6 +16,7 @@ permissions: jobs: post-comment: + name: "Post Comment" runs-on: ubuntu-latest steps: - name: Find Comment diff --git a/.github/workflows/translation-extract-compile.yml b/.github/workflows/translation-extract-compile.yml index af4d7b1681..1acba8f12c 100644 --- a/.github/workflows/translation-extract-compile.yml +++ b/.github/workflows/translation-extract-compile.yml @@ -1,5 +1,5 @@ --- -name: authentik-translate-extract-compile +name: "authentik Extract & Compile Translations" on: schedule: - cron: "0 0 * * *" # every day at midnight @@ -16,6 +16,7 @@ env: jobs: compile: + name: "Compile Translations" runs-on: ubuntu-latest steps: - id: generate_token @@ -32,15 +33,20 @@ jobs: if: ${{ github.event_name == 'pull_request' }} - name: Setup authentik env uses: ./.github/actions/setup - - name: Generate API + - name: Generate TypeScript API run: make gen-client-ts - - name: run extract + - name: Extract Translations run: | uv run make i18n-extract - - name: run compile + - name: Build Docs Site + run: npm run build-bundled -w @goauthentik/docs + - name: Build Web UI + run: npm run build -w @goauthentik/web + - name: Type check + run: npm run typecheck + - name: Compile Messages run: | uv run ak compilemessages - make web-check-compile - name: Create Pull Request if: ${{ github.event_name != 'pull_request' }} uses: peter-evans/create-pull-request@v7 diff --git a/.github/workflows/translation-rename.yml b/.github/workflows/translation-rename.yml index 7fe0a7ab52..c1c9af12e1 100644 --- a/.github/workflows/translation-rename.yml +++ b/.github/workflows/translation-rename.yml @@ -1,6 +1,6 @@ # Rename transifex pull requests to have a correct naming # Also enables auto squash-merge -name: authentik-translation-transifex-rename +name: "authentik Translations Transifex PR Rename" on: pull_request: @@ -12,6 +12,7 @@ permissions: jobs: rename_pr: + name: "Rename PR" runs-on: ubuntu-latest if: ${{ github.event.pull_request.user.login == 'transifex-integration[bot]'}} steps: diff --git a/.gitignore b/.gitignore index d79d662b16..1c25cd8a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -217,3 +217,26 @@ source_docs/ ### Docker ### docker-compose.override.yml + + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +node_modules/ + +tsconfig.tsbuildinfo + +# Wireit's cache +.wireit + +custom-elements.json + + +### Development ### +.drafts diff --git a/.prettierignore b/.prettierignore index e1fbcf74fa..9d0a140565 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,12 +4,16 @@ **/LICENSE authentik/stages/**/* +authentik/sources/**/* +schemas/**/* +blueprints/**/* ## Build asset directories coverage dist out .docusaurus +.wireit website/docs/developer-docs/api/**/* ## Environment @@ -32,14 +36,15 @@ coverage # Templates # TODO: Rename affected files to *.template.* or similar. +authentik/**/*.html *.html *.mdx *.md ## Import order matters -poly.ts -src/locale-codes.ts -src/locales/ +web/src/poly.ts +web/src/locale-codes.ts +web/src/locales/ # Storybook storybook-static/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7704f91467..11ab39939d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -17,6 +17,6 @@ "ms-python.vscode-pylance", "redhat.vscode-yaml", "Tobermory.es6-string-html", - "unifiedjs.vscode-mdx", + "unifiedjs.vscode-mdx" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index ea2be46bbd..a5b95f6083 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ ], "typescript.preferences.importModuleSpecifier": "non-relative", "typescript.preferences.importModuleSpecifierEnding": "index", - "typescript.tsdk": "./web/node_modules/typescript/lib", + "typescript.tsdk": "./node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true, "yaml.schemas": { "./blueprints/schema.json": "blueprints/**/*.yaml" @@ -30,7 +30,71 @@ } ], "go.testFlags": ["-count=1"], - "github-actions.workflows.pinned.workflows": [ - ".github/workflows/ci-main.yml" - ] + "github-actions.workflows.pinned.workflows": [".github/workflows/ci-main.yml"], + + "eslint.useFlatConfig": true, + + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.mjs": "*.d.mts", + "*.cjs": "*.d.cts", + "package.json": "package-lock.json, yarn.lock, .yarnrc, .yarnrc.yml, .yarn, .nvmrc, .node-version", + "tsconfig.json": "tsconfig.*.json, jsconfig.json", + "Dockerfile": "*.Dockerfile" + }, + + "search.exclude": { + "**/node_modules": true, + "**/*.code-search": true, + "**/dist": true, + "**/out": true, + "**/package-lock.json": true + }, + + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[shellscript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[django-html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + + "editor.codeActionsOnSave": { + "source.removeUnusedImports": "explicit" + }, + // We use Prettier for formatting, but specifying these settings + // will ensure that VS Code's IntelliSense doesn't autocomplete unformatted code. + "javascript.format.semicolons": "insert", + "typescript.format.semicolons": "insert", + "javascript.preferences.quoteStyle": "double", + "typescript.preferences.quoteStyle": "double", + "github.copilot.enable": { + "*": true, + "plaintext": true, + "markdown": true, + "scminput": false, + "csv": false, + "json": true, + "yaml": true + } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 539ac84d88..72b1a84f50 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,12 +4,7 @@ { "label": "authentik/core: make", "command": "uv", - "args": [ - "run", - "make", - "lint-fix", - "lint" - ], + "args": ["run", "make", "lint-fix", "lint"], "presentation": { "panel": "new" }, @@ -18,11 +13,7 @@ { "label": "authentik/core: run", "command": "uv", - "args": [ - "run", - "ak", - "server" - ], + "args": ["run", "ak", "server"], "group": "build", "presentation": { "panel": "dedicated", @@ -32,17 +23,13 @@ { "label": "authentik/web: make", "command": "make", - "args": [ - "web" - ], + "args": ["web"], "group": "build" }, { "label": "authentik/web: watch", "command": "make", - "args": [ - "web-watch" - ], + "args": ["web-watch"], "group": "build", "presentation": { "panel": "dedicated", @@ -52,26 +39,19 @@ { "label": "authentik: install", "command": "make", - "args": [ - "install", - "-j4" - ], + "args": ["install", "-j4"], "group": "build" }, { "label": "authentik/website: make", "command": "make", - "args": [ - "website" - ], + "args": ["website"], "group": "build" }, { "label": "authentik/website: watch", "command": "make", - "args": [ - "website-watch" - ], + "args": ["website-watch"], "group": "build", "presentation": { "panel": "dedicated", @@ -81,11 +61,7 @@ { "label": "authentik/api: generate", "command": "uv", - "args": [ - "run", - "make", - "gen" - ], + "args": ["run", "make", "gen"], "group": "build" } ] diff --git a/Dockerfile b/Dockerfile index 0bb28eeaec..320bbc2ae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,31 @@ # syntax=docker/dockerfile:1 -# Stage 1: Build website -FROM --platform=${BUILDPLATFORM} docker.io/library/node:22 AS website-builder +# Stage 1 Web UI and Documentation build -ENV NODE_ENV=production - -WORKDIR /work/website - -RUN --mount=type=bind,target=/work/website/package.json,src=./website/package.json \ - --mount=type=bind,target=/work/website/package-lock.json,src=./website/package-lock.json \ - --mount=type=cache,id=npm-website,sharing=shared,target=/root/.npm \ - npm ci --include=dev - -COPY ./website /work/website/ -COPY ./blueprints /work/blueprints/ -COPY ./schema.yml /work/ -COPY ./SECURITY.md /work/ - -RUN npm run build-bundled - -# Stage 2: Build webui FROM --platform=${BUILDPLATFORM} docker.io/library/node:22 AS web-builder -ARG GIT_BUILD_HASH -ENV GIT_BUILD_HASH=$GIT_BUILD_HASH ENV NODE_ENV=production -WORKDIR /work/web +WORKDIR /work -RUN --mount=type=bind,target=/work/web/package.json,src=./web/package.json \ - --mount=type=bind,target=/work/web/package-lock.json,src=./web/package-lock.json \ - --mount=type=bind,target=/work/web/packages/sfe/package.json,src=./web/packages/sfe/package.json \ - --mount=type=bind,target=/work/web/scripts,src=./web/scripts \ - --mount=type=cache,id=npm-web,sharing=shared,target=/root/.npm \ - npm ci --include=dev +COPY ./package.json ./package.json +COPY ./package-lock.json ./package-lock.json +COPY ./packages ./packages +COPY ./web ./web +COPY ./website ./website -COPY ./package.json /work -COPY ./web /work/web/ -COPY ./website /work/website/ -COPY ./gen-ts-api /work/web/node_modules/@goauthentik/api +COPY ./gen-ts-api ./gen-ts-api +COPY ./blueprints ./blueprints +COPY ./schema.yml ./schema.yml +COPY ./SECURITY.md ./SECURITY.md -RUN npm run build +RUN --mount=type=cache,target=/root/.npm npm ci --include=dev + +RUN npm run build-bundled -w @goauthentik/docs +RUN npm run build -w @goauthentik/web + +# Stage 2: Build go proxy -# Stage 3: Build go proxy FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.24-bookworm AS go-builder ARG TARGETOS @@ -79,7 +62,8 @@ RUN --mount=type=cache,sharing=locked,target=/go/pkg/mod \ CGO_ENABLED=1 GOFIPS140=latest GOARM="${TARGETVARIANT#v}" \ go build -o /go/authentik ./cmd/server -# Stage 4: MaxMind GeoIP +# Stage 3: MaxMind GeoIP + FROM --platform=${BUILDPLATFORM} ghcr.io/maxmind/geoipupdate:v7.1.0 AS geoip ENV GEOIPUPDATE_EDITION_IDS="GeoLite2-City GeoLite2-ASN" @@ -93,9 +77,10 @@ RUN --mount=type=secret,id=GEOIPUPDATE_ACCOUNT_ID \ mkdir -p /usr/share/GeoIP && \ /bin/sh -c "/usr/bin/entry.sh || echo 'Failed to get GeoIP database, disabling'; exit 0" -# Stage 5: Download uv +# Stage 4: Download uv FROM ghcr.io/astral-sh/uv:0.6.14 AS uv -# Stage 6: Base python image + +# Stage 5: Base python image FROM ghcr.io/goauthentik/fips-python:3.12.10-slim-bookworm-fips AS python-base ENV VENV_PATH="/ak-root/.venv" \ @@ -109,7 +94,7 @@ WORKDIR /ak-root/ COPY --from=uv /uv /uvx /bin/ -# Stage 7: Python dependencies +# Stage 6: Python dependencies FROM python-base AS python-deps ARG TARGETARCH @@ -144,7 +129,7 @@ RUN --mount=type=bind,target=pyproject.toml,src=pyproject.toml \ --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-install-project --no-dev -# Stage 8: Run +# Stage 7: Run FROM python-base AS final-image ARG VERSION @@ -189,7 +174,7 @@ COPY --from=go-builder /go/authentik /bin/authentik COPY --from=python-deps /ak-root/.venv /ak-root/.venv COPY --from=web-builder /work/web/dist/ /web/dist/ COPY --from=web-builder /work/web/authentik/ /web/authentik/ -COPY --from=website-builder /work/website/build/ /website/help/ +COPY --from=web-builder /work/website/build/ /website/help/ COPY --from=geoip /usr/share/GeoIP /geoip USER 1000 diff --git a/Makefile b/Makefile index 7d327935c1..066eec27fe 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,13 @@ test: ## Run the server tests and produce a coverage report (locally) uv run coverage html uv run coverage report +node-check-compile: ## Check and compile the TypeScript source code + npm run typecheck + +node-lint-fix: ## Lint and automatically fix errors in the javascript source code + lint-codespell + npm run lint:fix + lint-fix: lint-codespell ## Lint and automatically fix errors in the python source code. Reports spelling errors. uv run black $(PY_SOURCES) uv run ruff check --fix $(PY_SOURCES) @@ -47,9 +54,6 @@ lint: ## Lint the python and golang sources uv run bandit -c pyproject.toml -r $(PY_SOURCES) golangci-lint run -v -core-install: - uv sync --frozen - migrate: ## Run the Authentik Django server's migrations uv run python -m lifecycle.migrate @@ -72,7 +76,9 @@ core-i18n-extract: --ignore website \ -l en -install: web-install website-install core-install ## Install all requires dependencies for `web`, `website` and `core` +install: ## Install all requires dependencies for `web`, `website` and `core` + npm ci + uv sync --frozen dev-drop-db: dropdb -U ${pg_user} -h ${pg_host} ${pg_name} @@ -94,6 +100,7 @@ gen-build: ## Extract the schema from the database AUTHENTIK_TENANTS__ENABLED=true \ AUTHENTIK_OUTPOSTS__DISABLE_EMBEDDED_OUTPOST=true \ uv run ak make_blueprint_schema > blueprints/schema.json + AUTHENTIK_DEBUG=true \ AUTHENTIK_TENANTS__ENABLED=true \ AUTHENTIK_OUTPOSTS__DISABLE_EMBEDDED_OUTPOST=true \ @@ -101,19 +108,24 @@ gen-build: ## Extract the schema from the database gen-changelog: ## (Release) generate the changelog based from the commits since the last tag git log --pretty=format:" - %s" $(shell git describe --tags $(shell git rev-list --tags --max-count=1))...$(shell git branch --show-current) | sort > changelog.md + npx prettier --write changelog.md gen-diff: ## (Release) generate the changelog diff between the current schema and the last tag git show $(shell git describe --tags $(shell git rev-list --tags --max-count=1)):schema.yml > old_schema.yml + docker run \ --rm -v ${PWD}:/local \ --user ${UID}:${GID} \ docker.io/openapitools/openapi-diff:2.1.0-beta.8 \ --markdown /local/diff.md \ /local/old_schema.yml /local/schema.yml + rm old_schema.yml + sed -i 's/{/{/g' diff.md sed -i 's/}/}/g' diff.md + npx prettier --write diff.md gen-clean-ts: ## Remove generated API client for Typescript @@ -133,46 +145,57 @@ gen-client-ts: gen-clean-ts ## Build and install the authentik API for Typescri --rm -v ${PWD}:/local \ --user ${UID}:${GID} \ docker.io/openapitools/openapi-generator-cli:v7.11.0 generate \ - -i /local/schema.yml \ - -g typescript-fetch \ - -o /local/${GEN_API_TS} \ - -c /local/scripts/api-ts-config.yaml \ + --input-spec /local/schema.yml \ + --generator-name typescript-fetch \ + --output /local/${GEN_API_TS} \ + --config /local/scripts/api-ts-config.yaml \ --additional-properties=npmVersion=${NPM_VERSION} \ --git-repo-id authentik \ --git-user-id goauthentik - mkdir -p web/node_modules/@goauthentik/api - cd ./${GEN_API_TS} && npm i - \cp -rf ./${GEN_API_TS}/* web/node_modules/@goauthentik/api + + npm install gen-client-py: gen-clean-py ## Build and install the authentik API for Python + docker run \ --rm -v ${PWD}:/local \ --user ${UID}:${GID} \ docker.io/openapitools/openapi-generator-cli:v7.11.0 generate \ - -i /local/schema.yml \ - -g python \ - -o /local/${GEN_API_PY} \ - -c /local/scripts/api-py-config.yaml \ + --input-spec /local/schema.yml \ + --generator-name python \ + --output /local/${GEN_API_PY} \ + --config /local/scripts/api-py-config.yaml \ --additional-properties=packageVersion=${NPM_VERSION} \ --git-repo-id authentik \ --git-user-id goauthentik + pip install ./${GEN_API_PY} gen-client-go: gen-clean-go ## Build and install the authentik API for Golang mkdir -p ./${GEN_API_GO} ./${GEN_API_GO}/templates - wget https://raw.githubusercontent.com/goauthentik/client-go/main/config.yaml -O ./${GEN_API_GO}/config.yaml - wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/README.mustache -O ./${GEN_API_GO}/templates/README.mustache - wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/go.mod.mustache -O ./${GEN_API_GO}/templates/go.mod.mustache + + wget https://raw.githubusercontent.com/goauthentik/client-go/main/config.yaml \ + -O ./${GEN_API_GO}/config.yaml + + wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/README.mustache \ + -O ./${GEN_API_GO}/templates/README.mustache + + wget https://raw.githubusercontent.com/goauthentik/client-go/main/templates/go.mod.mustache \ + -O ./${GEN_API_GO}/templates/go.mod.mustache + cp schema.yml ./${GEN_API_GO}/ + docker run \ --rm -v ${PWD}/${GEN_API_GO}:/local \ --user ${UID}:${GID} \ docker.io/openapitools/openapi-generator-cli:v6.5.0 generate \ - -i /local/schema.yml \ - -g go \ - -o /local/ \ - -c /local/config.yaml + --input-spec /local/schema.yml \ + --generator-name go \ + --output /local/ \ + --config /local/config.yaml + go mod edit -replace goauthentik.io/api/v3=./${GEN_API_GO} + rm -rf ./${GEN_API_GO}/config.yaml ./${GEN_API_GO}/templates/ gen-dev-config: ## Generate a local development config file @@ -184,56 +207,38 @@ gen: gen-build gen-client-ts ## Web ######################### -web-build: web-install ## Build the Authentik UI - cd web && npm run build - -web: web-lint-fix web-lint web-check-compile ## Automatically fix formatting issues in the Authentik UI source code, lint the code, and compile it - -web-install: ## Install the necessary libraries to build the Authentik UI - cd web && npm ci +web: web-lint-fix web-lint node-check-compile ## Automatically fix formatting issues in the Authentik UI source code, lint the code, and compile it web-test: ## Run tests for the Authentik UI - cd web && npm run test + npm run test -w @goauthentik/web web-watch: ## Build and watch the Authentik UI for changes, updating automatically - rm -rf web/dist/ - mkdir web/dist/ - touch web/dist/.gitkeep - cd web && npm run watch + npm run watch -w @goauthentik/web web-storybook-watch: ## Build and run the storybook documentation server - cd web && npm run storybook + npm run storybook -w @goauthentik/web web-lint-fix: - cd web && npm run prettier + npm run prettier -w @goauthentik/web web-lint: - cd web && npm run lint - cd web && npm run lit-analyse - -web-check-compile: - cd web && npm run tsc + npm run lint -w @goauthentik/web + npm run lit-analyse -w @goauthentik/web web-i18n-extract: - cd web && npm run extract-locales + npm run extract-locales -w @goauthentik/web ######################### ## Website ######################### -website: website-lint-fix website-build ## Automatically fix formatting issues in the Authentik website/docs source code, lint the code, and compile it - -website-install: - cd website && npm ci - -website-lint-fix: lint-codespell - cd website && npm run prettier +website: node-lint-fix website-build ## Automatically fix formatting issues in the Authentik website/docs source code, lint the code, and compile it website-build: - cd website && npm run build + npm run build -w @goauthentik/docs website-watch: ## Build and watch the documentation website, updating automatically - cd website && npm run watch + npm run watch -w @goauthentik/docs ######################### ## Docker diff --git a/authentik/core/templates/base/header_js.html b/authentik/core/templates/base/header_js.html index 9e75d96c4d..c003493215 100644 --- a/authentik/core/templates/base/header_js.html +++ b/authentik/core/templates/base/header_js.html @@ -2,20 +2,22 @@ {% get_current_language as LANGUAGE_CODE %} diff --git a/authentik/core/templates/base/skeleton.html b/authentik/core/templates/base/skeleton.html index 0c3a79122b..ccd075679c 100644 --- a/authentik/core/templates/base/skeleton.html +++ b/authentik/core/templates/base/skeleton.html @@ -2,31 +2,79 @@ {% load i18n %} {% load authentik_core %} - + - - - - {# Darkreader breaks the site regardless of theme as its not compatible with webcomponents, and we default to a dark theme based on preferred colour-scheme #} - - {% block title %}{% trans title|default:brand.branding_title %}{% endblock %} - - - {% block head_before %} - {% endblock %} - - - - - {% block head %} - {% endblock %} - - - - {% block body %} - {% endblock %} - {% block scripts %} - {% endblock %} - + + + + + {% comment %} + Darkreader breaks the site regardless of theme as its not compatible with webcomponents, and we + default to a dark theme based on preferred colour-scheme + {% endcomment %} + + + + {% block title %}{% trans title|default:brand.branding_title %}{% endblock %} + + + + + {% block head_before %} + {% endblock %} + + + + + + + + + + + {% block head %} + {% endblock %} + + + + + + {% block body %}{% endblock %} + {% block scripts %}{% endblock %} + + + diff --git a/authentik/core/templates/if/admin.html b/authentik/core/templates/if/admin.html index 51d1569dfb..693630a462 100644 --- a/authentik/core/templates/if/admin.html +++ b/authentik/core/templates/if/admin.html @@ -4,14 +4,16 @@ {% block head %} - - + + + {% include "base/header_js.html" %} {% endblock %} {% block body %} + - + {% endblock %} diff --git a/authentik/core/templates/if/error.html b/authentik/core/templates/if/error.html index 6abc12e3e9..f8a2babe68 100644 --- a/authentik/core/templates/if/error.html +++ b/authentik/core/templates/if/error.html @@ -13,9 +13,14 @@ {% block card %}
-

{% trans message %}

- - {% trans 'Go home' %} - +

{% trans message %}

+ + + {% trans 'Go home' %} +
{% endblock %} diff --git a/authentik/core/templates/if/user.html b/authentik/core/templates/if/user.html index 7ce1714ac7..0fc67643a2 100644 --- a/authentik/core/templates/if/user.html +++ b/authentik/core/templates/if/user.html @@ -4,14 +4,17 @@ {% block head %} - - + + + + {% include "base/header_js.html" %} {% endblock %} {% block body %} + - + {% endblock %} diff --git a/authentik/core/templates/login/base_full.html b/authentik/core/templates/login/base_full.html index f312a4e7a0..b2db0a0fef 100644 --- a/authentik/core/templates/login/base_full.html +++ b/authentik/core/templates/login/base_full.html @@ -5,78 +5,82 @@ {% block head_before %} - - + + {% include "base/header_js.html" %} {% endblock %} {% block head %} - {% endblock %} {% block body %} -
-
+
-
-
- - - -
-
-
    - {% for link in footer_links %} -
  • - {{ link.name }} -
  • - {% endfor %} -
  • - - {% trans 'Powered by authentik' %} - -
  • -
-
-
+
+
+ + + +
+ +
{% endblock %} diff --git a/authentik/flows/templates/if/flow-sfe.html b/authentik/flows/templates/if/flow-sfe.html index abea71934b..0cf85e5e99 100644 --- a/authentik/flows/templates/if/flow-sfe.html +++ b/authentik/flows/templates/if/flow-sfe.html @@ -2,53 +2,52 @@ {% load i18n %} {% load authentik_core %} - + - - - - {% block title %}{% trans title|default:brand.branding_title %}{% endblock %} - - - {% block head_before %} - {% endblock %} - - - {% include "base/header_js.html" %} - - - -
-
-
- {% trans 'Powered by authentik' %} -
- - + .form-signin .form-floating:focus-within { + z-index: 2; + } + .brand-icon { + max-width: 100%; + } + + + +
+
+ {% trans 'Powered by authentik' %} +
+ + diff --git a/authentik/flows/templates/if/flow.html b/authentik/flows/templates/if/flow.html index 2cf3246db3..b71753b09e 100644 --- a/authentik/flows/templates/if/flow.html +++ b/authentik/flows/templates/if/flow.html @@ -1,34 +1,40 @@ {% extends "base/skeleton.html" %} - {% load static %} {% load authentik_core %} {% block head_before %} {{ block.super }} + + {% if flow.compatibility_mode and not inspector %} - -{% endif %} -{% include "base/header_js.html" %} +{% endif %} + +{% include "base/header_js.html" %} + + {% endblock %} {% block head %} - {% endblock %} {% block body %} - + {% endblock %} diff --git a/authentik/providers/rac/templates/if/rac.html b/authentik/providers/rac/templates/if/rac.html index 4f26fba880..b1c8d0d026 100644 --- a/authentik/providers/rac/templates/if/rac.html +++ b/authentik/providers/rac/templates/if/rac.html @@ -4,10 +4,13 @@ {% block head %} - - - - + + + + + + + {% include "base/header_js.html" %} {% endblock %} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..a59ac9a3e0 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,10 @@ +import { createESLintPackageConfig } from "@goauthentik/eslint-config"; + +// @ts-check + +/** + * ESLint configuration for authentik's monorepo. + */ +const ESLintConfig = createESLintPackageConfig(); + +export default ESLintConfig; diff --git a/internal/outpost/proxyv2/templates/error.html b/internal/outpost/proxyv2/templates/error.html index 6ef3917b56..afed0d30f0 100644 --- a/internal/outpost/proxyv2/templates/error.html +++ b/internal/outpost/proxyv2/templates/error.html @@ -1,15 +1,34 @@ - + - - + + + {{.Title}} - - - - - -
-
+