Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b7887ec
prevent returning expired sessions
Huskydog9988 Dec 29, 2025
ba959a7
add issuer to ODIC creds
Huskydog9988 Dec 29, 2025
1b4c362
get id token in ODIC
Huskydog9988 Dec 30, 2025
54cdf28
make session signin return session
Huskydog9988 Dec 30, 2025
9e69ac8
working backchannel logout?
Huskydog9988 Jan 4, 2026
97e0d12
require https for ODIC provider
Huskydog9988 Jan 4, 2026
d7abc99
handle wellknown not being https
Huskydog9988 Jan 5, 2026
026dfe6
find session api progress
Huskydog9988 Jan 6, 2026
5573a12
fix windows build
Huskydog9988 Jan 6, 2026
a165088
return session token on session
Huskydog9988 Jan 8, 2026
82af507
switch OIDC to #searchSessions
Huskydog9988 Jan 8, 2026
5dfa254
update pnpm
Huskydog9988 Jan 8, 2026
b40eee2
switch to using message on error obj
Huskydog9988 Jan 10, 2026
94d9f1f
move odic callback
Huskydog9988 Jan 14, 2026
81c17e7
fix type errors
Huskydog9988 Jan 14, 2026
d1e682b
Merge remote-tracking branch 'upstream' into oidc-logout
Huskydog9988 Jan 14, 2026
063fe70
redirect old oidc callback
Huskydog9988 Jan 19, 2026
bd6c369
make redirect url a URL
Huskydog9988 Jan 19, 2026
c3f92a3
remove scheduled task downloadCleanup
Huskydog9988 Jan 19, 2026
ed9e95a
fix session search for oidc
Huskydog9988 Jan 19, 2026
2a10002
fix signin result
Huskydog9988 Jan 19, 2026
d0597ed
cleanup code
Huskydog9988 Jan 19, 2026
74dd169
Merge branch 'develop' into oidc-logout
Huskydog9988 Jan 19, 2026
0c72c4d
ignore data dir
Huskydog9988 Jan 19, 2026
731cede
fix lint error
Huskydog9988 Jan 19, 2026
6ad6402
Merge branch 'oidc-logout' of https://github.com/Huskydog9988/drop in…
Huskydog9988 Jan 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ drop-base/
pnpm-lock.yaml

torrential/
.data/**
**/.data/**
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// @ts-check
import { globalIgnores } from "eslint/config";
import withNuxt from "./.nuxt/eslint.config.mjs";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import vueI18n from "@intlify/eslint-plugin-vue-i18n";
import noPrismaDelete from "./rules/no-prisma-delete.mts";

export default withNuxt([
globalIgnores([".data/*"]),

eslintConfigPrettier,

// vue-i18n plugin
Expand Down
15 changes: 8 additions & 7 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import tailwindcss from "@tailwindcss/vite";
import { execSync } from "node:child_process";
import { readFileSync, existsSync } from "node:fs";
import path from "node:path";
import module from "module";
import module from "node:module";
import { fileURLToPath } from "node:url";
import { type } from "arktype";

const packageJsonSchema = type({
Expand Down Expand Up @@ -91,6 +92,11 @@ export default defineNuxtConfig({

routeRules: {
"/api/**": { cors: true },

// redirect old OIDC callback route
"/auth/callback/oidc": {
redirect: "/api/v1/auth/odic/callback",
},
},

nitro: {
Expand All @@ -116,7 +122,6 @@ export default defineNuxtConfig({

scheduledTasks: {
"0 * * * *": ["dailyTasks"],
"*/30 * * * *": ["downloadCleanup"],
},

storage: {
Expand Down Expand Up @@ -266,11 +271,7 @@ function getDropVersion(): string {
// example nightly: "v0.3.0-nightly.2025.05.28"
const defaultVersion = "v0.0.0-alpha.0";

// get path
const packageJsonPath = path.join(
path.dirname(import.meta.url.replace("file://", "")),
"package.json",
);
const packageJsonPath = fileURLToPath(import.meta.resolve("./package.json"));

if (!existsSync(packageJsonPath)) {
console.error("Could not find package.json, using default version.");
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"file-type-mime": "^0.4.3",
"jdenticon": "^3.3.0",
"kjua": "^0.10.0",
"jose": "^6.1.3",
"luxon": "^3.6.1",
"micromark": "^4.0.1",
"normalize-url": "^8.0.2",
Expand Down Expand Up @@ -93,5 +94,5 @@
"vue3-carousel": "^0.16.0"
}
},
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b"
"packageManager": "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a"
}
11 changes: 8 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ onlyBuiltDependencies:
- sharp
- unrs-resolver

overrides:
droplet: link:../../.local/share/pnpm/global/5/node_modules/@drop-oss/droplet
# overrides:
# droplet: link:../../.local/share/pnpm/global/5/node_modules/@drop-oss/droplet

