Skip to content

Commit

Permalink
Refactor logging and adjust configuration limits
Browse files Browse the repository at this point in the history
#deploy-idporten-frontend

Refactored log statements in reactive-security to include more contextual details about authentication objects. Updated `config.idporten.yml` to reduce the maximum number of replicas to 1. Commented out the Playwright job in the frontend workflow file to disable it temporarily.
  • Loading branch information
krharum committed Dec 17, 2024
1 parent ae444be commit 94e6e68
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/app.dolly-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ on:
- ".github/workflows/common.playwright.yml"

jobs:
playwright:
uses: ./.github/workflows/common.playwright.yml
with:
working-directory: "apps/dolly-frontend"
secrets:
READER_TOKEN: ${{ secrets.READER_TOKEN }}
# playwright:
# uses: ./.github/workflows/common.playwright.yml
# with:
# working-directory: "apps/dolly-frontend"
# secrets:
# READER_TOKEN: ${{ secrets.READER_TOKEN }}

workflow:
uses: ./.github/workflows/common.workflow.frontend.yml
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
tenant: nav.no
replicas:
min: 1
max: 2
max: 1
port: 8080
ingresses:
- "https://dolly-idporten.ekstern.dev.nav.no"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private Mono<String> getTokenAttribute(String attribute) {

private String getTokenAttribute(Authentication authentication, String attribute) {

log.info("context.authentication {}, {}", authentication.getClass().getCanonicalName(), authentication);
log.info("GetAuthenticatedUserId context.authentication {}, {}", authentication.getClass().getPackageName(), authentication);
if (authentication instanceof JwtAuthenticationToken jwtAuthenticationToken) {
return jwtAuthenticationToken.getTokenAttributes().get(attribute).toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Mono<JwtAuthenticationToken> getJwtAuthenticationToken() {
return ReactiveSecurityContextHolder
.getContext()
.switchIfEmpty(Mono.error(new JwtResolverException("ReactiveSecurityContext is empty")))
.doOnNext(context -> log.info("context.authentication {}", context.getAuthentication()))
.doOnNext(context -> log.info("JwtResolver context.authentication {} {}", context.getAuthentication().getClass().getCanonicalName(), context.getAuthentication()))
.map(SecurityContext::getAuthentication)
.map(JwtAuthenticationToken.class::cast)
.doOnError(throwable -> log.warn("Klarte ikke hente Jwt Auth Token", throwable))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static Mono<OAuth2AuthenticationToken> getOauth2AuthenticationToken() {
return ReactiveSecurityContextHolder
.getContext()
.switchIfEmpty(Mono.error(new JwtResolverException("ReactiveSecurityContext is empty")))
.doOnNext(context -> log.info("context.authentication {}", context.getAuthentication()))
.doOnNext(context -> log.info("Oauth2Resolver context.authentication {} {}", context.getAuthentication().getClass().getCanonicalName(), context.getAuthentication()))
.map(SecurityContext::getAuthentication)
.map(OAuth2AuthenticationToken.class::cast)
.doOnError(throwable -> log.warn("Klarte ikke hente Jwt Auth Token", throwable))
Expand Down

0 comments on commit 94e6e68

Please sign in to comment.