Skip to content

Commit

Permalink
Merge pull request #114 from ananjaykumar2/fix/connector-role
Browse files Browse the repository at this point in the history
some minor fix
  • Loading branch information
gopal-mahajan authored Nov 14, 2024
2 parents c4d6276 + 83361c3 commit 5e28b7b
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pipeline {
stage('Start RS-Proxy for Integration Testing'){
steps{
script{
sh 'scp src/test/resources/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection_5.5.0.json jenkins@jenkins-master:/var/lib/jenkins/iudx/rs-proxy/Newman/'
sh 'scp src/test/resources/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection.json jenkins@jenkins-master:/var/lib/jenkins/iudx/rs-proxy/Newman/'
sh 'docker compose -f docker-compose.test.yml up -d integTest'
sh 'sleep 30'
}
Expand All @@ -91,7 +91,7 @@ pipeline {
script{
startZap ([host: '0.0.0.0', port: 8090, zapHome: '/var/lib/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/OWASP_ZAP/ZAP_2.11.0'])
sh 'curl http://0.0.0.0:8090/JSON/pscan/action/disableScanners/?ids=10096'
sh 'HTTP_PROXY=\'127.0.0.1:8090\' newman run /var/lib/jenkins/iudx/rs-proxy/Newman/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection_5.5.0.json -e /home/ubuntu/configs/rs-proxy-postman-env.json -n 2 --insecure -r htmlextra --reporter-htmlextra-export /var/lib/jenkins/iudx/rs-proxy/Newman/report/report.html --reporter-htmlextra-skipSensitiveData'
sh 'HTTP_PROXY=\'127.0.0.1:8090\' newman run /var/lib/jenkins/iudx/rs-proxy/Newman/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection.json -e /home/ubuntu/configs/rs-proxy-postman-env.json -n 2 --insecure -r htmlextra --reporter-htmlextra-export /var/lib/jenkins/iudx/rs-proxy/Newman/report/report.html --reporter-htmlextra-skipSensitiveData'
runZapAttack()
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ pipeline {
steps {
node('built-in') {
script{
sh 'newman run /var/lib/jenkins/iudx/rs-proxy/Newman/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection_5.5.0.json -e /home/ubuntu/configs/cd/rs-proxy-postman-env.json --insecure -r htmlextra --reporter-htmlextra-export /var/lib/jenkins/iudx/rs-proxy/Newman/report/cd-report.html --reporter-htmlextra-skipSensitiveData'
sh 'newman run /var/lib/jenkins/iudx/rs-proxy/Newman/ADEX-Resource-Proxy-Server-Consumer-APIs.postman_collection.json -e /home/ubuntu/configs/cd/rs-proxy-postman-env.json --insecure -r htmlextra --reporter-htmlextra-export /var/lib/jenkins/iudx/rs-proxy/Newman/report/cd-report.html --reporter-htmlextra-skipSensitiveData'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Consumers can access the data using HTTPs protocols.
the RS-proxy-server
- To try out the APIs, import the API collection, postman environment files in postman

Reference : [postman-collection](src/test/resources/IUDX-Resource-Proxy-Server-Consumer-APIs.postman_collection_5.5.0.json), [postman-environment](src/test/resources/Resource-Proxy-Server-Consumer-APIs.postman_environment.json)
Reference : [postman-collection](src/test/resources/IUDX-Resource-Proxy-Server-Consumer-APIs.postman_collection.json), [postman-environment](src/test/resources/Resource-Proxy-Server-Consumer-APIs.postman_environment.json)

# How To Guide
## Setup and Installation
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

**Thanks for reporting the vulnerability issue**! :vulcan_salute:
<br>
If you find any potential vulnerabilities in Data Exchange servers, please report it to us in a confidential way
If you find any potential vulnerabilities in Data Exchange servers, please report it to us in a confidential way
by adding the following content in the email:

```
From: <email-ID>
To: DX Admin <admin@iudx.org.in>, DX Support <support@iudx.org.in>
To: DX Admin <admin@iudx.org.in>, DX Support <support@cdpg.org.in>
Subject: Vulnerability report
Attachement: <screenshots, reports, videos, etc., >
Body:
Expand Down
101 changes: 96 additions & 5 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ consumes:

info:
title: "Data exchange Resource Server Proxy APIs"
version: 5.5.0
version: 5.6.0
description: |
# Introduction
The Resource Proxy Server is DXs'(Data Exchange) data discovery portal.
Expand Down Expand Up @@ -88,8 +88,8 @@ info:
The application should address them accordingly.
contact:
name: For support contact IUDX Team at
email: support@iudx.org.in
url: https://iudx.org.in/
email: support@cdpg.org.in
url: https://dataforpublicgood.org.in/
license:
name: Apache 2.0
tags:
Expand Down Expand Up @@ -1402,7 +1402,7 @@ paths:
- Connector
summary: create connector
responses:
'200':
'201':
description: OK
content:
application/json:
Expand Down Expand Up @@ -1674,6 +1674,56 @@ paths:
name: id
required: true
description: id is the resource item


/user/resetPassword:
post:
tags:
- Connector
summary: Reset user password
operationId: resetPassword
parameters:
- name: token
in: header
description: 'data exchange auth token for accessing the API'
required: true
style: simple
schema:
type: string
maxLength: 512
pattern: '^[a-zA-Z0-9\/\@\.]*$'
description: The reset password API enables updating the connector user's password in RMQ. The API requires the user to provide a valid access token for authentication.
x-codeSamples:
- lang: 'cURL'
label: 'reset password'
source: |
curl --location --request POST 'https://example.com/ngsi-ld/v1/user/resetPassword' \
--header 'token: <tokenValue>'
responses:
200:
description: 'User password reset successfully'
content:
application/json:
schema:
$ref: '#/components/schemas/resetpassword'

401:
content:
application/json:
schema:
"$ref": "#/components/schemas/standardInvalidTokenErrorResponse"
description: |-
- Unauthorized - `token` invalid/expired
- Unauthorized - `clientId` & `clientSecret` invalid/not match
404:
content:
application/json:
schema:
"$ref": "#/components/schemas/generalResourceNotFoundErrorResponse"
description: 'Password not found'

parameters: [ ]
components:
schemas:
Expand Down Expand Up @@ -2444,4 +2494,45 @@ components:
example:
type: urn:dx:rs:invalidAuthorizationToken
title: Not Authorized
detail: Not Authorized
detail: Not Authorized

resetpassword:
title: resetpassword
required:
- apiKey
type: object
properties:
type:
type: string
title:
type: string
description:
type: string
results:
description: An array of objects
type: array
items:
type: object
example:
type: urn:dx:rs:success
title: successful
detail: Successfully changed the password
results: [
{ "username": "asasdasd-asdasd-aada-d23342",
"apiKey": "asass8a7s"
}
]

generalResourceNotFoundErrorResponse:
title: generalResourceNotFoundErrorResponse
properties:
type:
type: string
title:
type: string
detail:
type: string
example:
type: urn:dx:rs:general
title: Not Found
detail: Not Found
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public void resetPassword(RoutingContext routingContext) {
LOGGER.debug("userid : {}", userid);

brokerService.resetPassword(
userid, // "dummy-user",
userid,
handler -> {
if (handler.succeeded()) {
handleSuccessResponse(response, ResponseType.Ok.getCode(), handler.result().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void handle(RoutingContext context) {
new RestResponse.Builder()
.withType(exception.getUrn().getUrn())
.withTitle(code.getDescription())
.withMessage(code.getDescription())
.withMessage(exception.getMessage())
.build()
.toJson();

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/iudx/rs/proxy/apiserver/query/QueryMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ private boolean isValidTimeInterval(
ZonedDateTime end = ZonedDateTime.parse(endTime);
Duration duration = Duration.between(start, end);
totalDaysAllowed = duration.toDays();
LOGGER.debug("totalDaysAllowed:: " + totalDaysAllowed);
if (start.isAfter(end)) {
isValid = false;
DxRuntimeException ex =
new DxRuntimeException(
BAD_REQUEST.getValue(),
INVALID_TEMPORAL_PARAM_URN,
"end date is before start date");
context.fail(400, ex);
}
} catch (Exception e) {
isValid = false;
DxRuntimeException ex =
Expand Down

0 comments on commit 5e28b7b

Please sign in to comment.