This is a mock backend API to simulate a user-driven approval flow used by a custom polling authenticator in the Curity Identity Server.
The API simulates sending a notification to a user, tracking their decision (approve/decline), and allowing the polling-example-authenticator to poll for the user's response.
POST /send-notification
: Simulates sending an authentication request to a userGET /status/:requestId
: Returns the current status of the requestPOST /user-action
: Allows a user to approve or decline a request
- Node.js (v18+ recommended)
- npm or yarn
- Clone the repository
- Install dependencies (only
express
anduuid
are required):
npm install
- Start the server
node mock-api.js
The API will start on http://localhost:3000.
Simulates triggering a notification for a user to approve or decline.
Request Body:
{
"username": "alice"
}
Response:
{
"requestId": "140896ed-a726-43e0-a359-d0f1f7bbedc2"
}
Polls the current status of a specific request.
Response:
{
"status": "pending"
}
Status can be:
- pending
- approved
- declined
Simulates a user approving or declining the request.
Request Body:
{
"requestId": "140896ed-a726-43e0-a359-d0f1f7bbedc2",
"action": "approve"
}
Valid actions:
- approve
- decline
- Call
POST /send-notification
with a username - Poll
GET /status/:requestId
from your authenticator - Simulate the user's action by calling
POST /user-action
withapprove
ordecline
- Authenticator receives the updated status during polling
- This is a mock/stub implementation meant for testing the polling authenticator plugin.
- No persistence: all statuses are stored in-memory.
- No authentication or security is implemented.