allow autorization via body only

This commit is contained in:
2021-01-12 21:19:56 +01:00
parent c5bc0855d7
commit e6039e78b1
3 changed files with 45 additions and 8 deletions

@ -188,10 +188,8 @@ export default function create_auth_handler (
const token = (/(?<type>\S+) (?<token>.+)/ui)
.exec (req.headers.authorization as string);
if (token === null) {
request.invalid ('missing authorization header');
return Promise.resolve ();
}
if (token === null)
return default_handler (request);
if ((/Basic/ui).test (token?.groups?.type as string)) {
request.is_basic = true;

@ -28,13 +28,14 @@ import create_gateway, {
Gateway,
AnyFunc
} from './Gateway';
import { KeyStore, KeyStoreData } from './KeyStore';
import keystore, { KeyStore, KeyStoreData } from './KeyStore';
export {
create_gateway,
create_auth_handler,
blacklist,
authority,
keystore,
AccessResponse,
CreateHandlerOptions,