mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
Basic Auth now accepts Authorization header
This commit is contained in:
parent
d0c59ab008
commit
5a942869a9
1 changed files with 8 additions and 2 deletions
|
@ -170,10 +170,16 @@ pub fn BasicAuth(comptime Lookup: type, comptime kind: BasicAuthStrategy) type {
|
|||
pub fn authenticateRequest(self: *Self, r: *const zap.SimpleRequest) bool {
|
||||
zap.debug("AUTHENTICATE REQUEST\n", .{});
|
||||
if (extractAuthHeader(.Basic, r)) |auth_header| {
|
||||
zap.debug("Auth Header found!\n", .{});
|
||||
zap.debug("Authentication Header found!\n", .{});
|
||||
return self.authenticate(auth_header);
|
||||
} else {
|
||||
// try with .Authorization
|
||||
if (extractAuthHeader(.Bearer, r)) |auth_header| {
|
||||
zap.debug("Authorization Header found!\n", .{});
|
||||
return self.authenticate(auth_header);
|
||||
}
|
||||
zap.debug("NO Auth Header found!\n", .{});
|
||||
}
|
||||
zap.debug("NO fitting Auth Header found!\n", .{});
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue