Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gedaiu committed May 28, 2018
1 parent 7683840 commit 0ad7c46
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions source/vibeauth/router/oauth.d
Original file line number Diff line number Diff line change
Expand Up @@ -277,22 +277,11 @@ class OAuth2: BaseAuthRouter {
/// This handler is usefull when a route should return different data when the user is
/// logged in
void permisiveAuth(HTTPServerRequest req, HTTPServerResponse res) {
try {
setAccessControl(res);
if(req.method == HTTPMethod.OPTIONS) {
return;
}

if(!res.headerWritten && req.path != configuration.style && !isValidBearer(req)) {
respondUnauthorized(res);
}
} catch(Exception e) {
version(unittest) {} else debug stderr.writeln(e);

if(!res.headerWritten) {
res.writeJsonBody([ "error": e.msg ], 400);
}
if("Authorization" !in req.headers) {
return;
}

mandatoryAuth(req, res);
}
}

Expand Down

0 comments on commit 0ad7c46

Please sign in to comment.