Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #274 update unified security handler to handle the basic and ap… #275

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.endExchange();
return;
} else {
handler.handleBasicAuth(exchange, reqPath, authorization);
break;
if(handler.handleBasicAuth(exchange, reqPath, authorization)) {
// verification is passed, go to the next handler in the chain
break;
} else {
// verification is not passed and an error is returned. Don't call the next handler.
return;
}
}
} else if (BEARER_PREFIX.equalsIgnoreCase(authorization.substring(0, 6))) {
Map<String, HttpHandler> handlers = Handler.getHandlers();
Expand All @@ -108,7 +113,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
// verification is passed, go to the next handler in the chain.
break;
} else {
// verification is not passed and an error is returned.
// verification is not passed and an error is returned. Don't call the next handler.
return;
}
}
Expand All @@ -130,8 +135,13 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.endExchange();
return;
} else {
handler.handleApiKey(exchange, reqPath);
break;
if(handler.handleApiKey(exchange, reqPath)) {
// the APIKey handler successfully verified the credentials. Need to break here so that the next handler can be called.
break;
} else {
// verification is not passed and an error is returned. need to bypass the next handler.
return;
}
}

}
Expand Down