Skip to content

Commit

Permalink
feat: Added "iss" and "aud" claims to tokens. (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniotarricone authored Feb 12, 2024
1 parent 4735eb6 commit 5f48414
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/build-n-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Build and push

on:
workflow_dispatch:
inputs:
skip-unit-test:
type: boolean
required: true
description: Skip unit-test

jobs:
build_and_push_main:
Expand Down Expand Up @@ -90,7 +95,7 @@ jobs:
# Build native executable.
#
- name: Build native executable
run: ${{ runner.temp }}/maven/bin/mvn clean package -Pnative -Dmaven.test.skip=false -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:05baf3fd2173f6f25ad35216b6b066c35fbfb97f06daba75efb5b22bc0a85b9c -s ${{ runner.temp }}/settings.xml --no-transfer-progress
run: ${{ runner.temp }}/maven/bin/mvn clean package -Pnative -Dmaven.test.skip=${{ github.event.inputs.skip-unit-test }} -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image@sha256:05baf3fd2173f6f25ad35216b6b066c35fbfb97f06daba75efb5b22bc0a85b9c -s ${{ runner.temp }}/settings.xml --no-transfer-progress

#
# Build Docker image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public abstract class TokenService {
*/
@ConfigProperty(name = "refresh.duration")
long refreshDuration;

/*
* mil-auth base URL.
*/
@ConfigProperty(name = "base-url", defaultValue = "")
String baseUrl;

/*
* Token audience.
*/
@ConfigProperty(name = "token-audience", defaultValue = "mil.pagopa.it")
String audience;

/*
*
Expand Down Expand Up @@ -96,6 +108,8 @@ private Uni<String> generate(GetAccessTokenRequest request, long duration, List<
.claim(ClaimName.SCOPE, concat(scopes))
.claim(ClaimName.GROUPS, roles)
.claim(ClaimName.FISCAL_CODE, request.getFiscalCode())
.issuer(baseUrl)
.audience(audience)
.build();
Log.debug("Token signing.");
return tokenSigner.sign(payload).map(SignedJWT::serialize);
Expand Down

0 comments on commit 5f48414

Please sign in to comment.