shamefullyHoist: true
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import sessionHandler from "~/server/internal/session";
import authManager from "~/server/internal/auth";
import type { Session } from "~/server/internal/session/types";

defineRouteMeta({
openAPI: {
tags: ["Auth"],
tags: ["Auth", "OIDC"],
description: "OIDC Signin callback",
parameters: [],
},
});

export default defineEventHandler(async (h3) => {
// dont cache login responses
setHeader(h3, "Cache-Control", "no-store");

const enabledAuthManagers = authManager.getAuthProviders();
if (!enabledAuthManagers.OpenID) return sendRedirect(h3, "/auth/signin");

Expand Down Expand Up @@ -38,11 +42,20 @@ export default defineEventHandler(async (h3) => {
statusMessage: `Failed to sign in: "${result}". Please try again.`,
});

const sessionResult = await sessionHandler.signin(h3, result.user.id, true);
// Attach OIDC session data
const oidcData: Session["oidc"] = {
iss: result.claims.iss,
};
if (result.claims.sub) oidcData.sub = result.claims.sub;
if (result.claims.sid) oidcData.sid = result.claims.sid;

const sessionResult = await sessionHandler.signin(h3, result.user.id, {
rememberMe: true,
oidc: oidcData,
});
if (sessionResult == "fail")
throw createError({ statusCode: 500, message: "Failed to set session" });

if (sessionResult == "2fa") {
else if (sessionResult == "2fa") {
return sendRedirect(
h3,
`/auth/mfa?redirect=${result.options.redirect ? encodeURIComponent(result.options.redirect) : "/"}`,
Expand Down
46 changes: 46 additions & 0 deletions server/api/v1/auth/odic/logout.post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// import sessionHandler from "~/server/internal/session";
import authManager from "~/server/internal/auth";

defineRouteMeta({
openAPI: {
tags: ["Auth", "OIDC"],
description: "OIDC logout back-channel",
parameters: [],
},
});

export default defineEventHandler(async (h3) => {
// dont cache logout responses
setHeader(h3, "Cache-Control", "no-store");

const enabledAuthManagers = authManager.getAuthProviders();
if (!enabledAuthManagers.OpenID)
throw createError({
statusCode: 400,
message: "OIDC not enabled.",
});

const logout_token = (await readFormData(h3)).get("logout_token");
if (typeof logout_token !== "string")
throw createError({
statusCode: 400,
message: "Invalid OIDC logout notification.",
});
const okay = await enabledAuthManagers.OpenID.handleLogout(logout_token);
if (!okay) {
throw createError({
statusCode: 400,
message: "Invalid OIDC logout notification.",
});
}

// const result = OIDCLogoutTokenV1(logout_token);

// const manager = enabledAuthManagers.OpenID;

// const query = getQuery(h3);

return {
success: true,
};
});
4 changes: 3 additions & 1 deletion server/api/v1/auth/passkey/finish.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ export default defineEventHandler(async (h3) => {
},
});

await sessionHandler.signin(h3, mfaMec.userId, true);
await sessionHandler.signin(h3, mfaMec.userId, {
rememberMe: true,
});
await sessionHandler.mfa(h3, 10);

return {};
Expand Down
19 changes: 8 additions & 11 deletions server/api/v1/auth/signin/simple.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ export default defineEventHandler<{
});

// TODO: send user to forgot password screen or something to force them to change their password to new system
const result = await sessionHandler.signin(
h3,
authMek.userId,
body.rememberMe,
);
const result = await sessionHandler.signin(h3, authMek.userId, {
rememberMe: body.rememberMe ?? false,
});
if (result === "fail")
throw createError({
statusCode: 500,
message: "Failed to create session",
});
return { userId: authMek.userId, result };

return { result: result, userId: authMek.userId };
}

// V2: argon2
Expand All @@ -111,11 +110,9 @@ export default defineEventHandler<{
statusMessage: t("errors.auth.invalidUserOrPass"),
});

const result = await sessionHandler.signin(
h3,
authMek.userId,
body.rememberMe,
);
const result = await sessionHandler.signin(h3, authMek.userId, {
rememberMe: body.rememberMe ?? false,
});
if (result == "fail")
throw createError({ statusCode: 500, message: "Failed to create session" });
return { userId: authMek.userId, result };
Expand Down
2 changes: 1 addition & 1 deletion server/internal/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AuthManager {
private initFuncs: {
[K in keyof typeof this.authProviders]: () => Promise<unknown>;
} = {
[AuthMec.OpenID]: OIDCManager.prototype.create,
[AuthMec.OpenID]: OIDCManager.create,
[AuthMec.Simple]: async () => {
const disabled = process.env.DISABLE_SIMPLE_AUTH as string | undefined;
return !disabled;
Expand Down
Loading
Loading