|
|
@ -74,13 +74,12 @@ class ReactiveTokenValidator {
|
|
|
|
return Mono.just(this.cachedTokenKeys)
|
|
|
|
return Mono.just(this.cachedTokenKeys)
|
|
|
|
.filter((tokenKeys) -> tokenKeys.containsKey(keyId))
|
|
|
|
.filter((tokenKeys) -> tokenKeys.containsKey(keyId))
|
|
|
|
.switchIfEmpty(this.securityService.fetchTokenKeys()
|
|
|
|
.switchIfEmpty(this.securityService.fetchTokenKeys()
|
|
|
|
.doOnSuccess(fetchedTokenKeys -> {
|
|
|
|
.doOnSuccess((fetchedTokenKeys) -> {
|
|
|
|
this.cachedTokenKeys.clear();
|
|
|
|
this.cachedTokenKeys.clear();
|
|
|
|
this.cachedTokenKeys.putAll(fetchedTokenKeys);
|
|
|
|
this.cachedTokenKeys.putAll(fetchedTokenKeys);
|
|
|
|
})
|
|
|
|
}).filter((tokenKeys) -> tokenKeys.containsKey(keyId))
|
|
|
|
.filter((tokenKeys) -> tokenKeys.containsKey(keyId))
|
|
|
|
.switchIfEmpty((Mono.error(new CloudFoundryAuthorizationException(
|
|
|
|
.switchIfEmpty((Mono.error(
|
|
|
|
Reason.INVALID_KEY_ID,
|
|
|
|
new CloudFoundryAuthorizationException(Reason.INVALID_KEY_ID,
|
|
|
|
|
|
|
|
"Key Id present in token header does not match")))))
|
|
|
|
"Key Id present in token header does not match")))))
|
|
|
|
.filter((tokenKeys) -> hasValidSignature(token, tokenKeys.get(keyId)))
|
|
|
|
.filter((tokenKeys) -> hasValidSignature(token, tokenKeys.get(keyId)))
|
|
|
|
.switchIfEmpty(Mono.error(new CloudFoundryAuthorizationException(
|
|
|
|
.switchIfEmpty(Mono.error(new CloudFoundryAuthorizationException(
|
|
|
|