@withwiz/toolkit 0.6.2 → 0.6.3
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/README.md +2 -2
- package/dist/auth/adapters/prisma/index.js +2 -2
- package/dist/auth/core/jwt/types.js +1 -1
- package/dist/auth/core/oauth/index.d.ts +1 -1
- package/dist/auth/core/oauth/index.js +12 -4
- package/dist/auth/core/oauth/providers/index.d.ts +2 -0
- package/dist/auth/core/oauth/providers/index.js +11 -3
- package/dist/auth/core/oauth/providers/kakao.js +1 -1
- package/dist/auth/core/oauth/providers/meta.d.ts +14 -0
- package/dist/auth/core/oauth/providers/meta.js +8 -0
- package/dist/auth/core/oauth/providers/microsoft.d.ts +21 -0
- package/dist/auth/core/oauth/providers/microsoft.js +8 -0
- package/dist/auth/core/password/client-helper.js +1 -1
- package/dist/auth/core/password/index.js +1 -1
- package/dist/auth/handlers/forgot-password.handler.js +1 -1
- package/dist/auth/handlers/index.js +19 -17
- package/dist/auth/handlers/oauth-authorize.handler.js +7 -5
- package/dist/auth/handlers/oauth-callback.handler.js +8 -6
- package/dist/auth/handlers/register.handler.js +3 -3
- package/dist/auth/handlers/reset-password.handler.js +1 -1
- package/dist/auth/handlers/verify-email.handler.js +1 -1
- package/dist/auth/index.js +6 -4
- package/dist/auth/services/email-verification.service.js +1 -1
- package/dist/auth/services/index.js +7 -7
- package/dist/auth/services/oauth-callback.service.js +1 -1
- package/dist/auth/services/password-reset.service.js +1 -1
- package/dist/auth/services/register.service.js +2 -2
- package/dist/auth/types/index.d.ts +2 -0
- package/dist/auth/types/index.js +1 -1
- package/dist/{chunk-HZLJYEOO.js → chunk-57HPJEZB.js} +9 -1
- package/dist/{chunk-Q7VFOUFI.js → chunk-D6MIC5AU.js} +1 -1
- package/dist/{chunk-ITGUSYUH.js → chunk-G2WAL2T7.js} +3 -1
- package/dist/{chunk-6JY6NUR6.js → chunk-GDX3YQGK.js} +1 -1
- package/dist/{chunk-6B7VU6RZ.js → chunk-JDXC3QIA.js} +0 -1
- package/dist/chunk-K3OYTLXU.js +63 -0
- package/dist/{chunk-ETMTDHK2.js → chunk-SOQOAFB2.js} +0 -1
- package/dist/{chunk-2QQNL4ND.js → chunk-TLZJQR26.js} +17 -6
- package/dist/chunk-VB64KFBD.js +99 -0
- package/dist/{chunk-B6Q7UNCU.js → chunk-XIJMATSG.js} +2 -2
- package/dist/constants/index.js +14 -14
- package/dist/utils/index.js +8 -8
- package/package.json +1 -1
- /package/dist/{chunk-T4MDCVUQ.js → chunk-6CLQRZC2.js} +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Shared utility library for [withwiz](https://github.com/greeun) projects — a c
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Auth** — JWT, password hashing, OAuth helpers, Prisma adapter
|
|
7
|
+
- **Auth** — JWT, password hashing, OAuth helpers (Google / GitHub / Kakao / Microsoft / Meta), Prisma adapter
|
|
8
8
|
- **Cache** — Redis-backed caching with factory, invalidation, and defaults
|
|
9
9
|
- **Constants** — Error codes, messages, pagination, security constants
|
|
10
10
|
- **Error** — Typed `AppError`, centralized error handler and display
|
|
@@ -95,7 +95,7 @@ import { normalizeUrl } from '@withwiz/toolkit/utils/url-normalizer'
|
|
|
95
95
|
| `/auth` | Full auth module (JWT + password + OAuth + Prisma adapter) |
|
|
96
96
|
| `/auth/core/jwt` | JWT sign / verify |
|
|
97
97
|
| `/auth/core/password` | bcrypt helpers |
|
|
98
|
-
| `/auth/core/oauth` | OAuth utilities |
|
|
98
|
+
| `/auth/core/oauth` | OAuth utilities (Google / GitHub / Kakao / Microsoft / Meta) |
|
|
99
99
|
| `/auth/adapters/prisma` | Prisma-based session adapter |
|
|
100
100
|
| `/cache` | Redis cache (get / set / delete / withCache) |
|
|
101
101
|
| `/cache/cache-factory` | Cache factory for multiple backends |
|
|
@@ -44,8 +44,8 @@ var PrismaUserRepository = class {
|
|
|
44
44
|
name: data.name || null
|
|
45
45
|
};
|
|
46
46
|
createData[this.config.userFields.password] = data.password || null;
|
|
47
|
-
if (
|
|
48
|
-
createData[this.config.userFields.role] = data.role
|
|
47
|
+
if (data.role !== void 0 && data.role !== null) {
|
|
48
|
+
createData[this.config.userFields.role] = data.role;
|
|
49
49
|
}
|
|
50
50
|
createData[this.config.userFields.emailVerified] = data.emailVerified || null;
|
|
51
51
|
createData[this.config.userFields.image] = data.image || null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { OAuthConfig, OAuthUserInfo, Logger, IOAuthProviderAdapter } from '@withwiz/auth/types';
|
|
8
8
|
import { OAUTH_PROVIDERS } from '@withwiz/auth/types';
|
|
9
9
|
export { OAUTH_PROVIDERS };
|
|
10
|
-
export { GoogleOAuthProvider, GitHubOAuthProvider, KakaoOAuthProvider } from './providers';
|
|
10
|
+
export { GoogleOAuthProvider, GitHubOAuthProvider, KakaoOAuthProvider, MicrosoftOAuthProvider, MetaOAuthProvider, } from './providers';
|
|
11
11
|
export declare class OAuthManager {
|
|
12
12
|
private config;
|
|
13
13
|
private logger;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OAuthManager
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-57HPJEZB.js";
|
|
4
|
+
import "../../../chunk-6CLQRZC2.js";
|
|
5
5
|
import {
|
|
6
6
|
KakaoOAuthProvider
|
|
7
|
-
} from "../../../chunk-
|
|
7
|
+
} from "../../../chunk-TLZJQR26.js";
|
|
8
|
+
import {
|
|
9
|
+
MetaOAuthProvider
|
|
10
|
+
} from "../../../chunk-K3OYTLXU.js";
|
|
11
|
+
import {
|
|
12
|
+
MicrosoftOAuthProvider
|
|
13
|
+
} from "../../../chunk-VB64KFBD.js";
|
|
8
14
|
import {
|
|
9
15
|
GitHubOAuthProvider
|
|
10
16
|
} from "../../../chunk-GBLNXNEH.js";
|
|
@@ -13,7 +19,7 @@ import {
|
|
|
13
19
|
} from "../../../chunk-RVL5ROWQ.js";
|
|
14
20
|
import {
|
|
15
21
|
OAUTH_PROVIDERS
|
|
16
|
-
} from "../../../chunk-
|
|
22
|
+
} from "../../../chunk-G2WAL2T7.js";
|
|
17
23
|
import "../../../chunk-YZXGOOFC.js";
|
|
18
24
|
import "../../../chunk-AIH3F7JV.js";
|
|
19
25
|
import "../../../chunk-ORMEWXMH.js";
|
|
@@ -21,6 +27,8 @@ export {
|
|
|
21
27
|
GitHubOAuthProvider,
|
|
22
28
|
GoogleOAuthProvider,
|
|
23
29
|
KakaoOAuthProvider,
|
|
30
|
+
MetaOAuthProvider,
|
|
31
|
+
MicrosoftOAuthProvider,
|
|
24
32
|
OAUTH_PROVIDERS,
|
|
25
33
|
OAuthManager
|
|
26
34
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import "../../../../chunk-
|
|
1
|
+
import "../../../../chunk-6CLQRZC2.js";
|
|
2
2
|
import {
|
|
3
3
|
KakaoOAuthProvider
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-TLZJQR26.js";
|
|
5
|
+
import {
|
|
6
|
+
MetaOAuthProvider
|
|
7
|
+
} from "../../../../chunk-K3OYTLXU.js";
|
|
8
|
+
import {
|
|
9
|
+
MicrosoftOAuthProvider
|
|
10
|
+
} from "../../../../chunk-VB64KFBD.js";
|
|
5
11
|
import {
|
|
6
12
|
GitHubOAuthProvider
|
|
7
13
|
} from "../../../../chunk-GBLNXNEH.js";
|
|
@@ -13,5 +19,7 @@ import "../../../../chunk-ORMEWXMH.js";
|
|
|
13
19
|
export {
|
|
14
20
|
GitHubOAuthProvider,
|
|
15
21
|
GoogleOAuthProvider,
|
|
16
|
-
KakaoOAuthProvider
|
|
22
|
+
KakaoOAuthProvider,
|
|
23
|
+
MetaOAuthProvider,
|
|
24
|
+
MicrosoftOAuthProvider
|
|
17
25
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta(Facebook) OAuth Provider Adapter
|
|
3
|
+
*
|
|
4
|
+
* Meta OAuth 2.0 인증 어댑터 (Graph API v25.0).
|
|
5
|
+
* - Token 교환은 Meta 공식 권고에 따라 GET + query string 사용
|
|
6
|
+
* - 사용자 정보는 Graph /me?fields=id,name,email,picture 응답에서 매핑
|
|
7
|
+
*/
|
|
8
|
+
import type { IOAuthProviderAdapter, OAuthProviderConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
9
|
+
export declare class MetaOAuthProvider implements IOAuthProviderAdapter {
|
|
10
|
+
readonly name = "meta";
|
|
11
|
+
getLoginUrl(config: OAuthProviderConfig, state?: string): string;
|
|
12
|
+
exchangeCodeForToken(config: OAuthProviderConfig, code: string): Promise<OAuthTokenResponse>;
|
|
13
|
+
getUserInfo(accessToken: string): Promise<OAuthUserInfo>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft OAuth Provider Adapter
|
|
3
|
+
*
|
|
4
|
+
* Microsoft Entra v2.0 (common 테넌트, server-side code flow).
|
|
5
|
+
*
|
|
6
|
+
* 신뢰 모델: 이 어댑터의 `getUserInfo`는 동일 어댑터의 `exchangeCodeForToken`이
|
|
7
|
+
* 반환한 토큰만 입력으로 받는다는 가정 하에 동작한다 (HTTPS code-flow 채널 신뢰).
|
|
8
|
+
* 외부에서 받은 id_token을 직접 주입하지 말 것. 클라이언트-사이드 흐름(SPA/PKCE)
|
|
9
|
+
* 지원이 필요해지면 JWKS 기반 서명 검증을 별도 spec으로 추가한다.
|
|
10
|
+
*
|
|
11
|
+
* 인터페이스 우회: IOAuthProviderAdapter 변경 없이 id_token 클레임을 사용하기
|
|
12
|
+
* 위해, exchangeCodeForToken은 upstream의 `id_token` 값을 OAuthTokenResponse.access_token
|
|
13
|
+
* 필드에 담아 반환한다. getUserInfo는 그 문자열을 jose.decodeJwt로 디코딩한다.
|
|
14
|
+
*/
|
|
15
|
+
import type { IOAuthProviderAdapter, OAuthProviderConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
16
|
+
export declare class MicrosoftOAuthProvider implements IOAuthProviderAdapter {
|
|
17
|
+
readonly name = "microsoft";
|
|
18
|
+
getLoginUrl(config: OAuthProviderConfig, state?: string): string;
|
|
19
|
+
exchangeCodeForToken(config: OAuthProviderConfig, code: string): Promise<OAuthTokenResponse>;
|
|
20
|
+
getUserInfo(idToken: string): Promise<OAuthUserInfo>;
|
|
21
|
+
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
PasswordHasher,
|
|
13
13
|
PasswordValidator
|
|
14
14
|
} from "../../../chunk-IHXRF3BH.js";
|
|
15
|
-
import "../../../chunk-
|
|
15
|
+
import "../../../chunk-G2WAL2T7.js";
|
|
16
16
|
import "../../../chunk-YZXGOOFC.js";
|
|
17
17
|
import "../../../chunk-ORMEWXMH.js";
|
|
18
18
|
export {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunk-FRY3TNJ6.js";
|
|
4
4
|
import "../../chunk-WC2IYFGC.js";
|
|
5
5
|
import "../../chunk-GDWEDUHO.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-G2WAL2T7.js";
|
|
7
7
|
import "../../chunk-YZXGOOFC.js";
|
|
8
8
|
import "../../chunk-AIH3F7JV.js";
|
|
9
9
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createVerifyEmailHandler
|
|
3
|
+
} from "../../chunk-QYXI45KH.js";
|
|
4
|
+
import {
|
|
5
|
+
createLoginHandler
|
|
6
|
+
} from "../../chunk-L74XPPH4.js";
|
|
1
7
|
import {
|
|
2
8
|
createLogoutHandler
|
|
3
9
|
} from "../../chunk-ERO4PGNO.js";
|
|
@@ -6,40 +12,36 @@ import {
|
|
|
6
12
|
} from "../../chunk-4YQ6YBM7.js";
|
|
7
13
|
import {
|
|
8
14
|
createOAuthAuthorizeHandler
|
|
9
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-GDX3YQGK.js";
|
|
10
16
|
import {
|
|
11
17
|
createOAuthCallbackHandler
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-6B7VU6RZ.js";
|
|
18
|
+
} from "../../chunk-XIJMATSG.js";
|
|
14
19
|
import {
|
|
15
20
|
createRefreshHandler
|
|
16
21
|
} from "../../chunk-O5E36ZIJ.js";
|
|
17
|
-
import "../../chunk-JQFQT4S2.js";
|
|
18
22
|
import {
|
|
19
23
|
createRegisterHandler
|
|
20
|
-
} from "../../chunk-
|
|
21
|
-
import "../../chunk-ETMTDHK2.js";
|
|
24
|
+
} from "../../chunk-D6MIC5AU.js";
|
|
22
25
|
import {
|
|
23
26
|
createResetPasswordHandler
|
|
24
27
|
} from "../../chunk-TFZOOP3V.js";
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import "../../chunk-N6TMHITU.js";
|
|
28
|
+
import "../../chunk-JDXC3QIA.js";
|
|
29
|
+
import "../../chunk-SOQOAFB2.js";
|
|
30
|
+
import "../../chunk-JQFQT4S2.js";
|
|
29
31
|
import {
|
|
30
32
|
createForgotPasswordHandler
|
|
31
33
|
} from "../../chunk-FRY3TNJ6.js";
|
|
32
34
|
import "../../chunk-WC2IYFGC.js";
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import "../../chunk-
|
|
37
|
-
import "../../chunk-
|
|
38
|
-
import "../../chunk-
|
|
35
|
+
import "../../chunk-N6TMHITU.js";
|
|
36
|
+
import "../../chunk-57HPJEZB.js";
|
|
37
|
+
import "../../chunk-6CLQRZC2.js";
|
|
38
|
+
import "../../chunk-TLZJQR26.js";
|
|
39
|
+
import "../../chunk-K3OYTLXU.js";
|
|
40
|
+
import "../../chunk-VB64KFBD.js";
|
|
39
41
|
import "../../chunk-GBLNXNEH.js";
|
|
40
42
|
import "../../chunk-RVL5ROWQ.js";
|
|
41
43
|
import "../../chunk-GDWEDUHO.js";
|
|
42
|
-
import "../../chunk-
|
|
44
|
+
import "../../chunk-G2WAL2T7.js";
|
|
43
45
|
import "../../chunk-YZXGOOFC.js";
|
|
44
46
|
import "../../chunk-3GAY2T2A.js";
|
|
45
47
|
import "../../chunk-V3ZIR4UL.js";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOAuthAuthorizeHandler
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-GDX3YQGK.js";
|
|
4
|
+
import "../../chunk-57HPJEZB.js";
|
|
5
|
+
import "../../chunk-6CLQRZC2.js";
|
|
6
|
+
import "../../chunk-TLZJQR26.js";
|
|
7
|
+
import "../../chunk-K3OYTLXU.js";
|
|
8
|
+
import "../../chunk-VB64KFBD.js";
|
|
7
9
|
import "../../chunk-GBLNXNEH.js";
|
|
8
10
|
import "../../chunk-RVL5ROWQ.js";
|
|
9
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-G2WAL2T7.js";
|
|
10
12
|
import "../../chunk-YZXGOOFC.js";
|
|
11
13
|
import "../../chunk-AIH3F7JV.js";
|
|
12
14
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOAuthCallbackHandler
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-XIJMATSG.js";
|
|
4
|
+
import "../../chunk-JDXC3QIA.js";
|
|
5
|
+
import "../../chunk-57HPJEZB.js";
|
|
6
|
+
import "../../chunk-6CLQRZC2.js";
|
|
7
|
+
import "../../chunk-TLZJQR26.js";
|
|
8
|
+
import "../../chunk-K3OYTLXU.js";
|
|
9
|
+
import "../../chunk-VB64KFBD.js";
|
|
8
10
|
import "../../chunk-GBLNXNEH.js";
|
|
9
11
|
import "../../chunk-RVL5ROWQ.js";
|
|
10
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-G2WAL2T7.js";
|
|
11
13
|
import "../../chunk-YZXGOOFC.js";
|
|
12
14
|
import "../../chunk-3GAY2T2A.js";
|
|
13
15
|
import "../../chunk-V3ZIR4UL.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRegisterHandler
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-D6MIC5AU.js";
|
|
4
|
+
import "../../chunk-SOQOAFB2.js";
|
|
5
5
|
import "../../chunk-GDWEDUHO.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-G2WAL2T7.js";
|
|
7
7
|
import "../../chunk-YZXGOOFC.js";
|
|
8
8
|
import "../../chunk-AIH3F7JV.js";
|
|
9
9
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunk-TFZOOP3V.js";
|
|
4
4
|
import "../../chunk-WC2IYFGC.js";
|
|
5
5
|
import "../../chunk-GDWEDUHO.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-G2WAL2T7.js";
|
|
7
7
|
import "../../chunk-YZXGOOFC.js";
|
|
8
8
|
import "../../chunk-AIH3F7JV.js";
|
|
9
9
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunk-QYXI45KH.js";
|
|
4
4
|
import "../../chunk-N6TMHITU.js";
|
|
5
5
|
import "../../chunk-GDWEDUHO.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-G2WAL2T7.js";
|
|
7
7
|
import "../../chunk-YZXGOOFC.js";
|
|
8
8
|
import "../../chunk-AIH3F7JV.js";
|
|
9
9
|
import "../../chunk-ORMEWXMH.js";
|
package/dist/auth/index.js
CHANGED
|
@@ -31,11 +31,13 @@ import {
|
|
|
31
31
|
} from "../chunk-XRRPEBKB.js";
|
|
32
32
|
import {
|
|
33
33
|
OAuthManager
|
|
34
|
-
} from "../chunk-
|
|
35
|
-
import "../chunk-
|
|
34
|
+
} from "../chunk-57HPJEZB.js";
|
|
35
|
+
import "../chunk-6CLQRZC2.js";
|
|
36
36
|
import {
|
|
37
37
|
KakaoOAuthProvider
|
|
38
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-TLZJQR26.js";
|
|
39
|
+
import "../chunk-K3OYTLXU.js";
|
|
40
|
+
import "../chunk-VB64KFBD.js";
|
|
39
41
|
import {
|
|
40
42
|
GitHubOAuthProvider
|
|
41
43
|
} from "../chunk-GBLNXNEH.js";
|
|
@@ -49,7 +51,7 @@ import {
|
|
|
49
51
|
OAUTH_PROVIDERS,
|
|
50
52
|
PasswordStrength,
|
|
51
53
|
TokenType
|
|
52
|
-
} from "../chunk-
|
|
54
|
+
} from "../chunk-G2WAL2T7.js";
|
|
53
55
|
import "../chunk-YZXGOOFC.js";
|
|
54
56
|
import {
|
|
55
57
|
JWTManager,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EmailVerificationService
|
|
3
3
|
} from "../../chunk-N6TMHITU.js";
|
|
4
4
|
import "../../chunk-GDWEDUHO.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-G2WAL2T7.js";
|
|
6
6
|
import "../../chunk-YZXGOOFC.js";
|
|
7
7
|
import "../../chunk-AIH3F7JV.js";
|
|
8
8
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "../../chunk-DFSNHVXF.js";
|
|
4
4
|
import {
|
|
5
5
|
OAuthCallbackService
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-JDXC3QIA.js";
|
|
7
|
+
import {
|
|
8
|
+
RegisterService
|
|
9
|
+
} from "../../chunk-SOQOAFB2.js";
|
|
7
10
|
import {
|
|
8
11
|
TokenRefreshService
|
|
9
12
|
} from "../../chunk-JQFQT4S2.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "../../chunk-
|
|
14
|
+
PasswordResetService
|
|
15
|
+
} from "../../chunk-WC2IYFGC.js";
|
|
13
16
|
import {
|
|
14
17
|
EmailVerificationService
|
|
15
18
|
} from "../../chunk-N6TMHITU.js";
|
|
16
|
-
import {
|
|
17
|
-
PasswordResetService
|
|
18
|
-
} from "../../chunk-WC2IYFGC.js";
|
|
19
19
|
import "../../chunk-GDWEDUHO.js";
|
|
20
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-G2WAL2T7.js";
|
|
21
21
|
import "../../chunk-YZXGOOFC.js";
|
|
22
22
|
import "../../chunk-3GAY2T2A.js";
|
|
23
23
|
import "../../chunk-V3ZIR4UL.js";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
PasswordResetService
|
|
3
3
|
} from "../../chunk-WC2IYFGC.js";
|
|
4
4
|
import "../../chunk-GDWEDUHO.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-G2WAL2T7.js";
|
|
6
6
|
import "../../chunk-YZXGOOFC.js";
|
|
7
7
|
import "../../chunk-AIH3F7JV.js";
|
|
8
8
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RegisterService
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SOQOAFB2.js";
|
|
4
4
|
import "../../chunk-GDWEDUHO.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-G2WAL2T7.js";
|
|
6
6
|
import "../../chunk-YZXGOOFC.js";
|
|
7
7
|
import "../../chunk-AIH3F7JV.js";
|
|
8
8
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -34,6 +34,8 @@ export declare const OAUTH_PROVIDERS: {
|
|
|
34
34
|
readonly GOOGLE: "google";
|
|
35
35
|
readonly GITHUB: "github";
|
|
36
36
|
readonly KAKAO: "kakao";
|
|
37
|
+
readonly MICROSOFT: "microsoft";
|
|
38
|
+
readonly META: "meta";
|
|
37
39
|
};
|
|
38
40
|
export type OAuthProviderName = typeof OAUTH_PROVIDERS[keyof typeof OAUTH_PROVIDERS];
|
|
39
41
|
export interface OAuthUserInfo {
|
package/dist/auth/types/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KakaoOAuthProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TLZJQR26.js";
|
|
4
|
+
import {
|
|
5
|
+
MetaOAuthProvider
|
|
6
|
+
} from "./chunk-K3OYTLXU.js";
|
|
7
|
+
import {
|
|
8
|
+
MicrosoftOAuthProvider
|
|
9
|
+
} from "./chunk-VB64KFBD.js";
|
|
4
10
|
import {
|
|
5
11
|
GitHubOAuthProvider
|
|
6
12
|
} from "./chunk-GBLNXNEH.js";
|
|
@@ -20,6 +26,8 @@ var OAuthManager = class {
|
|
|
20
26
|
this.registerProvider(new GoogleOAuthProvider());
|
|
21
27
|
this.registerProvider(new GitHubOAuthProvider());
|
|
22
28
|
this.registerProvider(new KakaoOAuthProvider());
|
|
29
|
+
this.registerProvider(new MicrosoftOAuthProvider());
|
|
30
|
+
this.registerProvider(new MetaOAuthProvider());
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* 프로바이더 어댑터 등록
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OAuthError
|
|
3
|
+
} from "./chunk-AIH3F7JV.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/core/oauth/providers/meta.ts
|
|
6
|
+
var META_GRAPH_VERSION = "v25.0";
|
|
7
|
+
var MetaOAuthProvider = class {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.name = "meta";
|
|
10
|
+
}
|
|
11
|
+
getLoginUrl(config, state) {
|
|
12
|
+
const params = new URLSearchParams({
|
|
13
|
+
client_id: config.clientId,
|
|
14
|
+
redirect_uri: config.redirectUri,
|
|
15
|
+
response_type: "code",
|
|
16
|
+
scope: "email,public_profile"
|
|
17
|
+
});
|
|
18
|
+
if (state) {
|
|
19
|
+
params.set("state", state);
|
|
20
|
+
}
|
|
21
|
+
return `https://www.facebook.com/${META_GRAPH_VERSION}/dialog/oauth?${params.toString()}`;
|
|
22
|
+
}
|
|
23
|
+
async exchangeCodeForToken(config, code) {
|
|
24
|
+
const params = new URLSearchParams({
|
|
25
|
+
client_id: config.clientId,
|
|
26
|
+
client_secret: config.clientSecret,
|
|
27
|
+
code,
|
|
28
|
+
redirect_uri: config.redirectUri
|
|
29
|
+
});
|
|
30
|
+
const url = `https://graph.facebook.com/${META_GRAPH_VERSION}/oauth/access_token?${params.toString()}`;
|
|
31
|
+
const response = await fetch(url);
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorData = await response.text();
|
|
34
|
+
throw new OAuthError(`Meta token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
35
|
+
}
|
|
36
|
+
return response.json();
|
|
37
|
+
}
|
|
38
|
+
async getUserInfo(accessToken) {
|
|
39
|
+
var _a, _b, _c, _d;
|
|
40
|
+
const url = `https://graph.facebook.com/${META_GRAPH_VERSION}/me?fields=id,name,email,picture`;
|
|
41
|
+
const response = await fetch(url, {
|
|
42
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new OAuthError("Failed to get Meta user info", "USER_INFO_FAILED");
|
|
46
|
+
}
|
|
47
|
+
const data = await response.json();
|
|
48
|
+
if (!data.id) {
|
|
49
|
+
throw new OAuthError("Invalid Meta response: missing id", "INVALID_RESPONSE");
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
id: data.id,
|
|
53
|
+
email: data.email,
|
|
54
|
+
name: (_a = data.name) != null ? _a : null,
|
|
55
|
+
image: (_d = (_c = (_b = data.picture) == null ? void 0 : _b.data) == null ? void 0 : _c.url) != null ? _d : null,
|
|
56
|
+
emailVerified: !!data.email
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
MetaOAuthProvider
|
|
63
|
+
};
|
|
@@ -32,7 +32,6 @@ var RegisterService = class {
|
|
|
32
32
|
email: input.email,
|
|
33
33
|
password: hashedPassword,
|
|
34
34
|
name: (_a = input.name) != null ? _a : null,
|
|
35
|
-
role: "USER",
|
|
36
35
|
emailVerified: this.emailVerificationRequired ? null : /* @__PURE__ */ new Date()
|
|
37
36
|
});
|
|
38
37
|
let verificationSent = false;
|
|
@@ -35,9 +35,17 @@ var KakaoOAuthProvider = class {
|
|
|
35
35
|
const errorData = await response.text();
|
|
36
36
|
throw new OAuthError(`Kakao token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
if (data.error) {
|
|
40
|
+
throw new OAuthError(
|
|
41
|
+
`Kakao token exchange failed: ${data.error}${data.error_description ? ` - ${data.error_description}` : ""}`,
|
|
42
|
+
"TOKEN_EXCHANGE_FAILED"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return data;
|
|
39
46
|
}
|
|
40
47
|
async getUserInfo(accessToken) {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
41
49
|
const response = await fetch("https://kapi.kakao.com/v2/user/me", {
|
|
42
50
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
43
51
|
});
|
|
@@ -45,14 +53,17 @@ var KakaoOAuthProvider = class {
|
|
|
45
53
|
throw new OAuthError("Failed to get Kakao user info", "USER_INFO_FAILED");
|
|
46
54
|
}
|
|
47
55
|
const data = await response.json();
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
if (!data.id) {
|
|
57
|
+
throw new OAuthError("Invalid Kakao response: missing id", "INVALID_RESPONSE");
|
|
58
|
+
}
|
|
59
|
+
const account = (_a = data.kakao_account) != null ? _a : {};
|
|
60
|
+
const profile = (_b = account.profile) != null ? _b : {};
|
|
50
61
|
return {
|
|
51
62
|
id: data.id.toString(),
|
|
52
63
|
email: account.email,
|
|
53
|
-
name: profile.nickname
|
|
54
|
-
image: profile.profile_image_url
|
|
55
|
-
emailVerified: account.is_email_verified
|
|
64
|
+
name: (_c = profile.nickname) != null ? _c : null,
|
|
65
|
+
image: (_d = profile.profile_image_url) != null ? _d : null,
|
|
66
|
+
emailVerified: account.is_email_valid === true && account.is_email_verified === true
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OAuthError
|
|
3
|
+
} from "./chunk-AIH3F7JV.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/core/oauth/providers/microsoft.ts
|
|
6
|
+
import { decodeJwt } from "jose";
|
|
7
|
+
var MicrosoftOAuthProvider = class {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.name = "microsoft";
|
|
10
|
+
}
|
|
11
|
+
getLoginUrl(config, state) {
|
|
12
|
+
const params = new URLSearchParams({
|
|
13
|
+
client_id: config.clientId,
|
|
14
|
+
redirect_uri: config.redirectUri,
|
|
15
|
+
response_type: "code",
|
|
16
|
+
response_mode: "query",
|
|
17
|
+
scope: "openid profile email"
|
|
18
|
+
});
|
|
19
|
+
if (state) {
|
|
20
|
+
params.set("state", state);
|
|
21
|
+
}
|
|
22
|
+
return `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?${params.toString()}`;
|
|
23
|
+
}
|
|
24
|
+
async exchangeCodeForToken(config, code) {
|
|
25
|
+
var _a;
|
|
26
|
+
const response = await fetch("https://login.microsoftonline.com/common/oauth2/v2.0/token", {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
29
|
+
body: new URLSearchParams({
|
|
30
|
+
client_id: config.clientId,
|
|
31
|
+
client_secret: config.clientSecret,
|
|
32
|
+
code,
|
|
33
|
+
grant_type: "authorization_code",
|
|
34
|
+
redirect_uri: config.redirectUri,
|
|
35
|
+
scope: "openid profile email"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const errorData = await response.text();
|
|
40
|
+
throw new OAuthError(`Microsoft token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
41
|
+
}
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
if (data.error) {
|
|
44
|
+
throw new OAuthError(
|
|
45
|
+
`Microsoft token exchange failed: ${data.error}${data.error_description ? ` - ${data.error_description}` : ""}`,
|
|
46
|
+
"TOKEN_EXCHANGE_FAILED"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (!data.id_token) {
|
|
50
|
+
throw new OAuthError("Missing id_token in Microsoft token response", "INVALID_RESPONSE");
|
|
51
|
+
}
|
|
52
|
+
const claims = decodeMicrosoftClaims(data.id_token);
|
|
53
|
+
assertMicrosoftClaims(claims, config.clientId);
|
|
54
|
+
return {
|
|
55
|
+
access_token: data.id_token,
|
|
56
|
+
token_type: (_a = data.token_type) != null ? _a : "Bearer",
|
|
57
|
+
expires_in: data.expires_in,
|
|
58
|
+
refresh_token: data.refresh_token,
|
|
59
|
+
scope: data.scope
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async getUserInfo(idToken) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const claims = decodeMicrosoftClaims(idToken);
|
|
65
|
+
assertMicrosoftClaims(claims);
|
|
66
|
+
return {
|
|
67
|
+
id: claims.oid,
|
|
68
|
+
email: (_a = claims.email) != null ? _a : claims.preferred_username,
|
|
69
|
+
name: (_b = claims.name) != null ? _b : null,
|
|
70
|
+
image: null,
|
|
71
|
+
emailVerified: claims.email_verified === true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function decodeMicrosoftClaims(token) {
|
|
76
|
+
try {
|
|
77
|
+
return decodeJwt(token);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
throw new OAuthError("Invalid Microsoft id_token: malformed JWT", "INVALID_RESPONSE");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function assertMicrosoftClaims(claims, expectedAud) {
|
|
83
|
+
if (!claims.iss || !/^https:\/\/login\.microsoftonline\.com\/(?!common\/|consumers\/|organizations\/)[\w-]+\/v2\.0$/.test(claims.iss)) {
|
|
84
|
+
throw new OAuthError("Invalid Microsoft id_token: bad iss", "INVALID_RESPONSE");
|
|
85
|
+
}
|
|
86
|
+
if (expectedAud !== void 0 && claims.aud !== expectedAud) {
|
|
87
|
+
throw new OAuthError("Invalid Microsoft id_token: aud mismatch", "INVALID_RESPONSE");
|
|
88
|
+
}
|
|
89
|
+
if (!claims.exp || claims.exp < Math.floor(Date.now() / 1e3)) {
|
|
90
|
+
throw new OAuthError("Invalid Microsoft id_token: expired", "INVALID_RESPONSE");
|
|
91
|
+
}
|
|
92
|
+
if (!claims.oid) {
|
|
93
|
+
throw new OAuthError("Invalid Microsoft id_token: missing oid", "INVALID_RESPONSE");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
MicrosoftOAuthProvider
|
|
99
|
+
};
|
package/dist/constants/index.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ERROR_CODES,
|
|
3
|
-
HTTP_STATUS,
|
|
4
|
-
classifyError,
|
|
5
|
-
formatErrorMessage,
|
|
6
|
-
getAllErrorCodes,
|
|
7
|
-
getDefaultErrorMessage,
|
|
8
|
-
getErrorByCode,
|
|
9
|
-
getErrorCategory,
|
|
10
|
-
getErrorCodesByCategory,
|
|
11
|
-
getErrorInfo,
|
|
12
|
-
getHttpStatus,
|
|
13
|
-
getLogLevel
|
|
14
|
-
} from "../chunk-SNTLJ646.js";
|
|
15
1
|
import {
|
|
16
2
|
GENERIC_CONFIRM_MESSAGES,
|
|
17
3
|
GENERIC_ERROR_MESSAGES,
|
|
@@ -44,6 +30,20 @@ import {
|
|
|
44
30
|
URL,
|
|
45
31
|
USER_INPUT
|
|
46
32
|
} from "../chunk-LNV2E4I6.js";
|
|
33
|
+
import {
|
|
34
|
+
ERROR_CODES,
|
|
35
|
+
HTTP_STATUS,
|
|
36
|
+
classifyError,
|
|
37
|
+
formatErrorMessage,
|
|
38
|
+
getAllErrorCodes,
|
|
39
|
+
getDefaultErrorMessage,
|
|
40
|
+
getErrorByCode,
|
|
41
|
+
getErrorCategory,
|
|
42
|
+
getErrorCodesByCategory,
|
|
43
|
+
getErrorInfo,
|
|
44
|
+
getHttpStatus,
|
|
45
|
+
getLogLevel
|
|
46
|
+
} from "../chunk-SNTLJ646.js";
|
|
47
47
|
import "../chunk-ORMEWXMH.js";
|
|
48
48
|
export {
|
|
49
49
|
CSRF,
|
package/dist/utils/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
removeEventHandlers,
|
|
3
|
-
sanitizeArray,
|
|
4
|
-
sanitizeHtml,
|
|
5
|
-
sanitizeInput,
|
|
6
|
-
sanitizeObjectFields,
|
|
7
|
-
sanitizeUrl
|
|
8
|
-
} from "../chunk-N54KGJPU.js";
|
|
9
1
|
import {
|
|
10
2
|
isApiErrorResponse,
|
|
11
3
|
isApiSuccessResponse,
|
|
@@ -34,6 +26,14 @@ import {
|
|
|
34
26
|
isValidJSON,
|
|
35
27
|
isValidUrl
|
|
36
28
|
} from "../chunk-EUQATJLI.js";
|
|
29
|
+
import {
|
|
30
|
+
removeEventHandlers,
|
|
31
|
+
sanitizeArray,
|
|
32
|
+
sanitizeHtml,
|
|
33
|
+
sanitizeInput,
|
|
34
|
+
sanitizeObjectFields,
|
|
35
|
+
sanitizeUrl
|
|
36
|
+
} from "../chunk-N54KGJPU.js";
|
|
37
37
|
import {
|
|
38
38
|
createPaginatedResponse,
|
|
39
39
|
getReferer,
|
package/package.json
CHANGED
|
File without changes
|