Skip to content

Commit

Permalink
#943: minor code cleanup for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
clean-coder committed Jun 14, 2024
1 parent 41a852e commit f1fb128
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) //
Expand Down

0 comments on commit f1fb128

Please sign in to comment.