MCPcopy Create free account
hub / github.com/avoidwork/tenso / basicAuthCheck

Function basicAuthCheck

benchmarks/auth.js:100–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99 // Mock the passport authentication function behavior
100 const basicAuthCheck = req => {
101 const auth = req.headers.authorization;
102 if (!auth || !auth.startsWith("Basic ")) return false;
103
104 const encoded = auth.slice(6);
105 const decoded = Buffer.from(encoded, "base64").toString();
106 const [username, password] = decoded.split(":");
107
108 const validUsers = { "user1": "password1", "user2": "password2", "admin": "secret123" };
109
110 return validUsers[username] === password;
111 };
112
113 suite
114 .add("Basic Auth - Valid credentials", () => {

Callers 1

benchmarkBasicAuthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected