MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / resolveCookieDomain

Function resolveCookieDomain

lib/auth.ts:55–67  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

53}
54
55export async function resolveCookieDomain(request: Request) {
56 const config = await AppConfig.getConfig();
57 const baseUrl = config.auth.baseUrl;
58
59 if (!isUrlAnIp(baseUrl) || isRunningLocally(request)) {
60 const domain = new URL(request.url).hostname;
61 if (await AppConfig.isCookieDomainAllowed(domain)) {
62 return domain;
63 }
64 return baseUrl.replace('https://', '').replace('http://', '').split(':')[0];
65 }
66 return '';
67}
68
69export async function getDataFromRequest(
70 request: Request,

Callers 4

createSessionCookieMethod · 0.90
createSessionCookieMethod · 0.90
logoutUserFunction · 0.85
createSessionCookieFunction · 0.85

Calls 4

isRunningLocallyFunction · 0.90
isUrlAnIpFunction · 0.85
getConfigMethod · 0.80
isCookieDomainAllowedMethod · 0.80

Tested by

no test coverage detected