Compare commits
1 Commits
main
...
a6200605f8
| Author | SHA1 | Date | |
|---|---|---|---|
| a6200605f8 |
@ -9,8 +9,8 @@ export const getOauthProvidersController = (ctx: Context) => {
|
|||||||
return returnReadResponse(
|
return returnReadResponse(
|
||||||
ctx.set,
|
ctx.set,
|
||||||
200,
|
200,
|
||||||
"Getting all oauth available list",
|
"Successfully retrieved the list of oauth providers",
|
||||||
oauthProviderServices
|
oauthProviderServices,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return mainErrorHandler(ctx.set, error);
|
return mainErrorHandler(ctx.set, error);
|
||||||
|
|||||||
@ -8,10 +8,11 @@ import { getCallbackProviderUrlController } from "./controllers/getCallbackProvi
|
|||||||
import { tokenValidationController } from "./controllers/tokenValidation.controller";
|
import { tokenValidationController } from "./controllers/tokenValidation.controller";
|
||||||
import { logoutController } from "./controllers/logout.controller";
|
import { logoutController } from "./controllers/logout.controller";
|
||||||
import { tokenValidationSchema } from "./schemas/tokenValidation.schema";
|
import { tokenValidationSchema } from "./schemas/tokenValidation.schema";
|
||||||
|
import { getOauthProvidersSchema } from "./schemas/getOauthProviders.schema";
|
||||||
|
|
||||||
export const authModule = new Elysia({ prefix: "/auth", tags: ["Authentication"] })
|
export const authModule = new Elysia({ prefix: "/auth", tags: ["Authentication"] })
|
||||||
.post("/token/validate", tokenValidationController, tokenValidationSchema)
|
.post("/token/validate", tokenValidationController, tokenValidationSchema)
|
||||||
.get("/providers", getOauthProvidersController)
|
.get("/providers", getOauthProvidersController, getOauthProvidersSchema)
|
||||||
.get("/providers/:name/callback", getCallbackProviderUrlController)
|
.get("/providers/:name/callback", getCallbackProviderUrlController)
|
||||||
.get("/github", githubRequestController)
|
.get("/github", githubRequestController)
|
||||||
.get("/github/callback", githubCallbackController)
|
.get("/github/callback", githubCallbackController)
|
||||||
|
|||||||
56
src/modules/auth/schemas/getOauthProviders.schema.ts
Normal file
56
src/modules/auth/schemas/getOauthProviders.schema.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import { success } from "zod";
|
||||||
|
import { AppRouteSchema } from "../../../helpers/types/AppRouteSchema";
|
||||||
|
|
||||||
|
export const getOauthProvidersSchema = {
|
||||||
|
detail: {
|
||||||
|
summary: "Get all available oauth providers",
|
||||||
|
description:
|
||||||
|
"This endpoint returns a list of all available and active oauth providers that can be used for authentication.",
|
||||||
|
responses: {
|
||||||
|
200: {
|
||||||
|
description: "Successfully retrieved the list of oauth providers",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
success: {
|
||||||
|
type: "boolean",
|
||||||
|
example: true,
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
type: "number",
|
||||||
|
example: 200,
|
||||||
|
},
|
||||||
|
message: {
|
||||||
|
type: "string",
|
||||||
|
example: "Successfully retrieved the list of oauth providers",
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: "array",
|
||||||
|
items: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: "string",
|
||||||
|
example: "google",
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: "string",
|
||||||
|
example: "logos:google-icon",
|
||||||
|
},
|
||||||
|
req_endpoint: {
|
||||||
|
type: "string",
|
||||||
|
example: "auth/google",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} satisfies AppRouteSchema;
|
||||||
Reference in New Issue
Block a user