Skip to content

Commit

Permalink
Merge pull request #1149 from sesamyab/ma/migrate-auth-routes
Browse files Browse the repository at this point in the history
fix: migrate more auth routes
  • Loading branch information
markusahlstrand authored Dec 11, 2024
2 parents 8c34ebd + dad60cf commit 5289598
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 430 deletions.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@peculiar/x509": "^1.12.3",
"@planetscale/database": "1.19.0",
"arctic": "^2.3.0",
"authhero": "^0.20.2",
"authhero": "^0.21.0",
"bcryptjs": "^2.4.3",
"fast-xml-parser": "^4.5.0",
"hono": "4.4.0",
Expand All @@ -64,12 +64,9 @@
"kysely-bun-sqlite": "^0.3.2",
"kysely-planetscale": "^1.5.0",
"liquidjs": "^10.19.0",
"lru-cache": "^11.0.2",
"nanoid": "5.0.9",
"oslo": "^1.2.1",
"playwright": "1.44.1",
"xml-crypto": "^6.0.0",
"xmldsigjs": "^2.6.1",
"zod": "3.23.8"
},
"devDependencies": {
Expand Down
27 changes: 13 additions & 14 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
export const JWKS_CACHE_TIMEOUT_IN_SECONDS = 60 * 5; // 5 minutes
export const ACCESS_TOKEN_EXPIRE_IN_SECONDS = 60 * 60 * 24; // 24 hours
export const MONTH_IN_SECONDS = 30 * 24 * 60 * 60;

export const headers = {
accessControlAllowHeaders: "Access-Control-Allow-Headers",
accessControlAllowOrigin: "Access-Control-Allow-Origin",
accessControlAllowMethod: "Access-Control-Allow-Methods",
accessControlAllowCredentials: "Access-Control-Allow-Credentials",
accessControlExposeHeaders: "Access-Control-Expose-Headers",
cacheControl: "cache-control",
contentType: "content-type",
contentRange: "content-range",
location: "location",
setCookie: "set-cookie",
tenantId: "tenant-id",
};
// export const headers = {
// accessControlAllowHeaders: "Access-Control-Allow-Headers",
// accessControlAllowOrigin: "Access-Control-Allow-Origin",
// accessControlAllowMethod: "Access-Control-Allow-Methods",
// accessControlAllowCredentials: "Access-Control-Allow-Credentials",
// accessControlExposeHeaders: "Access-Control-Expose-Headers",
// cacheControl: "cache-control",
// contentType: "content-type",
// contentRange: "content-range",
// location: "location",
// setCookie: "set-cookie",
// tenantId: "tenant-id",
// };

export const UNIVERSAL_AUTH_SESSION_EXPIRES_IN_SECONDS = 60 * 60 * 24; // 1 day
export const OAUTH2_CODE_EXPIRES_IN_SECONDS = 5 * 60; // 5 minutes
Expand Down
10 changes: 1 addition & 9 deletions src/oauth-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ import { Env, Var } from "./types";
import { addDataHooks } from "./hooks";
import { CreateAuthParams } from "./app";
import { loginRoutes } from "./routes/universal-login/routes";
// import { wellKnownRoutes } from "./routes/oauth2/well-known";
import { authorizeRoutes } from "./routes/oauth2/authorize";
import { callbackRoutes } from "./routes/oauth2/callback";
import { userinfoRoutes } from "./routes/oauth2/userinfo";
// import { tokenRoutes } from "./routes/oauth2/token";
import { dbConnectionRoutes } from "./routes/oauth2/dbconnections";
import { passwordlessRoutes } from "./routes/oauth2/passwordless";
import { authenticateRoutes } from "./routes/oauth2/authenticate";
import { logoutRoutes } from "./routes/oauth2/logout";

export default function create(params: CreateAuthParams) {
const app = new OpenAPIHono<{ Bindings: Env; Variables: Var }>();
Expand All @@ -23,15 +19,11 @@ export default function create(params: CreateAuthParams) {

const oauthApp = app
.route("/u", loginRoutes)
// .route("/.well-known", wellKnownRoutes)
.route("/authorize", authorizeRoutes)
.route("/callback", callbackRoutes)
.route("/userinfo", userinfoRoutes)
// .route("/oauth/token", tokenRoutes)
.route("/dbconnections", dbConnectionRoutes)
.route("/passwordless", passwordlessRoutes)
.route("/co/authenticate", authenticateRoutes)
.route("/v2/logout", logoutRoutes);
.route("/co/authenticate", authenticateRoutes);

oauthApp.doc("/spec", {
openapi: "3.0.0",
Expand Down
88 changes: 0 additions & 88 deletions src/routes/oauth2/logout.ts

This file was deleted.

54 changes: 0 additions & 54 deletions src/routes/oauth2/userinfo.ts

This file was deleted.

116 changes: 0 additions & 116 deletions test/integration/flows/logout.spec.ts

This file was deleted.

Loading

0 comments on commit 5289598

Please sign in to comment.