security: remove obsolete CRM login endpoint
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getlogin_api:
|
||||
* get:
|
||||
* tags: [Login]
|
||||
* description: Returns the hello world
|
||||
* summary: Phase 2
|
||||
* parameters:
|
||||
* - name: emailaddress
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* - name: pwd
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
import { azureHeadersPaged } from "../../../actions/core/headers";
|
||||
import { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
import { RELAY_POLICY_STRICT_LOGIN } from "../middleware/relayPolicyPresets";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
const pwd = req.query.pwd;
|
||||
|
||||
if (typeof emailAddress !== "string" || emailAddress.trim().length === 0) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "EMAIL_ADDRESS_REQUIRED",
|
||||
message: "emailAddress is required"
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof pwd !== "string" || pwd.trim().length === 0) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "PASSWORD_REQUIRED",
|
||||
message: "pwd is required"
|
||||
});
|
||||
}
|
||||
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"' and pinswg_custom_password eq '" +
|
||||
pwd +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
|
||||
const relayPolicy = RELAY_POLICY_STRICT_LOGIN;
|
||||
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
relayPolicy,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "LOGIN_FETCH_FAILED",
|
||||
message: "Failed to fetch login details"
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user