Fixing logout issue.

This commit is contained in:
stephb9959
2022-05-15 07:47:42 -07:00
parent ab22a75fc5
commit 8bbe084640
3 changed files with 31 additions and 11 deletions

View File

@@ -33,7 +33,16 @@ namespace OpenWifi {
void RESTAPI_suboauth2_handler::DoDelete() {
auto Token = GetBinding(RESTAPI::Protocol::TOKEN, "");
if(Token.empty() || (Token != SessionToken_)) {
std::string SessionToken;
try {
Poco::Net::OAuth20Credentials Auth(*Request);
if (Auth.getScheme() == "Bearer") {
SessionToken = Auth.getBearerToken();
}
} catch (const Poco::Exception &E) {
Logger_.log(E);
}
if (Token.empty() || (Token != SessionToken)) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
AuthService()->SubLogout(Token);