feat(auth): change accepting invitations to be an authorized endpoint

This commit is contained in:
Karol Sójko
2022-10-24 13:44:45 +02:00
parent 4ea7309001
commit 771a555b4f
13 changed files with 110 additions and 40 deletions
Generated
+49 -14
View File
@@ -2555,14 +2555,14 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["@standardnotes/api", [\
["npm:1.16.3", {\
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.16.3-d0cc3c9f0e-512d89961f.zip/node_modules/@standardnotes/api/",\
["npm:1.17.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-api-npm-1.17.2-c07102ac18-4f74f52306.zip/node_modules/@standardnotes/api/",\
"packageDependencies": [\
["@standardnotes/api", "npm:1.16.3"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/encryption", "npm:1.18.2"],\
["@standardnotes/models", "npm:1.28.0"],\
["@standardnotes/responses", "npm:1.11.1"],\
["@standardnotes/encryption", "npm:1.18.5"],\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/security", "workspace:packages/security"],\
["@standardnotes/utils", "npm:1.10.0"],\
["reflect-metadata", "npm:0.1.13"]\
@@ -2635,7 +2635,7 @@ const RAW_RUNTIME_STATE =
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/analytics", "workspace:packages/analytics"],\
["@standardnotes/api", "npm:1.16.3"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -2764,13 +2764,13 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["@standardnotes/encryption", [\
["npm:1.18.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.18.2-546eee8438-255f21734f.zip/node_modules/@standardnotes/encryption/",\
["npm:1.18.5", {\
"packageLocation": "./.yarn/cache/@standardnotes-encryption-npm-1.18.5-80059dd62d-b023188012.zip/node_modules/@standardnotes/encryption/",\
"packageDependencies": [\
["@standardnotes/encryption", "npm:1.18.2"],\
["@standardnotes/encryption", "npm:1.18.5"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/models", "npm:1.28.0"],\
["@standardnotes/responses", "npm:1.11.1"],\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/sncrypto-common", "npm:1.13.0"],\
["@standardnotes/utils", "npm:1.10.0"],\
["reflect-metadata", "npm:0.1.13"]\
@@ -2820,6 +2820,17 @@ const RAW_RUNTIME_STATE =
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}],\
["npm:1.53.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.53.2-cd8faaf4ee-820219e3a5.zip/node_modules/@standardnotes/features/",\
"packageDependencies": [\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/auth", "npm:3.19.4"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/security", "workspace:packages/security"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}]\
]],\
["@standardnotes/files-server", [\
@@ -2888,6 +2899,19 @@ const RAW_RUNTIME_STATE =
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}],\
["npm:1.30.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-models-npm-1.30.0-c2134137c4-40c234f92b.zip/node_modules/@standardnotes/models/",\
"packageDependencies": [\
["@standardnotes/models", "npm:1.30.0"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/utils", "npm:1.10.0"],\
["lodash", "npm:4.17.21"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}]\
]],\
["@standardnotes/payloads", [\
@@ -2930,6 +2954,17 @@ const RAW_RUNTIME_STATE =
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}],\
["npm:1.11.2", {\
"packageLocation": "./.yarn/cache/@standardnotes-responses-npm-1.11.2-61f5ee52c3-2a1ffd142c.zip/node_modules/@standardnotes/responses/",\
"packageDependencies": [\
["@standardnotes/responses", "npm:1.11.2"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/features", "npm:1.53.2"],\
["@standardnotes/security", "workspace:packages/security"],\
["reflect-metadata", "npm:0.1.13"]\
],\
"linkType": "HARD"\
}]\
]],\
["@standardnotes/scheduler-server", [\
@@ -3154,7 +3189,7 @@ const RAW_RUNTIME_STATE =
["@standardnotes/websockets-server", "workspace:packages/websockets"],\
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/api", "npm:1.16.3"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -3194,7 +3229,7 @@ const RAW_RUNTIME_STATE =
["@standardnotes/workspace-server", "workspace:packages/workspace"],\
["@newrelic/winston-enricher", "virtual:04783e12400851b8a3d76e71495851cc94959db6e62f04cb0a31190080629440b182d8c8eb4d7f2b04e281912f2783a5fd4d2c3c6ab68d38b7097246c93f4c19#npm:4.0.0"],\
["@sentry/node", "npm:7.5.0"],\
["@standardnotes/api", "npm:1.16.3"],\
["@standardnotes/api", "npm:1.17.2"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
@@ -26,7 +26,7 @@ export class SubscriptionInvitesController extends BaseHttpController {
await this.httpService.callAuthServer(request, response, `subscription-invites/${request.params.inviteUuid}`)
}
@httpGet('/:inviteUuid/accept')
@httpPost('/:inviteUuid/accept', TYPES.AuthMiddleware)
async acceptInvite(request: Request, response: Response): Promise<void> {
await this.httpService.callAuthServer(request, response, `subscription-invites/${request.params.inviteUuid}/accept`)
}
+1 -1
View File
@@ -33,7 +33,7 @@
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/analytics": "workspace:*",
"@standardnotes/api": "^1.16.0",
"@standardnotes/api": "^1.17.2",
"@standardnotes/common": "workspace:*",
"@standardnotes/domain-events": "workspace:*",
"@standardnotes/domain-events-infra": "workspace:*",
@@ -1,4 +1 @@
export type AcceptSharedSubscriptionInvitationResponse = {
success: boolean
message?: string
}
export type AcceptSharedSubscriptionInvitationResponse = { success: true } | { success: false; message: string }
@@ -22,7 +22,7 @@ export class InversifyExpressSubscriptionInvitesController extends BaseHttpContr
super()
}
@httpGet('/:inviteUuid/accept')
@httpPost('/:inviteUuid/accept', TYPES.ApiGatewayAuthMiddleware)
async acceptInvite(request: Request): Promise<results.JsonResult> {
const response = await this.subscriptionInvitesController.acceptInvite({
api: request.query.api as ApiVersion,
+1 -1
View File
@@ -24,7 +24,7 @@
"dependencies": {
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/api": "^1.16.1",
"@standardnotes/api": "^1.17.2",
"@standardnotes/common": "workspace:^",
"@standardnotes/domain-events": "workspace:^",
"@standardnotes/domain-events-infra": "workspace:^",
+1 -1
View File
@@ -24,7 +24,7 @@
"dependencies": {
"@newrelic/winston-enricher": "^4.0.0",
"@sentry/node": "^7.3.0",
"@standardnotes/api": "^1.16.0",
"@standardnotes/api": "^1.17.2",
"@standardnotes/common": "workspace:*",
"@standardnotes/domain-events": "workspace:^",
"@standardnotes/domain-events-infra": "workspace:^",
+55 -17
View File
@@ -1861,18 +1861,18 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/api@npm:^1.16.0, @standardnotes/api@npm:^1.16.1":
version: 1.16.3
resolution: "@standardnotes/api@npm:1.16.3"
"@standardnotes/api@npm:^1.17.2":
version: 1.17.2
resolution: "@standardnotes/api@npm:1.17.2"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/encryption": "npm:1.18.2"
"@standardnotes/models": "npm:1.28.0"
"@standardnotes/responses": "npm:1.11.1"
"@standardnotes/encryption": "npm:1.18.5"
"@standardnotes/models": "npm:1.30.0"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/security": "npm:^1.1.0"
"@standardnotes/utils": "npm:1.10.0"
reflect-metadata: "npm:^0.1.13"
checksum: 512d89961fc2eba3c1b8368f165b84b0d1445f3cc9fe96fdbd9d6400b03830907a2dd6b8a81c63432861bae77a41aab75bb00e2829291a50c3eefc260bb7f3d3
checksum: 4f74f52306c27f8bc8b26eb78abb952393b608f16cf18683ec3f7363b64c511786401e59fd57bfc7613c55876aabcb47f256dfcdb0d09b8416ca1901d8562338
languageName: node
linkType: hard
@@ -1883,7 +1883,7 @@ __metadata:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/analytics": "workspace:*"
"@standardnotes/api": "npm:^1.16.0"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/common": "workspace:*"
"@standardnotes/domain-events": "workspace:*"
"@standardnotes/domain-events-infra": "workspace:*"
@@ -2013,17 +2013,17 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/encryption@npm:1.18.2":
version: 1.18.2
resolution: "@standardnotes/encryption@npm:1.18.2"
"@standardnotes/encryption@npm:1.18.5":
version: 1.18.5
resolution: "@standardnotes/encryption@npm:1.18.5"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/models": "npm:1.28.0"
"@standardnotes/responses": "npm:1.11.1"
"@standardnotes/models": "npm:1.30.0"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/sncrypto-common": "npm:1.13.0"
"@standardnotes/utils": "npm:1.10.0"
reflect-metadata: "npm:^0.1.13"
checksum: 255f21734f026f12dc69bb77ac946fcf20c1ed2bc86113a4a398abe8570ddc3772d657573c8cf0606ccb1be8e1a60d86f1097038b81879c2a28ff49e73bd52fb
checksum: b02318801254b428d6a9a26f8ab9bf9b47ddf4e538616f928e6b8db6dfa60270e99b9cd350346d7956c923071ac693d6952c5ec195e46f3df1256a9996520a2f
languageName: node
linkType: hard
@@ -2068,6 +2068,18 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/features@npm:1.53.2":
version: 1.53.2
resolution: "@standardnotes/features@npm:1.53.2"
dependencies:
"@standardnotes/auth": "npm:^3.19.4"
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/security": "npm:^1.2.0"
reflect-metadata: "npm:^0.1.13"
checksum: 820219e3a58fb2b03f3341e9cac2c4a5704b77f1ec8f1ad986aa7ffa92e2ce4bc87c24a1aee98ac80c957a293edf84bef91cff9fce973ab2f108f5ef726db2cc
languageName: node
linkType: hard
"@standardnotes/files-server@workspace:packages/files":
version: 0.0.0-use.local
resolution: "@standardnotes/files-server@workspace:packages/files"
@@ -2119,7 +2131,21 @@ __metadata:
languageName: unknown
linkType: soft
"@standardnotes/models@npm:1.28.0, @standardnotes/models@npm:^1.26.0":
"@standardnotes/models@npm:1.30.0":
version: 1.30.0
resolution: "@standardnotes/models@npm:1.30.0"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/features": "npm:1.53.2"
"@standardnotes/responses": "npm:1.11.2"
"@standardnotes/utils": "npm:1.10.0"
lodash: "npm:^4.17.21"
reflect-metadata: "npm:^0.1.13"
checksum: 40c234f92ba0b4c33ba7e8cc604058f3b87086d83dd5642ed5d17faff47dacbf6079bf3912c5eac6f51d0dae13da1ad960746c3cc36a0d37128f3bf6b2ce873d
languageName: node
linkType: hard
"@standardnotes/models@npm:^1.26.0":
version: 1.28.0
resolution: "@standardnotes/models@npm:1.28.0"
dependencies:
@@ -2171,6 +2197,18 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/responses@npm:1.11.2":
version: 1.11.2
resolution: "@standardnotes/responses@npm:1.11.2"
dependencies:
"@standardnotes/common": "npm:^1.39.0"
"@standardnotes/features": "npm:1.53.2"
"@standardnotes/security": "npm:^1.1.0"
reflect-metadata: "npm:^0.1.13"
checksum: 2a1ffd142c23866228afe06d1dc6e453515d8bf8ad3da0ca2e24d638835a2f639913d75aa830c24343bed743baeb76c382c2cf70232e75538b5c3803fe8ddf0d
languageName: node
linkType: hard
"@standardnotes/scheduler-server@workspace:packages/scheduler":
version: 0.0.0-use.local
resolution: "@standardnotes/scheduler-server@workspace:packages/scheduler"
@@ -2376,7 +2414,7 @@ __metadata:
dependencies:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/api": "npm:^1.16.1"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/common": "workspace:^"
"@standardnotes/domain-events": "workspace:^"
"@standardnotes/domain-events-infra": "workspace:^"
@@ -2414,7 +2452,7 @@ __metadata:
dependencies:
"@newrelic/winston-enricher": "npm:^4.0.0"
"@sentry/node": "npm:^7.3.0"
"@standardnotes/api": "npm:^1.16.0"
"@standardnotes/api": "npm:^1.17.2"
"@standardnotes/common": "workspace:*"
"@standardnotes/domain-events": "workspace:^"
"@standardnotes/domain-events-infra": "workspace:^"