From f1fb1285cc929e5a1a442ceac00d6d79199b1fa4 Mon Sep 17 00:00:00 2001 From: clean-coder Date: Fri, 14 Jun 2024 06:37:54 +0200 Subject: [PATCH] #943: minor code cleanup for readability --- .../puzzle/okr/security/TenantJwtIssuerValidator.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/ch/puzzle/okr/security/TenantJwtIssuerValidator.java b/backend/src/main/java/ch/puzzle/okr/security/TenantJwtIssuerValidator.java index ff3d2b2788..1dadd96b3f 100644 --- a/backend/src/main/java/ch/puzzle/okr/security/TenantJwtIssuerValidator.java +++ b/backend/src/main/java/ch/puzzle/okr/security/TenantJwtIssuerValidator.java @@ -25,15 +25,12 @@ public TenantJwtIssuerValidator(TenantConfigProvider tenantConfigProvider, JwtHe @Override public OAuth2TokenValidatorResult validate(Jwt token) { - return this.validators.computeIfAbsent(toTenant(token), this::fromTenant) // - .validate(token); + String tenant = jwtHelper.getTenantFromToken(token); + JwtIssuerValidator validator = validators.computeIfAbsent(tenant, this::createValidatorForTenant); + return validator.validate(token); } - private String toTenant(Jwt jwt) { - return jwtHelper.getTenantFromToken(jwt); - } - - private JwtIssuerValidator fromTenant(String tenant) { + private JwtIssuerValidator createValidatorForTenant(String tenant) { return this.tenantConfigProvider.getTenantConfigById(tenant) // .map(TenantConfigProvider.TenantConfig::issuerUrl) // .map(this::createValidator) //