Skip to content

Commit ffcaf95

Browse files
committed
Proof-of-concept authentication in workflows with Authoirization Code Flow with PKCE method
1 parent 0ed5e19 commit ffcaf95

66 files changed

Lines changed: 4639 additions & 448 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: OIDC BFF Code
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source
11+
uses: actions/checkout@v5
12+
13+
- name: Install stable toolchain
14+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
15+
with:
16+
cache: false
17+
components: clippy,rustfmt
18+
19+
- name: Cache Rust Build
20+
uses: Swatinem/rust-cache@v2.8.1
21+
with:
22+
shared-key: backend/oidc-bff
23+
workspaces: backend
24+
25+
- name: Check Formatting
26+
working-directory: backend/oidc-bff
27+
run: >
28+
cargo fmt
29+
--check
30+
31+
- name: Lint with Clippy
32+
working-directory: backend/oidc-bff
33+
run: >
34+
cargo clippy
35+
--all-targets
36+
--all-features
37+
--no-deps
38+
--
39+
--deny warnings
40+
41+
- name: Check Dependencies with Cargo Deny
42+
uses: EmbarkStudios/cargo-deny-action@v2.0.13
43+
with:
44+
command: check licenses ban
45+
manifest-path: backend/Cargo.toml
46+
47+
test:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout source
51+
uses: actions/checkout@v5
52+
53+
- name: Install stable toolchain
54+
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
55+
with:
56+
cache: false
57+
components: rustfmt
58+
59+
- name: Cache Rust Build
60+
uses: Swatinem/rust-cache@v2.8.1
61+
with:
62+
shared-key: backend/oidc-bff
63+
workspaces: backend
64+
65+
- name: Run Tests
66+
working-directory: backend/oidc-bff
67+
run: >
68+
cargo test
69+
--all-targets
70+
--all-features
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: OIDC BFF Container
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
packages: write
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v5
14+
15+
- name: Generate Image Name
16+
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]')-oidc-bff >> $GITHUB_ENV
17+
18+
- name: Log in to GitHub Docker Registry
19+
if: github.event_name != 'pull_request'
20+
uses: docker/login-action@v3.6.0
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Extract Version from Tag
27+
id: tags
28+
run: echo version=$(echo "${{ github.ref }}" | awk -F '[@v]' '{print $3}') >> $GITHUB_OUTPUT
29+
30+
- name: Docker Metadata
31+
id: meta
32+
uses: docker/metadata-action@v5.9.0
33+
with:
34+
images: ${{ env.IMAGE_REPOSITORY }}
35+
tags: |
36+
type=raw,value=${{ steps.tags.outputs.version }}
37+
type=raw,value=latest
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3.11.1
41+
42+
- name: Build Image
43+
uses: docker/build-push-action@v6.18.0
44+
with:
45+
context: backend
46+
file: backend/Dockerfile.oidc-bff
47+
target: deploy
48+
push: true
49+
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/oidc-bff@')) }}
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

.github/workflows/ci.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ jobs:
6363
contents: read
6464
packages: write
6565

66+
oidc_bff_code:
67+
# Deduplicate jobs from pull requests and branch pushes within the same repo.
68+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
69+
uses: ./.github/workflows/_oidc_bff_code.yaml
70+
71+
oidc_bff_container:
72+
# Deduplicate jobs from pull requests and branch pushes within the same repo.
73+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
74+
needs: oidc_bff_code
75+
uses: ./.github/workflows/_oidc_bff_container.yaml
76+
permissions:
77+
contents: read
78+
packages: write
79+
6680
supergraph_update:
6781
# Deduplicate jobs from pull requests and branch pushes within the same repo.
6882
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository

0 commit comments

Comments
 (0)