57 basic auth dev only (#58)

This commit is contained in:
Anders Gustafsson
2021-09-29 10:43:51 +02:00
committed by GitHub
parent e5aa1486e3
commit a270d0d523
4 changed files with 8 additions and 3 deletions
-1
View File
@@ -107,7 +107,6 @@ const verifyToken = async (
request: ClaimVerifyRequest,
): Promise<ClaimVerifyResult> => {
try {
// console.log(`user claim verify invoked for ${JSON.stringify(request)}`);
const token = request.token;
const tokenSections = (token || '').split('.');
if (tokenSections.length < 2) {
+4 -2
View File
@@ -59,8 +59,10 @@ const context = async ({ req }) => {
const token = authHeader.substring(7, authHeader.length);
const res = await verifyToken({ token });
return { auth: res };
} else if (authHeader == 'Basic ZGV2OmRldg==') {
// dev:dev remove later
} else if (
process.env.NODE_ENV === 'development' &&
authHeader == 'Basic ZGV2OnB2N1VmYSFiZVAzeGk='
) {
return { auth: 'during development' };
}
throw new AuthenticationError('Not authorized');