-
Notifications
You must be signed in to change notification settings - Fork 0
Authentification API
Liam Boudadi edited this page Feb 6, 2025
·
13 revisions
This documentation provides details about all available endpoints. Endpoints are grouped by their functionality.
POST /authenticate (authenticate user and obtain JWT token)
Name Type Data Type Description required string The user's email address password required string The user's password
HTTP Code Content-Type Response 200application/json{"token": "jwt_token_string"}401stringUser does not existorInvalid credentials provided500stringAn error occurred during authentication
curl -L -X POST 'http://localhost:8080/authenticate' \ -H 'Content-Type: application/json' \ --data-raw '{"email": "user@example.com", "password": "password"}'
POST /change-password (update the user's password associated with the JWT)
The request body should contain:
Name Type Data Type Description currentPassword required string The user's current password newPassword required string The new password that meets security criteria
HTTP Code Content-Type Response 200stringPassword changed successfully400stringNew password does not meet security requirements401stringCurrent password is incorrect404stringUser not found
curl -L -X POST 'http://localhost:8080/authenticate/change-password' \ -H 'Authorization: Bearer {JWT}' \ -H 'Content-Type: application/json' \ --data-raw '{"currentPassword": "currentPass", "newPassword": "NewPass123"}'
POST /reset-password?{email} (reset the requested user password)
Name Type Data Type Description required string The specific user email
HTTP Code Content-Type Response 200stringPassword reset successfully404stringUser not found500stringError sending email
curl -L -X POST 'http://localhost:8080/authenticate/reset-password?email=user@example.com' \ -H 'Authorization: Bearer {JWT}'
GET /need-change-password (return true if the user associated with the JWT needs to change his password, false otherwise)
None
HTTP Code Content-Type Response 200stringTrueorFalse404stringUser not found
curl -L -X GET 'http://localhost:8080/authenticate/need-change-password' \ -H 'Authorization: Bearer {JWT}'
POST /delete-user?{email} (delete the requested user)
ADMIN
Name Type Data Type Description required string The specific user email
HTTP Code Content-Type Response 200stringUser deleted successfully404stringUser not found
curl -L -X POST 'http://localhost:8080/authenticate/delete-user?email=user@example.com' \ -H 'Authorization: Bearer {JWT}'
GET /export-users (export users in csv file)
ADMIN
None
HTTP Code Content-Type Response 200csvUsers' info in CSV format500stringError exporting users: {error message}
curl -L -X GET 'http://localhost:8080/authenticate/export-users' \ -H 'Authorization: Bearer {JWT}'
POST /register (register a new user)
ADMIN
The request body should contain:
Name Type Data Type Description firstName required string The first name of the new user lastName required string The last name of the new user required string The email of the new user position required string The position/job title of the new user role required ADMINorUSERThe role for the new user
HTTP Code Content-Type Response 200stringUser registered successfully409stringUser already exists500stringError sending email
curl -L -X POST 'http://localhost:8080/authenticate/register' \ -H 'Authorization: Bearer {JWT}' \ -H 'Content-Type: application/json' \ --data-raw '{"firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "position": "Manager", "role": "ADMIN"}'
GET /get-user (return the user's infos associated with the JWT)
None
HTTP Code Content-Type Response 200application/json{"id": int, "firstName": "string", "lastName": "string", "email": "string", "position": "string", "role": "ADMIN" or "USER"}404stringUser not found
curl -L -X GET 'http://localhost:8080/authenticate/get-user' \ -H 'Authorization: Bearer {JWT}'
GET /get-all-users (retrieve all users in Gophish DTO format)
ADMIN
HTTP Code Content-Type Response 200application/jsonAn array of user objects in Gophish DTO format. For example: [{"id": 1, "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "position": "Manager", "role": "ADMIN"}, ...]
curl -L -X GET 'http://localhost:8080/get-all-users' \ -H 'Authorization: Bearer {JWT}'
GET /my-scan (retrieve the authenticated user's scan result)
USER,ADMIN
HTTP Code Content-Type Response 200application/jsonJSON representation of the scan result 404stringNo scan result found for {email}
curl -L -X GET 'http://localhost:8080/my-scan' \ -H 'Authorization: Bearer {JWT}'
POST /admin/scan (retrieve scan result for a specified email)
ADMIN
Name Type Data Type Description required string The email address for which to retrieve the scan
HTTP Code Content-Type Response 200application/jsonJSON representation of the scan result 400stringEmail must be provided404stringNo scan result found for {email}
curl -L -X POST 'http://localhost:8080/admin/scan' \ -H 'Authorization: Bearer {JWT}' \ -H 'Content-Type: application/json' \ --data-raw '{"email": "user@example.com"}'
POST /my-scan/new (initiate a new scan for the authenticated user)
USER,ADMIN
HTTP Code Content-Type Response Varies Varies Proxy response from the Spiderfoot API based on scan initiation
curl -L -X POST 'http://localhost:8080/my-scan/new' \ -H 'Authorization: Bearer {JWT}'
POST /admin/scan/new (initiate a new scan for a specified email)
ADMIN
Name Type Data Type Description required string The email address to initiate the scan for
HTTP Code Content-Type Response Varies Varies Proxy response from the Spiderfoot API based on scan initiation 400stringEmail must be provided
curl -L -X POST 'http://localhost:8080/admin/scan/new' \ -H 'Authorization: Bearer {JWT}' \ -H 'Content-Type: application/json' \ --data-raw '{"email": "user@example.com"}'
GET /welcome (verify if JWT is valid)
HTTP Code Content-Type Response 200stringWelcome! You are successfully authenticated.
curl -L -X GET 'http://localhost:8080/welcome' \ -H 'Authorization: Bearer {JWT}'
GET /test-user (user test endpoint)
USER,ADMIN
HTTP Code Content-Type Response 200stringThis is an user endpoint
curl -L -X GET 'http://localhost:8080/test-user' \ -H 'Authorization: Bearer {JWT}'
GET /test-admin (admin test endpoint)
ADMIN
HTTP Code Content-Type Response 200stringThis is an admin endpoint
curl -L -X GET 'http://localhost:8080/test-admin' \ -H 'Authorization: Bearer {JWT}'