Added missing endpoints
MODIFY
src/assets/server/rest/v1/docs/open-api-standard.json
src/assets/server/rest/v1/docs/open-api-standard.json
}
}
},
+ "/signout": {
+ "get": {
+ "description": "Sign out",
+ "tags": [
+ "Auth"
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully signed out"
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ }
+ }
+ }
+ },
"/passwordreset": {
"post": {
"description": "Reset password",
}
}
}
+ },
+ "/eula/{language}": {
+ "get": {
+ "description": "Get tenant EULA",
+ "parameters": [
+ {
+ "in": "header",
+ "name": "Tenant",
+ "description": "Tenant's subdomain",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "path",
+ "name": "language",
+ "description": "Browser language",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "tags": [
+ "Auth"
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved tenant's EULA",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "$ref": "#/components/schemas/Eulas"
+ }
+ }
+ }
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "550": {
+ "description": "Unknown tenant"
+ }
+ }
+ }
+ },
+ "/checkEula": {
+ "get": {
+ "description": "Check if a user accepted latest EULA",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "Email",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "Tenant",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "tags": [
+ "Auth"
+ ],
+ "responses": {
+ "200": {
+ "description": "User accepted latest EULA",
+ "content": {
+ "application/json": {
+ "examples": {
+ "Accepted latest": {
+ "value": {
+ "acceptedEula": true
+ }
+ },
+ "Not accepted latest": {
+ "value": {
+ "acceptedEula": false
+ }
+ }
+ }
+ }
+ }
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "550": {
+ "description": "Unknown tenant"
+ },
+ "591": {
+ "description": "Account already activated"
+ }
+ }
+ }
+ },
+ "/verifyEmail": {
+ "get": {
+ "description": "Verify email",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "Email",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "Tenant",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "VerificationToken",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "tags": [
+ "Auth"
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully validated email"
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "550": {
+ "description": "Unknown tenant or logically deleted user"
+ },
+ "591": {
+ "description": "Account already activated"
+ }
+ }
+ }
+ },
+ "/resendVerficationEmail": {
+ "post": {
+ "description": "Resend a verification email",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ResendVerificationMail"
+ }
+ }
+ }
+ },
+ "tags": [
+ "Auth"
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully validated email"
+ },
+ "500": {
+ "$ref": "#/components/responses/500BackendError"
+ },
+ "550": {
+ "description": "Unknown tenant"
+ },
+ "591": {
+ "description": "Account already activated"
+ }
+ }
+ }
}
},
"components": {
}
}
},
+ "Eulas": {
+ "type": "object",
+ "required": ["text"],
+ "properties": {
+ "text": {
+ "type": "string",
+ "example": "<h3>End-user Agreement Usage of the e-Mobility Software</h3>..."
+ }
+ }
+ },
+ "ResendVerificationMail": {
+ "type": "object",
+ "required": ["email", "tenant", "captcha"],
+ "properties": {
+ "email": {
+ "type": "string",
+ "example": "loan.alouache@sap.com"
+ },
+ "tenant": {
+ "type": "string",
+ "example": "utall"
+ },
+ "captcha": {
+ "type": "string",
+ "example": "03AGdBq261sQ2KzqROGD8E2Xb2ljxLkmQbUumIL9m6FqtJZau9Z5Aq4Pp8K-VzbjTwuvnBvdaZBgD-6VU0IY8PMSyGmSJNH9Ctkgde4l8XoQUVLYLhspglIRSjkPS15-DZQtJ2gLG910Kq3RXE-S5M9gkuXBfEh6Y-81qC9gRb-FFwN_Ao5_NO7j6iu1kZqJHpyxHvwVqtbLK5APvTngU_8gx9tRDfXUBtLMmgZAofmkIE1qbefMNTDceJsiNKtHHykP-xFIt-lNRN1H6h_HZ8EbRjncT5k_AeqjL8ClBTZy9Pdqwy9jkpvas4l5EH7WPVT-9VPV0C0tuwKkwwwesMhzYSo2Vso_wN15G5x1Zgji8xsndjvMthTkIWe4zyRNKNr2gc4z1Sgfy-dGcRkDc7lUnet0fJfII5bXKl_njo_S8no8KGVZ2IeOTzhTKigA7A0hdtNrKnAOmU"
+ }
+ }
+ },
"Address": {
"type": "object",
"properties": {

MODIFY
src/server/rest/v1/router/auth/AuthRouter.ts
src/server/rest/v1/router/auth/AuthRouter.ts
@@ -3,6 +3,7 @@ import express, { NextFunction, Request, Response } from 'express';
import AuthService from '../../service/AuthService';
import RouterUtils from '../RouterUtils';
import { ServerAction } from '../../../../../types/Server';
+import sanitize from 'mongo-sanitize';
export default class AuthRouter {
private router: express.Router;
@@ -18,6 +19,7 @@ export default class AuthRouter {
this.buildRoutePasswordReset();
this.buildRouteVerifyMail();
this.buildRouteResendVerificationMail();
+ this.buildRouteEndUserLicenseAgreement();
this.buildRouteCheckEndUserLicenseAgreement();
return this.router;
}
@@ -58,9 +60,16 @@ export default class AuthRouter {
});
}
+ protected buildRouteEndUserLicenseAgreement(): void {
+ this.router.get(`/${ServerAction.REST_END_USER_LICENSE_AGREEMENT}/:language`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.Language = sanitize(req.params.Language);
+ await RouterUtils.handleServerAction(AuthService.handleGetEndUserLicenseAgreement.bind(this), ServerAction.REST_END_USER_LICENSE_AGREEMENT, req, res, next);
+ });
+ }
+
protected buildRouteCheckEndUserLicenseAgreement(): void {
- this.router.post(`/${ServerAction.REST_CHECK_USER_LICENSE_AGREEMENT}`, async (req: Request, res: Response, next: NextFunction) => {
- await RouterUtils.handleServerAction(AuthService.handleVerifyEmail.bind(this), ServerAction.REST_CHECK_USER_LICENSE_AGREEMENT, req, res, next);
+ this.router.get(`/${ServerAction.REST_CHECK_END_USER_LICENSE_AGREEMENT}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(AuthService.handleCheckEndUserLicenseAgreement.bind(this), ServerAction.REST_CHECK_END_USER_LICENSE_AGREEMENT, req, res, next);
});
}
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -374,10 +374,11 @@ export enum ServerAction {
REST_SIGNIN = 'signin',
REST_SIGNON = 'signon',
REST_SIGNOUT = 'signout',
- REST_PASSWORD_RESET = 'passwordreset',
- REST_VERIFY_EMAIL = 'verifyemail',
- REST_RESEND_VERIFICATION_EMAIL = 'resendverficationmail',
- REST_CHECK_USER_LICENSE_AGREEMENT = 'checkenduserlicenseagreement',
+ REST_PASSWORD_RESET = 'passwordReset',
+ REST_VERIFY_EMAIL = 'verifyEmail',
+ REST_RESEND_VERIFICATION_EMAIL = 'resendVerficationEmail',
+ REST_END_USER_LICENSE_AGREEMENT = 'eula',
+ REST_CHECK_END_USER_LICENSE_AGREEMENT = 'checkEula',
REST_PING = 'ping',
REST_TENANTS = 'tenants'
}

Added missing endpoints