Commit b34eee96 authored by Komal Makkar's avatar Komal Makkar
Browse files

undoing stray changes

parent 557624c0
Pipeline #7473 failed with stage
in 2 minutes and 37 seconds
// Copyright © Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.notification.provider.azure.pubsub;
import com.google.gson.JsonObject;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.notification.provider.interfaces.IPubsubHandshakeHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@Component
public class EventGridHandshakeHandler implements IPubsubHandshakeHandler {
@Autowired
private EventGridRequestBodyExtractor eventGridRequestBodyExtractor;
/**
* Extract Handshake response string form Handshake request.
* TODO: Check if there is a need to verify subscription name with
* registration service, before verifying the endpoint.
* @return validation string
*/
@Override
public String getHandshakeResponse() {
String response;
try {
String validationCode = this.eventGridRequestBodyExtractor.getValidationCodeForHandshake();
JsonObject jsonResponse = new JsonObject();
jsonResponse.addProperty("ValidationResponse", validationCode);
response = jsonResponse.toString();
} catch (Exception exception) {
throw new AppException(HttpStatus.BAD_REQUEST.value(), "Request payload parsing error",
"Unable to parse request payload.", exception);
}
return response;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment