Skip to content

Commit

Permalink
App Config Webhook Fix (Azure#37141)
Browse files Browse the repository at this point in the history
* Updated Auto Configuration

* Update spring.factories

* Fixing Push Refresh
  • Loading branch information
mrm9084 authored Oct 11, 2023
1 parent a93e9eb commit 475fcf0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

* Fixed Event Hook validation

### Other Changes

## 4.11.0 (2023-08-25)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ public String refresh(HttpServletRequest request, HttpServletResponse response,
return HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase();
}

if (!endpoint.authenticate()) {
return HttpStatus.UNAUTHORIZED.getReasonPhrase();
}

String syncToken = endpoint.getSyncToken();

JsonNode validationResponse = endpoint.getValidationResponse();
if (validationResponse != null) {
// Validating Web Hook
return VALIDATION_CODE_FORMAT_START + validationResponse.asText() + "\"}";
} else {
if (!endpoint.authenticate()) {
return HttpStatus.UNAUTHORIZED.getReasonPhrase();
}

if (endpoint.triggerRefresh()) {
// Spring Bus is in use, will publish a RefreshRemoteApplicationEvent

publish(new AppConfigurationBusRefreshEvent(endpoint.getEndpoint(), syncToken, this, getInstanceId(),
new PathDestinationFactory().getDestination(null)));
new PathDestinationFactory().getDestination(null)));
return HttpStatus.OK.getReasonPhrase();
} else {
LOGGER.debug("Non Refreshable notification");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ public String refresh(HttpServletRequest request, HttpServletResponse response,
return HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase();
}

if (!endpoint.authenticate()) {
return HttpStatus.UNAUTHORIZED.getReasonPhrase();
}

String syncToken = endpoint.getSyncToken();

JsonNode validationResponse = endpoint.getValidationResponse();
if (validationResponse != null) {
// Validating Web Hook
return String.format("%s%s\"}", VALIDATION_CODE_FORMAT_START, validationResponse.asText());
} else {
if (!endpoint.authenticate()) {
return HttpStatus.UNAUTHORIZED.getReasonPhrase();
}

if (contextRefresher != null) {
if (endpoint.triggerRefresh()) {
publisher.publishEvent(new AppConfigurationRefreshEvent(endpoint.getEndpoint(), syncToken));
Expand Down

0 comments on commit 475fcf0

Please sign in to comment.