Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Notification
Commits
a97a1b66
Commit
a97a1b66
authored
Sep 07, 2020
by
Komal Makkar
Browse files
undoing stray changes.
parent
602f01a6
Pipeline
#7434
failed with stage
in 4 minutes and 4 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/pubsub/EventGridHandshakeHandler.java
0 → 100644
View file @
a97a1b66
// 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment