Updated handy-httpd v8.0.0
This commit is contained in:
parent
1325916931
commit
09ed06b8e5
|
@ -7,7 +7,7 @@
|
||||||
"botan": "~>1.13.5",
|
"botan": "~>1.13.5",
|
||||||
"d-properties": "~>1.0.5",
|
"d-properties": "~>1.0.5",
|
||||||
"d2sqlite3": "~>1.0.0",
|
"d2sqlite3": "~>1.0.0",
|
||||||
"handy-httpd": "~>7.13.0",
|
"handy-httpd": "~>8.0.0",
|
||||||
"jwt": "~>0.4.0",
|
"jwt": "~>0.4.0",
|
||||||
"resusage": "~>0.3.2",
|
"resusage": "~>0.3.2",
|
||||||
"slf4d": "~>2.4.3"
|
"slf4d": "~>2.4.3"
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
"botan-math": "1.0.4",
|
"botan-math": "1.0.4",
|
||||||
"d-properties": "1.0.5",
|
"d-properties": "1.0.5",
|
||||||
"d2sqlite3": "1.0.0",
|
"d2sqlite3": "1.0.0",
|
||||||
"handy-httpd": "7.13.0",
|
"handy-httpd": "8.0.0",
|
||||||
"httparsed": "1.2.1",
|
"httparsed": "1.2.1",
|
||||||
"jwt": "0.4.0",
|
"jwt": "0.4.0",
|
||||||
"memutils": "1.0.9",
|
"memutils": "1.0.10",
|
||||||
"path-matcher": "1.1.3",
|
"path-matcher": "1.1.3",
|
||||||
"resusage": "0.3.2",
|
"resusage": "0.3.2",
|
||||||
"slf4d": "2.4.3",
|
"slf4d": "2.4.3",
|
||||||
|
|
|
@ -75,12 +75,12 @@ Nullable!AuthContext validateAuthenticatedRequest(ref HttpRequestContext ctx, in
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
|
|
||||||
immutable HEADER_NAME = "Authorization";
|
immutable HEADER_NAME = "Authorization";
|
||||||
if (!ctx.request.hasHeader(HEADER_NAME)) {
|
if (!ctx.request.headers.contains(HEADER_NAME)) {
|
||||||
ctx.response.setStatus(HttpStatus.UNAUTHORIZED);
|
ctx.response.setStatus(HttpStatus.UNAUTHORIZED);
|
||||||
ctx.response.writeBodyString("Missing Authorization header.");
|
ctx.response.writeBodyString("Missing Authorization header.");
|
||||||
return Nullable!AuthContext.init;
|
return Nullable!AuthContext.init;
|
||||||
}
|
}
|
||||||
string authHeader = ctx.request.getHeader(HEADER_NAME);
|
string authHeader = ctx.request.headers.getFirst(HEADER_NAME).orElse("");
|
||||||
if (authHeader.length < 7 || authHeader[0 .. 7] != "Bearer ") {
|
if (authHeader.length < 7 || authHeader[0 .. 7] != "Bearer ") {
|
||||||
ctx.response.setStatus(HttpStatus.UNAUTHORIZED);
|
ctx.response.setStatus(HttpStatus.UNAUTHORIZED);
|
||||||
ctx.response.writeBodyString("Invalid bearer token authorization header.");
|
ctx.response.writeBodyString("Invalid bearer token authorization header.");
|
||||||
|
|
Loading…
Reference in New Issue