dn-react-router-toolkit 0.1.12 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/apple_auth.d.mts +38 -0
- package/dist/auth/apple_auth.d.ts +38 -0
- package/dist/{auth-kit → auth}/apple_auth.js +31 -18
- package/dist/auth/apple_auth.mjs +63 -0
- package/dist/{auth-kit/repository.d.mts → auth/auth_repository.d.mts} +10 -11
- package/dist/{auth-kit/repository.d.ts → auth/auth_repository.d.ts} +10 -11
- package/dist/{file-kit/repository.js → auth/auth_repository.js} +3 -3
- package/dist/{auth-kit → auth}/auth_service.d.mts +12 -23
- package/dist/{auth-kit → auth}/auth_service.d.ts +12 -23
- package/dist/{auth-kit → auth}/auth_service.js +24 -77
- package/dist/{auth-kit → auth}/auth_service.mjs +24 -77
- package/dist/auth/client/google_login_button.d.mts +7 -0
- package/dist/auth/client/google_login_button.d.ts +7 -0
- package/dist/{auth-kit → auth}/client/google_login_button.js +24 -19
- package/dist/auth/client/google_login_button.mjs +37 -0
- package/dist/auth/client/provider.d.mts +26 -0
- package/dist/auth/client/provider.d.ts +26 -0
- package/dist/auth/client/provider.js +152 -0
- package/dist/auth/client/provider.mjs +116 -0
- package/dist/{auth-kit → auth}/client/redirect_page.js +1 -1
- package/dist/{auth-kit → auth}/client/redirect_page.mjs +1 -1
- package/dist/auth/google_auth.d.mts +33 -0
- package/dist/auth/google_auth.d.ts +33 -0
- package/dist/{auth-kit → auth}/google_auth.js +23 -32
- package/dist/{auth-kit → auth}/google_auth.mjs +22 -31
- package/dist/auth/handlers/find_auth.d.mts +13 -0
- package/dist/auth/handlers/find_auth.d.ts +13 -0
- package/dist/{route/api/auth/route.js → auth/handlers/find_auth.js} +10 -10
- package/dist/{route/api/auth/route.mjs → auth/handlers/find_auth.mjs} +5 -5
- package/dist/auth/handlers/login.d.mts +13 -0
- package/dist/auth/handlers/login.d.ts +13 -0
- package/dist/{route/api/auth/login/route.js → auth/handlers/login.js} +17 -17
- package/dist/{route/api/auth/login/route.mjs → auth/handlers/login.mjs} +12 -12
- package/dist/auth/handlers/login_with_thirdparty.d.mts +15 -0
- package/dist/auth/handlers/login_with_thirdparty.d.ts +15 -0
- package/dist/{route/api/auth/login/[provider]/route.js → auth/handlers/login_with_thirdparty.js} +12 -27
- package/dist/{route/api/auth/login/[provider]/route.mjs → auth/handlers/login_with_thirdparty.mjs} +7 -22
- package/dist/auth/handlers/logout.d.mts +13 -0
- package/dist/auth/handlers/logout.d.ts +13 -0
- package/dist/{route/api/auth/logout/route.js → auth/handlers/logout.js} +15 -11
- package/dist/{route/api/auth/logout/route.mjs → auth/handlers/logout.mjs} +11 -7
- package/dist/auth/handlers/refresh.d.mts +13 -0
- package/dist/auth/handlers/refresh.d.ts +13 -0
- package/dist/{route/api/auth/refresh/route.js → auth/handlers/refresh.js} +12 -12
- package/dist/{route/api/auth/refresh/route.mjs → auth/handlers/refresh.mjs} +7 -7
- package/dist/auth/handlers/request_password_reset.d.mts +10 -0
- package/dist/auth/handlers/request_password_reset.d.ts +10 -0
- package/dist/auth/handlers/request_password_reset.js +87 -0
- package/dist/auth/handlers/request_password_reset.mjs +60 -0
- package/dist/auth/handlers/reset_password.d.mts +10 -0
- package/dist/auth/handlers/reset_password.d.ts +10 -0
- package/dist/auth/handlers/reset_password.js +88 -0
- package/dist/auth/handlers/reset_password.mjs +61 -0
- package/dist/auth/handlers/signup.d.mts +15 -0
- package/dist/auth/handlers/signup.d.ts +15 -0
- package/dist/auth/handlers/signup.js +147 -0
- package/dist/auth/handlers/signup.mjs +112 -0
- package/dist/auth/handlers/signup_with_thirdparty.d.mts +17 -0
- package/dist/auth/handlers/signup_with_thirdparty.d.ts +17 -0
- package/dist/auth/handlers/signup_with_thirdparty.js +123 -0
- package/dist/auth/handlers/signup_with_thirdparty.mjs +98 -0
- package/dist/auth/handlers/thirdparty_auth_callback.d.mts +16 -0
- package/dist/auth/handlers/thirdparty_auth_callback.d.ts +16 -0
- package/dist/{route/auth/callback/[provider]/route.js → auth/handlers/thirdparty_auth_callback.js} +54 -45
- package/dist/{route/auth/callback/[provider]/route.mjs → auth/handlers/thirdparty_auth_callback.mjs} +49 -40
- package/dist/{auth-kit/jwt.d.mts → auth/jwt_manager.d.mts} +11 -1
- package/dist/{auth-kit/jwt.d.ts → auth/jwt_manager.d.ts} +11 -1
- package/dist/{auth-kit/jwt.js → auth/jwt_manager.js} +25 -11
- package/dist/{auth-kit/jwt.mjs → auth/jwt_manager.mjs} +22 -8
- package/dist/auth/kakao_auth.d.mts +27 -0
- package/dist/auth/kakao_auth.d.ts +27 -0
- package/dist/auth/kakao_auth.js +56 -0
- package/dist/auth/kakao_auth.mjs +31 -0
- package/dist/auth/password_recovery.d.mts +34 -0
- package/dist/auth/password_recovery.d.ts +34 -0
- package/dist/auth/password_recovery.js +169 -0
- package/dist/auth/password_recovery.mjs +134 -0
- package/dist/auth/thirdparty_auth.d.mts +41 -0
- package/dist/auth/thirdparty_auth.d.ts +41 -0
- package/dist/{auth-kit/kakao_auth.js → auth/thirdparty_auth.js} +31 -33
- package/dist/{auth-kit/kakao_auth.mjs → auth/thirdparty_auth.mjs} +26 -28
- package/dist/{auth-kit → auth}/with_auth.d.mts +5 -6
- package/dist/{auth-kit → auth}/with_auth.d.ts +5 -6
- package/dist/{auth-kit → auth}/with_auth.js +26 -10
- package/dist/auth/with_auth.mjs +63 -0
- package/dist/date.d.mts +2 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +4 -2
- package/dist/date.mjs +2 -1
- package/dist/{file-kit → file}/cdn.js +1 -1
- package/dist/{file-kit → file}/cdn.mjs +1 -1
- package/dist/{file-kit → file}/client/drop_file_input.js +3 -3
- package/dist/{file-kit → file}/client/drop_file_input.mjs +3 -3
- package/dist/{file-kit → file}/client/file_upload_button.js +1 -1
- package/dist/{file-kit → file}/client/file_upload_button.mjs +1 -1
- package/dist/{file-kit → file}/client/file_uploader.js +3 -3
- package/dist/{file-kit → file}/client/file_uploader.mjs +2 -2
- package/dist/{file-kit → file}/client/format_size.js +1 -1
- package/dist/{file-kit → file}/client/format_size.mjs +1 -1
- package/dist/{file-kit → file}/client/metadata.js +1 -1
- package/dist/{file-kit → file}/client/metadata.mjs +1 -1
- package/dist/{file-kit/repository.d.mts → file/file_repository.d.mts} +4 -4
- package/dist/{file-kit/repository.d.ts → file/file_repository.d.ts} +4 -4
- package/dist/{auth-kit/repository.js → file/file_repository.js} +3 -3
- package/dist/file/file_service.d.mts +32 -0
- package/dist/file/file_service.d.ts +32 -0
- package/dist/{file-kit → file}/file_service.js +27 -21
- package/dist/file/file_service.mjs +41 -0
- package/dist/file/handlers/delete_file.d.mts +17 -0
- package/dist/file/handlers/delete_file.d.ts +17 -0
- package/dist/{route/api/files/[fileId]/route.js → file/handlers/delete_file.js} +15 -15
- package/dist/{route/api/files/[fileId]/route.mjs → file/handlers/delete_file.mjs} +10 -10
- package/dist/file/handlers/upload_file.d.mts +16 -0
- package/dist/file/handlers/upload_file.d.ts +16 -0
- package/dist/{route/api/files/route.js → file/handlers/upload_file.js} +13 -13
- package/dist/{route/api/files/route.mjs → file/handlers/upload_file.mjs} +8 -8
- package/dist/{file-kit → file}/object_storage.d.mts +3 -1
- package/dist/{file-kit → file}/object_storage.d.ts +3 -1
- package/dist/{file-kit → file}/object_storage.js +2 -2
- package/dist/{file-kit → file}/object_storage.mjs +2 -2
- package/dist/{file-kit → file}/responsive_image.d.mts +4 -4
- package/dist/{file-kit → file}/responsive_image.d.ts +4 -4
- package/dist/{file-kit → file}/responsive_image.js +18 -9
- package/dist/{file-kit → file}/responsive_image.mjs +18 -9
- package/dist/{http-kit → http}/index.js +5 -5
- package/dist/{http-kit → http}/index.mjs +1 -1
- package/dist/{http-kit → http}/response.js +1 -1
- package/dist/{http-kit → http}/response.mjs +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +1 -0
- package/dist/route/api.d.mts +17 -25
- package/dist/route/api.d.ts +17 -25
- package/dist/route/api.js +367 -178
- package/dist/route/api.mjs +356 -177
- package/dist/{seo-kit → seo}/seo.js +1 -1
- package/dist/{seo-kit → seo}/seo.mjs +1 -1
- package/package.json +76 -74
- package/dist/auth-kit/apple_auth.d.mts +0 -24
- package/dist/auth-kit/apple_auth.d.ts +0 -24
- package/dist/auth-kit/apple_auth.mjs +0 -50
- package/dist/auth-kit/client/google_login_button.d.mts +0 -9
- package/dist/auth-kit/client/google_login_button.d.ts +0 -9
- package/dist/auth-kit/client/google_login_button.mjs +0 -32
- package/dist/auth-kit/client/logout.d.mts +0 -3
- package/dist/auth-kit/client/logout.d.ts +0 -3
- package/dist/auth-kit/client/logout.js +0 -49
- package/dist/auth-kit/client/logout.mjs +0 -24
- package/dist/auth-kit/google_auth.d.mts +0 -27
- package/dist/auth-kit/google_auth.d.ts +0 -27
- package/dist/auth-kit/kakao_auth.d.mts +0 -24
- package/dist/auth-kit/kakao_auth.d.ts +0 -24
- package/dist/auth-kit/with_auth.mjs +0 -47
- package/dist/file-kit/file_service.d.mts +0 -26
- package/dist/file-kit/file_service.d.ts +0 -26
- package/dist/file-kit/file_service.mjs +0 -35
- package/dist/route/api/auth/login/_provider_/route.d.mts +0 -20
- package/dist/route/api/auth/login/_provider_/route.d.ts +0 -20
- package/dist/route/api/auth/login/route.d.mts +0 -14
- package/dist/route/api/auth/login/route.d.ts +0 -14
- package/dist/route/api/auth/logout/route.d.mts +0 -14
- package/dist/route/api/auth/logout/route.d.ts +0 -14
- package/dist/route/api/auth/refresh/route.d.mts +0 -13
- package/dist/route/api/auth/refresh/route.d.ts +0 -13
- package/dist/route/api/auth/route.d.mts +0 -13
- package/dist/route/api/auth/route.d.ts +0 -13
- package/dist/route/api/files/_fileId_/route.d.mts +0 -17
- package/dist/route/api/files/_fileId_/route.d.ts +0 -17
- package/dist/route/api/files/route.d.mts +0 -16
- package/dist/route/api/files/route.d.ts +0 -16
- package/dist/route/auth/callback/_provider_/route.d.mts +0 -20
- package/dist/route/auth/callback/_provider_/route.d.ts +0 -20
- /package/dist/{auth-kit/repository.mjs → auth/auth_repository.mjs} +0 -0
- /package/dist/{auth-kit → auth}/client/redirect_page.d.mts +0 -0
- /package/dist/{auth-kit → auth}/client/redirect_page.d.ts +0 -0
- /package/dist/{file-kit → file}/cdn.d.mts +0 -0
- /package/dist/{file-kit → file}/cdn.d.ts +0 -0
- /package/dist/{file-kit → file}/client/drop_file_input.d.mts +0 -0
- /package/dist/{file-kit → file}/client/drop_file_input.d.ts +0 -0
- /package/dist/{file-kit → file}/client/file_upload_button.d.mts +0 -0
- /package/dist/{file-kit → file}/client/file_upload_button.d.ts +0 -0
- /package/dist/{file-kit → file}/client/file_uploader.d.mts +0 -0
- /package/dist/{file-kit → file}/client/file_uploader.d.ts +0 -0
- /package/dist/{file-kit → file}/client/format_size.d.mts +0 -0
- /package/dist/{file-kit → file}/client/format_size.d.ts +0 -0
- /package/dist/{file-kit → file}/client/metadata.d.mts +0 -0
- /package/dist/{file-kit → file}/client/metadata.d.ts +0 -0
- /package/dist/{file-kit/repository.mjs → file/file_repository.mjs} +0 -0
- /package/dist/{http-kit → http}/index.d.mts +0 -0
- /package/dist/{http-kit → http}/index.d.ts +0 -0
- /package/dist/{http-kit → http}/response.d.mts +0 -0
- /package/dist/{http-kit → http}/response.d.ts +0 -0
- /package/dist/{seo-kit → seo}/seo.d.mts +0 -0
- /package/dist/{seo-kit → seo}/seo.d.ts +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ThirdpartyAuth, ThirdpartyAuthService } from './thirdparty_auth.js';
|
|
2
|
+
import './auth_service.js';
|
|
3
|
+
import 'jose';
|
|
4
|
+
import 'react-router';
|
|
5
|
+
import './jwt_manager.js';
|
|
6
|
+
import '../file/object_storage.js';
|
|
7
|
+
import '@aws-sdk/client-s3';
|
|
8
|
+
import './auth_repository.js';
|
|
9
|
+
|
|
10
|
+
declare class GoogleAuth implements ThirdpartyAuth {
|
|
11
|
+
thirdpartyAuth: ThirdpartyAuthService;
|
|
12
|
+
googleClientId: string;
|
|
13
|
+
googleClientSecret: string;
|
|
14
|
+
googleRedirectUri: string;
|
|
15
|
+
constructor({ thirdpartyAuth, googleClientId, googleClientSecret, googleRedirectUri, }: {
|
|
16
|
+
thirdpartyAuth: ThirdpartyAuthService;
|
|
17
|
+
googleClientId: string;
|
|
18
|
+
googleClientSecret: string;
|
|
19
|
+
googleRedirectUri: string;
|
|
20
|
+
});
|
|
21
|
+
login(code: string): Promise<{
|
|
22
|
+
user: {
|
|
23
|
+
id: string;
|
|
24
|
+
role: string;
|
|
25
|
+
name: string;
|
|
26
|
+
refreshToken: string | null;
|
|
27
|
+
};
|
|
28
|
+
accessToken: string;
|
|
29
|
+
refreshToken: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { GoogleAuth };
|
|
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/auth
|
|
20
|
+
// src/auth/google_auth.tsx
|
|
21
21
|
var google_auth_exports = {};
|
|
22
22
|
__export(google_auth_exports, {
|
|
23
23
|
GoogleAuth: () => GoogleAuth
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(google_auth_exports);
|
|
26
26
|
|
|
27
|
-
// src/http
|
|
27
|
+
// src/http/response.ts
|
|
28
28
|
var createJsonResponse = (status) => {
|
|
29
29
|
return (data = {}, init) => {
|
|
30
30
|
return Response.json(data, { status, ...init });
|
|
@@ -68,19 +68,24 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
68
68
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
// src/auth
|
|
71
|
+
// src/auth/google_auth.tsx
|
|
72
72
|
var GoogleAuth = class {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
constructor(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
thirdpartyAuth;
|
|
74
|
+
googleClientId;
|
|
75
|
+
googleClientSecret;
|
|
76
|
+
googleRedirectUri;
|
|
77
|
+
constructor({
|
|
78
|
+
thirdpartyAuth,
|
|
79
|
+
googleClientId,
|
|
80
|
+
googleClientSecret,
|
|
81
|
+
googleRedirectUri
|
|
82
|
+
}) {
|
|
83
|
+
this.thirdpartyAuth = thirdpartyAuth;
|
|
84
|
+
this.googleClientId = googleClientId;
|
|
85
|
+
this.googleClientSecret = googleClientSecret;
|
|
86
|
+
this.googleRedirectUri = googleRedirectUri;
|
|
82
87
|
}
|
|
83
|
-
async
|
|
88
|
+
async login(code) {
|
|
84
89
|
const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
|
|
85
90
|
method: "POST",
|
|
86
91
|
headers: {
|
|
@@ -88,9 +93,9 @@ var GoogleAuth = class {
|
|
|
88
93
|
},
|
|
89
94
|
body: new URLSearchParams({
|
|
90
95
|
code,
|
|
91
|
-
client_id: this.
|
|
92
|
-
client_secret: this.
|
|
93
|
-
redirect_uri: this.
|
|
96
|
+
client_id: this.googleClientId,
|
|
97
|
+
client_secret: this.googleClientSecret,
|
|
98
|
+
redirect_uri: this.googleRedirectUri,
|
|
94
99
|
grant_type: "authorization_code"
|
|
95
100
|
})
|
|
96
101
|
});
|
|
@@ -115,27 +120,13 @@ var GoogleAuth = class {
|
|
|
115
120
|
throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
|
|
116
121
|
}
|
|
117
122
|
const { id, email, name, picture } = await userRes.json();
|
|
118
|
-
const
|
|
123
|
+
const payload = {
|
|
119
124
|
id,
|
|
120
125
|
email,
|
|
121
126
|
name,
|
|
122
127
|
picture
|
|
123
|
-
});
|
|
124
|
-
if (!user) {
|
|
125
|
-
throw createJsonResponse(404)({
|
|
126
|
-
provider: "google",
|
|
127
|
-
id,
|
|
128
|
-
name,
|
|
129
|
-
picture,
|
|
130
|
-
message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
|
|
134
|
-
return {
|
|
135
|
-
user,
|
|
136
|
-
accessToken,
|
|
137
|
-
refreshToken
|
|
138
128
|
};
|
|
129
|
+
return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
|
|
139
130
|
}
|
|
140
131
|
};
|
|
141
132
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/http
|
|
1
|
+
// src/http/response.ts
|
|
2
2
|
var createJsonResponse = (status) => {
|
|
3
3
|
return (data = {}, init) => {
|
|
4
4
|
return Response.json(data, { status, ...init });
|
|
@@ -42,19 +42,24 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
42
42
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
// src/auth
|
|
45
|
+
// src/auth/google_auth.tsx
|
|
46
46
|
var GoogleAuth = class {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
thirdpartyAuth;
|
|
48
|
+
googleClientId;
|
|
49
|
+
googleClientSecret;
|
|
50
|
+
googleRedirectUri;
|
|
51
|
+
constructor({
|
|
52
|
+
thirdpartyAuth,
|
|
53
|
+
googleClientId,
|
|
54
|
+
googleClientSecret,
|
|
55
|
+
googleRedirectUri
|
|
56
|
+
}) {
|
|
57
|
+
this.thirdpartyAuth = thirdpartyAuth;
|
|
58
|
+
this.googleClientId = googleClientId;
|
|
59
|
+
this.googleClientSecret = googleClientSecret;
|
|
60
|
+
this.googleRedirectUri = googleRedirectUri;
|
|
56
61
|
}
|
|
57
|
-
async
|
|
62
|
+
async login(code) {
|
|
58
63
|
const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
|
|
59
64
|
method: "POST",
|
|
60
65
|
headers: {
|
|
@@ -62,9 +67,9 @@ var GoogleAuth = class {
|
|
|
62
67
|
},
|
|
63
68
|
body: new URLSearchParams({
|
|
64
69
|
code,
|
|
65
|
-
client_id: this.
|
|
66
|
-
client_secret: this.
|
|
67
|
-
redirect_uri: this.
|
|
70
|
+
client_id: this.googleClientId,
|
|
71
|
+
client_secret: this.googleClientSecret,
|
|
72
|
+
redirect_uri: this.googleRedirectUri,
|
|
68
73
|
grant_type: "authorization_code"
|
|
69
74
|
})
|
|
70
75
|
});
|
|
@@ -89,27 +94,13 @@ var GoogleAuth = class {
|
|
|
89
94
|
throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
|
|
90
95
|
}
|
|
91
96
|
const { id, email, name, picture } = await userRes.json();
|
|
92
|
-
const
|
|
97
|
+
const payload = {
|
|
93
98
|
id,
|
|
94
99
|
email,
|
|
95
100
|
name,
|
|
96
101
|
picture
|
|
97
|
-
});
|
|
98
|
-
if (!user) {
|
|
99
|
-
throw createJsonResponse(404)({
|
|
100
|
-
provider: "google",
|
|
101
|
-
id,
|
|
102
|
-
name,
|
|
103
|
-
picture,
|
|
104
|
-
message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
|
|
108
|
-
return {
|
|
109
|
-
user,
|
|
110
|
-
accessToken,
|
|
111
|
-
refreshToken
|
|
112
102
|
};
|
|
103
|
+
return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
|
|
113
104
|
}
|
|
114
105
|
};
|
|
115
106
|
export {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.mjs';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.mjs';
|
|
5
|
+
import '../../file/object_storage.mjs';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.mjs';
|
|
8
|
+
|
|
9
|
+
declare const findAuthHandler: (request: Request, { authService }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { findAuthHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.js';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.js';
|
|
5
|
+
import '../../file/object_storage.js';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.js';
|
|
8
|
+
|
|
9
|
+
declare const findAuthHandler: (request: Request, { authService }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { findAuthHandler };
|
|
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/auth/handlers/find_auth.ts
|
|
21
|
+
var find_auth_exports = {};
|
|
22
|
+
__export(find_auth_exports, {
|
|
23
|
+
findAuthHandler: () => findAuthHandler
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(find_auth_exports);
|
|
26
26
|
|
|
27
|
-
// src/http
|
|
27
|
+
// src/http/response.ts
|
|
28
28
|
var createJsonResponse = (status) => {
|
|
29
29
|
return (data = {}, init) => {
|
|
30
30
|
return Response.json(data, { status, ...init });
|
|
@@ -68,9 +68,9 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
68
68
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
// src/
|
|
72
|
-
var
|
|
73
|
-
const auth = await
|
|
71
|
+
// src/auth/handlers/find_auth.ts
|
|
72
|
+
var findAuthHandler = async (request, { authService }) => {
|
|
73
|
+
const auth = await authService.verifyOrRefresh(request);
|
|
74
74
|
if (!auth) {
|
|
75
75
|
return UNAUTHORIZED();
|
|
76
76
|
}
|
|
@@ -78,5 +78,5 @@ var getAuthHandler = async (request, { AUTH }) => {
|
|
|
78
78
|
};
|
|
79
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
80
|
0 && (module.exports = {
|
|
81
|
-
|
|
81
|
+
findAuthHandler
|
|
82
82
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/http
|
|
1
|
+
// src/http/response.ts
|
|
2
2
|
var createJsonResponse = (status) => {
|
|
3
3
|
return (data = {}, init) => {
|
|
4
4
|
return Response.json(data, { status, ...init });
|
|
@@ -42,14 +42,14 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
42
42
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
const auth = await
|
|
45
|
+
// src/auth/handlers/find_auth.ts
|
|
46
|
+
var findAuthHandler = async (request, { authService }) => {
|
|
47
|
+
const auth = await authService.verifyOrRefresh(request);
|
|
48
48
|
if (!auth) {
|
|
49
49
|
return UNAUTHORIZED();
|
|
50
50
|
}
|
|
51
51
|
return OK(auth);
|
|
52
52
|
};
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
findAuthHandler
|
|
55
55
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.mjs';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.mjs';
|
|
5
|
+
import '../../file/object_storage.mjs';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.mjs';
|
|
8
|
+
|
|
9
|
+
declare const loginHandler: (request: Request, { authService, }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { loginHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.js';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.js';
|
|
5
|
+
import '../../file/object_storage.js';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.js';
|
|
8
|
+
|
|
9
|
+
declare const loginHandler: (request: Request, { authService, }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { loginHandler };
|
|
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/auth/handlers/login.ts
|
|
21
|
+
var login_exports = {};
|
|
22
|
+
__export(login_exports, {
|
|
23
|
+
loginHandler: () => loginHandler
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(login_exports);
|
|
26
26
|
|
|
27
|
-
// src/http
|
|
27
|
+
// src/http/response.ts
|
|
28
28
|
var createJsonResponse = (status) => {
|
|
29
29
|
return (data = {}, init) => {
|
|
30
30
|
return Response.json(data, { status, ...init });
|
|
@@ -68,26 +68,26 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
68
68
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
// src/
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
JWT_MANAGER
|
|
71
|
+
// src/auth/handlers/login.ts
|
|
72
|
+
var loginHandler = async (request, {
|
|
73
|
+
authService
|
|
75
74
|
}) => {
|
|
76
|
-
const searchParams = new URL(request.url).searchParams;
|
|
77
75
|
const { id, password } = await request.json();
|
|
78
76
|
try {
|
|
79
|
-
const { accessToken, refreshToken } = await
|
|
77
|
+
const { accessToken, refreshToken } = await authService.login({
|
|
80
78
|
id,
|
|
81
79
|
password
|
|
82
80
|
});
|
|
83
|
-
|
|
81
|
+
const searchParams = new URL(request.url).searchParams;
|
|
82
|
+
const type = searchParams.get("type");
|
|
83
|
+
if (type === "json") {
|
|
84
84
|
return CREATED({ accessToken, refreshToken });
|
|
85
85
|
}
|
|
86
86
|
const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
authService.getAccessTokenSetCookie(accessToken),
|
|
88
|
+
authService.getRefreshTokenSetCookie(refreshToken)
|
|
89
89
|
]);
|
|
90
|
-
const payload =
|
|
90
|
+
const payload = authService.jwtManager.decode(accessToken);
|
|
91
91
|
const headers = new Headers();
|
|
92
92
|
headers.append("Set-Cookie", accessTokenSetCookie);
|
|
93
93
|
headers.append("Set-Cookie", refreshTokenSetCookie);
|
|
@@ -103,5 +103,5 @@ var loginCredentialHandler = async (request, {
|
|
|
103
103
|
};
|
|
104
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
105
105
|
0 && (module.exports = {
|
|
106
|
-
|
|
106
|
+
loginHandler
|
|
107
107
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/http
|
|
1
|
+
// src/http/response.ts
|
|
2
2
|
var createJsonResponse = (status) => {
|
|
3
3
|
return (data = {}, init) => {
|
|
4
4
|
return Response.json(data, { status, ...init });
|
|
@@ -42,26 +42,26 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
42
42
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
JWT_MANAGER
|
|
45
|
+
// src/auth/handlers/login.ts
|
|
46
|
+
var loginHandler = async (request, {
|
|
47
|
+
authService
|
|
49
48
|
}) => {
|
|
50
|
-
const searchParams = new URL(request.url).searchParams;
|
|
51
49
|
const { id, password } = await request.json();
|
|
52
50
|
try {
|
|
53
|
-
const { accessToken, refreshToken } = await
|
|
51
|
+
const { accessToken, refreshToken } = await authService.login({
|
|
54
52
|
id,
|
|
55
53
|
password
|
|
56
54
|
});
|
|
57
|
-
|
|
55
|
+
const searchParams = new URL(request.url).searchParams;
|
|
56
|
+
const type = searchParams.get("type");
|
|
57
|
+
if (type === "json") {
|
|
58
58
|
return CREATED({ accessToken, refreshToken });
|
|
59
59
|
}
|
|
60
60
|
const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
authService.getAccessTokenSetCookie(accessToken),
|
|
62
|
+
authService.getRefreshTokenSetCookie(refreshToken)
|
|
63
63
|
]);
|
|
64
|
-
const payload =
|
|
64
|
+
const payload = authService.jwtManager.decode(accessToken);
|
|
65
65
|
const headers = new Headers();
|
|
66
66
|
headers.append("Set-Cookie", accessTokenSetCookie);
|
|
67
67
|
headers.append("Set-Cookie", refreshTokenSetCookie);
|
|
@@ -76,5 +76,5 @@ var loginCredentialHandler = async (request, {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
export {
|
|
79
|
-
|
|
79
|
+
loginHandler
|
|
80
80
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThirdpartyAuth } from '../thirdparty_auth.mjs';
|
|
2
|
+
import '../auth_service.mjs';
|
|
3
|
+
import 'jose';
|
|
4
|
+
import 'react-router';
|
|
5
|
+
import '../jwt_manager.mjs';
|
|
6
|
+
import '../../file/object_storage.mjs';
|
|
7
|
+
import '@aws-sdk/client-s3';
|
|
8
|
+
import '../auth_repository.mjs';
|
|
9
|
+
|
|
10
|
+
declare const loginWithThirdPartyHandler: (request: Request, { provider, getThirdPartyAuth, }: {
|
|
11
|
+
provider: string;
|
|
12
|
+
getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
|
|
13
|
+
}) => Promise<Response>;
|
|
14
|
+
|
|
15
|
+
export { loginWithThirdPartyHandler };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThirdpartyAuth } from '../thirdparty_auth.js';
|
|
2
|
+
import '../auth_service.js';
|
|
3
|
+
import 'jose';
|
|
4
|
+
import 'react-router';
|
|
5
|
+
import '../jwt_manager.js';
|
|
6
|
+
import '../../file/object_storage.js';
|
|
7
|
+
import '@aws-sdk/client-s3';
|
|
8
|
+
import '../auth_repository.js';
|
|
9
|
+
|
|
10
|
+
declare const loginWithThirdPartyHandler: (request: Request, { provider, getThirdPartyAuth, }: {
|
|
11
|
+
provider: string;
|
|
12
|
+
getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
|
|
13
|
+
}) => Promise<Response>;
|
|
14
|
+
|
|
15
|
+
export { loginWithThirdPartyHandler };
|
package/dist/{route/api/auth/login/[provider]/route.js → auth/handlers/login_with_thirdparty.js}
RENAMED
|
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/auth/handlers/login_with_thirdparty.ts
|
|
21
|
+
var login_with_thirdparty_exports = {};
|
|
22
|
+
__export(login_with_thirdparty_exports, {
|
|
23
|
+
loginWithThirdPartyHandler: () => loginWithThirdPartyHandler
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(login_with_thirdparty_exports);
|
|
26
26
|
|
|
27
|
-
// src/http
|
|
27
|
+
// src/http/response.ts
|
|
28
28
|
var createJsonResponse = (status) => {
|
|
29
29
|
return (data = {}, init) => {
|
|
30
30
|
return Response.json(data, { status, ...init });
|
|
@@ -68,34 +68,19 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
68
68
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
// src/
|
|
72
|
-
var
|
|
73
|
-
provider
|
|
74
|
-
|
|
75
|
-
GOOGLE_AUTH,
|
|
76
|
-
APPLE_AUTH,
|
|
77
|
-
KAKAO_AUTH
|
|
71
|
+
// src/auth/handlers/login_with_thirdparty.ts
|
|
72
|
+
var loginWithThirdPartyHandler = async (request, {
|
|
73
|
+
provider,
|
|
74
|
+
getThirdPartyAuth
|
|
78
75
|
}) => {
|
|
79
76
|
const { code } = await request.json();
|
|
80
77
|
if (!code) {
|
|
81
78
|
return BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
82
79
|
}
|
|
83
|
-
const getThirdPartyAuth = (provider2) => {
|
|
84
|
-
switch (provider2) {
|
|
85
|
-
case "google":
|
|
86
|
-
return GOOGLE_AUTH;
|
|
87
|
-
case "apple":
|
|
88
|
-
return APPLE_AUTH;
|
|
89
|
-
case "kakao":
|
|
90
|
-
return KAKAO_AUTH;
|
|
91
|
-
default:
|
|
92
|
-
throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
80
|
try {
|
|
96
81
|
const { accessToken, refreshToken } = await getThirdPartyAuth(
|
|
97
82
|
provider
|
|
98
|
-
).
|
|
83
|
+
).login(code);
|
|
99
84
|
return CREATED({
|
|
100
85
|
accessToken,
|
|
101
86
|
refreshToken
|
|
@@ -109,5 +94,5 @@ var loginThirdPartyHandler = async (request, {
|
|
|
109
94
|
};
|
|
110
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
96
|
0 && (module.exports = {
|
|
112
|
-
|
|
97
|
+
loginWithThirdPartyHandler
|
|
113
98
|
});
|
package/dist/{route/api/auth/login/[provider]/route.mjs → auth/handlers/login_with_thirdparty.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/http
|
|
1
|
+
// src/http/response.ts
|
|
2
2
|
var createJsonResponse = (status) => {
|
|
3
3
|
return (data = {}, init) => {
|
|
4
4
|
return Response.json(data, { status, ...init });
|
|
@@ -42,34 +42,19 @@ var INTERNAL_SERVER_ERROR = createException(
|
|
|
42
42
|
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
provider
|
|
48
|
-
|
|
49
|
-
GOOGLE_AUTH,
|
|
50
|
-
APPLE_AUTH,
|
|
51
|
-
KAKAO_AUTH
|
|
45
|
+
// src/auth/handlers/login_with_thirdparty.ts
|
|
46
|
+
var loginWithThirdPartyHandler = async (request, {
|
|
47
|
+
provider,
|
|
48
|
+
getThirdPartyAuth
|
|
52
49
|
}) => {
|
|
53
50
|
const { code } = await request.json();
|
|
54
51
|
if (!code) {
|
|
55
52
|
return BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
56
53
|
}
|
|
57
|
-
const getThirdPartyAuth = (provider2) => {
|
|
58
|
-
switch (provider2) {
|
|
59
|
-
case "google":
|
|
60
|
-
return GOOGLE_AUTH;
|
|
61
|
-
case "apple":
|
|
62
|
-
return APPLE_AUTH;
|
|
63
|
-
case "kakao":
|
|
64
|
-
return KAKAO_AUTH;
|
|
65
|
-
default:
|
|
66
|
-
throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
54
|
try {
|
|
70
55
|
const { accessToken, refreshToken } = await getThirdPartyAuth(
|
|
71
56
|
provider
|
|
72
|
-
).
|
|
57
|
+
).login(code);
|
|
73
58
|
return CREATED({
|
|
74
59
|
accessToken,
|
|
75
60
|
refreshToken
|
|
@@ -82,5 +67,5 @@ var loginThirdPartyHandler = async (request, {
|
|
|
82
67
|
}
|
|
83
68
|
};
|
|
84
69
|
export {
|
|
85
|
-
|
|
70
|
+
loginWithThirdPartyHandler
|
|
86
71
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.mjs';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.mjs';
|
|
5
|
+
import '../../file/object_storage.mjs';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.mjs';
|
|
8
|
+
|
|
9
|
+
declare const logoutHandler: (request: Request, { authService }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { logoutHandler };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthService } from '../auth_service.js';
|
|
2
|
+
import 'jose';
|
|
3
|
+
import 'react-router';
|
|
4
|
+
import '../jwt_manager.js';
|
|
5
|
+
import '../../file/object_storage.js';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
import '../auth_repository.js';
|
|
8
|
+
|
|
9
|
+
declare const logoutHandler: (request: Request, { authService }: {
|
|
10
|
+
authService: AuthService;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
|
|
13
|
+
export { logoutHandler };
|