diff options
author | Anthony Wilson <wilsonan@us.ibm.com> | 2019-03-15 23:40:58 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-03-18 23:16:46 +0300 |
commit | af713a64876d7736a43dc46e5abaeb7070fa5a62 (patch) | |
tree | 0ab7a62f5565f6af1aa8b953a02ef8ed128ba683 /include | |
parent | beeca0ae7d30ea68f3e6e5841ec631ee25248ffb (diff) | |
download | bmcweb-af713a64876d7736a43dc46e5abaeb7070fa5a62.tar.xz |
bmcweb: Add JSON response to /logout
When logging out of the API, there was no JSON text response.
This implements the requested feature.
Tested: Verified appropriate response is generated when /logout
is called
E.g.
curl -c cjar -b cjar -k -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: g3Heq5rYsz1j0iv4MbUp" \
-d '{"data": [ ] }' \
https://${bmc}/logout
{
"data": "User 'root' logged out",
"message": "200 OK",
"status": "ok"
}
Change-Id: I905f5a0855abaa76ae57cf32b8bae758722f6b9f
Signed-off-by: Anthony Wilson <wilsonan@us.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/token_authorization_middleware.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/token_authorization_middleware.hpp b/include/token_authorization_middleware.hpp index c5c65230a1..697e4003f2 100644 --- a/include/token_authorization_middleware.hpp +++ b/include/token_authorization_middleware.hpp @@ -438,6 +438,11 @@ template <typename... Middlewares> void requestRoutes(Crow<Middlewares...>& app) .session; if (session != nullptr) { + res.jsonValue = { + {"data", "User '" + session->username + "' logged out"}, + {"message", "200 OK"}, + {"status", "ok"}}; + persistent_data::SessionStore::getInstance().removeSession( session); } |