@aptly-as/app-koa
Advanced tools
Comparing version 0.1.2 to 0.1.3
export async function authorize(ctx, next) { | ||
const token = ctx.cookies.get(ctx.aptly.tokenCookie.name, { signed: true }); | ||
let organization = ctx.cookies.get(ctx.aptly.organizationCookie.name) || | ||
ctx.request.query.organization; | ||
const queryOrganization = ctx.request.query.organization; | ||
const cookieOrganization = ctx.cookies.get(ctx.aptly.organizationCookie.name); | ||
let organization = cookieOrganization || queryOrganization; | ||
if (!token && !organization) { | ||
@@ -10,2 +11,8 @@ ctx.status = 401; | ||
} | ||
if (cookieOrganization && | ||
queryOrganization && | ||
cookieOrganization !== queryOrganization) { | ||
ctx.cookies.set(ctx.aptly.organizationCookie.name, ''); | ||
return ctx.redirect(ctx.aptly.auth.getAuthorizeRedirect(String(queryOrganization), ctx.request.path)); | ||
} | ||
try { | ||
@@ -12,0 +19,0 @@ if (!token) { |
{ | ||
"name": "@aptly-as/app-koa", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Template for NodeJS Typescript", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44611
166