@morojs/moro 1.1.0 → 1.2.0
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 +56 -1
- package/dist/core/auth/morojs-adapter.d.ts +94 -0
- package/dist/core/auth/morojs-adapter.js +288 -0
- package/dist/core/auth/morojs-adapter.js.map +1 -0
- package/dist/core/http/http-server.d.ts +2 -0
- package/dist/core/http/http-server.js +52 -9
- package/dist/core/http/http-server.js.map +1 -1
- package/dist/core/middleware/built-in/auth-helpers.d.ts +124 -0
- package/dist/core/middleware/built-in/auth-helpers.js +338 -0
- package/dist/core/middleware/built-in/auth-helpers.js.map +1 -0
- package/dist/core/middleware/built-in/auth-providers.d.ts +125 -0
- package/dist/core/middleware/built-in/auth-providers.js +394 -0
- package/dist/core/middleware/built-in/auth-providers.js.map +1 -0
- package/dist/core/middleware/built-in/auth.d.ts +29 -1
- package/dist/core/middleware/built-in/auth.js +259 -16
- package/dist/core/middleware/built-in/auth.js.map +1 -1
- package/dist/core/middleware/built-in/index.d.ts +3 -1
- package/dist/core/middleware/built-in/index.js +19 -1
- package/dist/core/middleware/built-in/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/moro.d.ts +1 -0
- package/dist/moro.js +19 -1
- package/dist/moro.js.map +1 -1
- package/dist/types/auth.d.ts +367 -0
- package/dist/types/auth.js +28 -0
- package/dist/types/auth.js.map +1 -0
- package/package.json +6 -2
- package/src/core/auth/README.md +339 -0
- package/src/core/auth/morojs-adapter.ts +402 -0
- package/src/core/http/http-server.ts +61 -10
- package/src/core/middleware/built-in/auth-helpers.ts +401 -0
- package/src/core/middleware/built-in/auth-providers.ts +480 -0
- package/src/core/middleware/built-in/auth.ts +306 -16
- package/src/core/middleware/built-in/index.ts +22 -0
- package/src/index.ts +26 -0
- package/src/moro.ts +29 -1
- package/src/types/auth.ts +440 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { AuthProvider } from '../../../types/auth';
|
|
2
|
+
/**
|
|
3
|
+
* Popular OAuth Providers for Auth.js
|
|
4
|
+
* These extend the basic providers with more options and popular services
|
|
5
|
+
*/
|
|
6
|
+
export declare const extendedProviders: {
|
|
7
|
+
github: (options: {
|
|
8
|
+
clientId: string;
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
scope?: string;
|
|
11
|
+
allowSignup?: boolean;
|
|
12
|
+
}) => AuthProvider;
|
|
13
|
+
google: (options: {
|
|
14
|
+
clientId: string;
|
|
15
|
+
clientSecret: string;
|
|
16
|
+
scope?: string;
|
|
17
|
+
hostedDomain?: string;
|
|
18
|
+
}) => AuthProvider;
|
|
19
|
+
microsoft: (options: {
|
|
20
|
+
clientId: string;
|
|
21
|
+
clientSecret: string;
|
|
22
|
+
tenant?: string;
|
|
23
|
+
scope?: string;
|
|
24
|
+
}) => AuthProvider;
|
|
25
|
+
apple: (options: {
|
|
26
|
+
clientId: string;
|
|
27
|
+
clientSecret: string;
|
|
28
|
+
scope?: string;
|
|
29
|
+
}) => AuthProvider;
|
|
30
|
+
linkedin: (options: {
|
|
31
|
+
clientId: string;
|
|
32
|
+
clientSecret: string;
|
|
33
|
+
scope?: string;
|
|
34
|
+
}) => AuthProvider;
|
|
35
|
+
facebook: (options: {
|
|
36
|
+
clientId: string;
|
|
37
|
+
clientSecret: string;
|
|
38
|
+
scope?: string;
|
|
39
|
+
}) => AuthProvider;
|
|
40
|
+
twitter: (options: {
|
|
41
|
+
clientId: string;
|
|
42
|
+
clientSecret: string;
|
|
43
|
+
version?: "1.0a" | "2.0";
|
|
44
|
+
}) => AuthProvider;
|
|
45
|
+
slack: (options: {
|
|
46
|
+
clientId: string;
|
|
47
|
+
clientSecret: string;
|
|
48
|
+
scope?: string;
|
|
49
|
+
}) => AuthProvider;
|
|
50
|
+
gitlab: (options: {
|
|
51
|
+
clientId: string;
|
|
52
|
+
clientSecret: string;
|
|
53
|
+
domain?: string;
|
|
54
|
+
scope?: string;
|
|
55
|
+
}) => AuthProvider;
|
|
56
|
+
spotify: (options: {
|
|
57
|
+
clientId: string;
|
|
58
|
+
clientSecret: string;
|
|
59
|
+
scope?: string;
|
|
60
|
+
}) => AuthProvider;
|
|
61
|
+
twitch: (options: {
|
|
62
|
+
clientId: string;
|
|
63
|
+
clientSecret: string;
|
|
64
|
+
scope?: string;
|
|
65
|
+
}) => AuthProvider;
|
|
66
|
+
notion: (options: {
|
|
67
|
+
clientId: string;
|
|
68
|
+
clientSecret: string;
|
|
69
|
+
}) => AuthProvider;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Enterprise/SAML providers
|
|
73
|
+
*/
|
|
74
|
+
export declare const enterpriseProviders: {
|
|
75
|
+
saml: (options: {
|
|
76
|
+
name: string;
|
|
77
|
+
entryPoint: string;
|
|
78
|
+
issuer: string;
|
|
79
|
+
cert: string;
|
|
80
|
+
callbackUrl?: string;
|
|
81
|
+
}) => AuthProvider;
|
|
82
|
+
okta: (options: {
|
|
83
|
+
clientId: string;
|
|
84
|
+
clientSecret: string;
|
|
85
|
+
domain: string;
|
|
86
|
+
authorizationServerId?: string;
|
|
87
|
+
}) => AuthProvider;
|
|
88
|
+
auth0: (options: {
|
|
89
|
+
clientId: string;
|
|
90
|
+
clientSecret: string;
|
|
91
|
+
domain: string;
|
|
92
|
+
audience?: string;
|
|
93
|
+
}) => AuthProvider;
|
|
94
|
+
cognito: (options: {
|
|
95
|
+
clientId: string;
|
|
96
|
+
clientSecret: string;
|
|
97
|
+
domain: string;
|
|
98
|
+
region?: string;
|
|
99
|
+
}) => AuthProvider;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Helper function to create custom OAuth provider
|
|
103
|
+
*/
|
|
104
|
+
export declare function createCustomOAuthProvider(config: {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
clientId: string;
|
|
108
|
+
clientSecret: string;
|
|
109
|
+
authorizationUrl: string;
|
|
110
|
+
tokenUrl: string;
|
|
111
|
+
userinfoUrl: string;
|
|
112
|
+
scope?: string;
|
|
113
|
+
profileMapper?: (profile: any) => any;
|
|
114
|
+
}): AuthProvider;
|
|
115
|
+
/**
|
|
116
|
+
* Helper function to create custom OIDC provider
|
|
117
|
+
*/
|
|
118
|
+
export declare function createCustomOIDCProvider(config: {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
clientId: string;
|
|
122
|
+
clientSecret: string;
|
|
123
|
+
issuer: string;
|
|
124
|
+
profileMapper?: (profile: any) => any;
|
|
125
|
+
}): AuthProvider;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enterpriseProviders = exports.extendedProviders = void 0;
|
|
4
|
+
exports.createCustomOAuthProvider = createCustomOAuthProvider;
|
|
5
|
+
exports.createCustomOIDCProvider = createCustomOIDCProvider;
|
|
6
|
+
/**
|
|
7
|
+
* Popular OAuth Providers for Auth.js
|
|
8
|
+
* These extend the basic providers with more options and popular services
|
|
9
|
+
*/
|
|
10
|
+
exports.extendedProviders = {
|
|
11
|
+
// Enhanced GitHub provider with more options
|
|
12
|
+
github: (options) => ({
|
|
13
|
+
id: 'github',
|
|
14
|
+
name: 'GitHub',
|
|
15
|
+
type: 'oauth',
|
|
16
|
+
authorization: {
|
|
17
|
+
url: 'https://github.com/login/oauth/authorize',
|
|
18
|
+
params: {
|
|
19
|
+
scope: options.scope || 'read:user user:email',
|
|
20
|
+
allow_signup: options.allowSignup ?? true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
token: 'https://github.com/login/oauth/access_token',
|
|
24
|
+
userinfo: 'https://api.github.com/user',
|
|
25
|
+
clientId: options.clientId,
|
|
26
|
+
clientSecret: options.clientSecret,
|
|
27
|
+
profile: profile => ({
|
|
28
|
+
id: profile.id.toString(),
|
|
29
|
+
name: profile.name || profile.login,
|
|
30
|
+
email: profile.email,
|
|
31
|
+
image: profile.avatar_url,
|
|
32
|
+
username: profile.login,
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
// Enhanced Google provider
|
|
36
|
+
google: (options) => ({
|
|
37
|
+
id: 'google',
|
|
38
|
+
name: 'Google',
|
|
39
|
+
type: 'oauth',
|
|
40
|
+
authorization: {
|
|
41
|
+
url: 'https://accounts.google.com/oauth/authorize',
|
|
42
|
+
params: {
|
|
43
|
+
scope: options.scope || 'openid email profile',
|
|
44
|
+
response_type: 'code',
|
|
45
|
+
...(options.hostedDomain && { hd: options.hostedDomain }),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
token: 'https://oauth2.googleapis.com/token',
|
|
49
|
+
userinfo: 'https://www.googleapis.com/oauth2/v2/userinfo',
|
|
50
|
+
clientId: options.clientId,
|
|
51
|
+
clientSecret: options.clientSecret,
|
|
52
|
+
profile: profile => ({
|
|
53
|
+
id: profile.id,
|
|
54
|
+
name: profile.name,
|
|
55
|
+
email: profile.email,
|
|
56
|
+
image: profile.picture,
|
|
57
|
+
emailVerified: profile.verified_email,
|
|
58
|
+
}),
|
|
59
|
+
}),
|
|
60
|
+
// Microsoft/Azure AD provider
|
|
61
|
+
microsoft: (options) => ({
|
|
62
|
+
id: 'microsoft',
|
|
63
|
+
name: 'Microsoft',
|
|
64
|
+
type: 'oauth',
|
|
65
|
+
authorization: {
|
|
66
|
+
url: `https://login.microsoftonline.com/${options.tenant || 'common'}/oauth2/v2.0/authorize`,
|
|
67
|
+
params: {
|
|
68
|
+
scope: options.scope || 'openid email profile',
|
|
69
|
+
response_type: 'code',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
token: `https://login.microsoftonline.com/${options.tenant || 'common'}/oauth2/v2.0/token`,
|
|
73
|
+
userinfo: 'https://graph.microsoft.com/oidc/userinfo',
|
|
74
|
+
clientId: options.clientId,
|
|
75
|
+
clientSecret: options.clientSecret,
|
|
76
|
+
profile: profile => ({
|
|
77
|
+
id: profile.sub,
|
|
78
|
+
name: profile.name,
|
|
79
|
+
email: profile.email,
|
|
80
|
+
image: profile.picture,
|
|
81
|
+
}),
|
|
82
|
+
}),
|
|
83
|
+
// Apple provider
|
|
84
|
+
apple: (options) => ({
|
|
85
|
+
id: 'apple',
|
|
86
|
+
name: 'Apple',
|
|
87
|
+
type: 'oauth',
|
|
88
|
+
authorization: {
|
|
89
|
+
url: 'https://appleid.apple.com/auth/authorize',
|
|
90
|
+
params: {
|
|
91
|
+
scope: options.scope || 'name email',
|
|
92
|
+
response_mode: 'form_post',
|
|
93
|
+
response_type: 'code',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
token: 'https://appleid.apple.com/auth/token',
|
|
97
|
+
clientId: options.clientId,
|
|
98
|
+
clientSecret: options.clientSecret,
|
|
99
|
+
profile: (profile, tokens) => ({
|
|
100
|
+
id: profile.sub,
|
|
101
|
+
name: profile.name ? `${profile.name.firstName} ${profile.name.lastName}` : null,
|
|
102
|
+
email: profile.email,
|
|
103
|
+
emailVerified: profile.email_verified === 'true',
|
|
104
|
+
}),
|
|
105
|
+
}),
|
|
106
|
+
// LinkedIn provider
|
|
107
|
+
linkedin: (options) => ({
|
|
108
|
+
id: 'linkedin',
|
|
109
|
+
name: 'LinkedIn',
|
|
110
|
+
type: 'oauth',
|
|
111
|
+
authorization: {
|
|
112
|
+
url: 'https://www.linkedin.com/oauth/v2/authorization',
|
|
113
|
+
params: {
|
|
114
|
+
scope: options.scope || 'r_liteprofile r_emailaddress',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
token: 'https://www.linkedin.com/oauth/v2/accessToken',
|
|
118
|
+
userinfo: 'https://api.linkedin.com/v2/me',
|
|
119
|
+
clientId: options.clientId,
|
|
120
|
+
clientSecret: options.clientSecret,
|
|
121
|
+
profile: profile => ({
|
|
122
|
+
id: profile.id,
|
|
123
|
+
name: `${profile.localizedFirstName} ${profile.localizedLastName}`,
|
|
124
|
+
email: profile.emailAddress,
|
|
125
|
+
image: profile.profilePicture?.['displayImage~']?.elements?.[0]?.identifiers?.[0]?.identifier,
|
|
126
|
+
}),
|
|
127
|
+
}),
|
|
128
|
+
// Facebook provider
|
|
129
|
+
facebook: (options) => ({
|
|
130
|
+
id: 'facebook',
|
|
131
|
+
name: 'Facebook',
|
|
132
|
+
type: 'oauth',
|
|
133
|
+
authorization: {
|
|
134
|
+
url: 'https://www.facebook.com/v18.0/dialog/oauth',
|
|
135
|
+
params: {
|
|
136
|
+
scope: options.scope || 'email public_profile',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
token: 'https://graph.facebook.com/v18.0/oauth/access_token',
|
|
140
|
+
userinfo: 'https://graph.facebook.com/me?fields=id,name,email,picture',
|
|
141
|
+
clientId: options.clientId,
|
|
142
|
+
clientSecret: options.clientSecret,
|
|
143
|
+
profile: profile => ({
|
|
144
|
+
id: profile.id,
|
|
145
|
+
name: profile.name,
|
|
146
|
+
email: profile.email,
|
|
147
|
+
image: profile.picture?.data?.url,
|
|
148
|
+
}),
|
|
149
|
+
}),
|
|
150
|
+
// Twitter/X provider
|
|
151
|
+
twitter: (options) => ({
|
|
152
|
+
id: 'twitter',
|
|
153
|
+
name: 'Twitter',
|
|
154
|
+
type: 'oauth',
|
|
155
|
+
authorization: 'https://twitter.com/i/oauth2/authorize',
|
|
156
|
+
token: 'https://api.twitter.com/2/oauth2/token',
|
|
157
|
+
userinfo: 'https://api.twitter.com/2/users/me',
|
|
158
|
+
clientId: options.clientId,
|
|
159
|
+
clientSecret: options.clientSecret,
|
|
160
|
+
profile: profile => ({
|
|
161
|
+
id: profile.data.id,
|
|
162
|
+
name: profile.data.name,
|
|
163
|
+
username: profile.data.username,
|
|
164
|
+
image: profile.data.profile_image_url,
|
|
165
|
+
}),
|
|
166
|
+
}),
|
|
167
|
+
// Slack provider
|
|
168
|
+
slack: (options) => ({
|
|
169
|
+
id: 'slack',
|
|
170
|
+
name: 'Slack',
|
|
171
|
+
type: 'oauth',
|
|
172
|
+
authorization: {
|
|
173
|
+
url: 'https://slack.com/oauth/v2/authorize',
|
|
174
|
+
params: {
|
|
175
|
+
user_scope: options.scope || 'identity.basic identity.email identity.avatar',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
token: 'https://slack.com/api/oauth.v2.access',
|
|
179
|
+
userinfo: 'https://slack.com/api/users.identity',
|
|
180
|
+
clientId: options.clientId,
|
|
181
|
+
clientSecret: options.clientSecret,
|
|
182
|
+
profile: profile => ({
|
|
183
|
+
id: profile.user.id,
|
|
184
|
+
name: profile.user.name,
|
|
185
|
+
email: profile.user.email,
|
|
186
|
+
image: profile.user.image_192,
|
|
187
|
+
}),
|
|
188
|
+
}),
|
|
189
|
+
// GitLab provider
|
|
190
|
+
gitlab: (options) => ({
|
|
191
|
+
id: 'gitlab',
|
|
192
|
+
name: 'GitLab',
|
|
193
|
+
type: 'oauth',
|
|
194
|
+
authorization: {
|
|
195
|
+
url: `${options.domain || 'https://gitlab.com'}/oauth/authorize`,
|
|
196
|
+
params: {
|
|
197
|
+
scope: options.scope || 'read_user',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
token: `${options.domain || 'https://gitlab.com'}/oauth/token`,
|
|
201
|
+
userinfo: `${options.domain || 'https://gitlab.com'}/api/v4/user`,
|
|
202
|
+
clientId: options.clientId,
|
|
203
|
+
clientSecret: options.clientSecret,
|
|
204
|
+
profile: profile => ({
|
|
205
|
+
id: profile.id.toString(),
|
|
206
|
+
name: profile.name,
|
|
207
|
+
email: profile.email,
|
|
208
|
+
image: profile.avatar_url,
|
|
209
|
+
username: profile.username,
|
|
210
|
+
}),
|
|
211
|
+
}),
|
|
212
|
+
// Spotify provider
|
|
213
|
+
spotify: (options) => ({
|
|
214
|
+
id: 'spotify',
|
|
215
|
+
name: 'Spotify',
|
|
216
|
+
type: 'oauth',
|
|
217
|
+
authorization: {
|
|
218
|
+
url: 'https://accounts.spotify.com/authorize',
|
|
219
|
+
params: {
|
|
220
|
+
scope: options.scope || 'user-read-email user-read-private',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
token: 'https://accounts.spotify.com/api/token',
|
|
224
|
+
userinfo: 'https://api.spotify.com/v1/me',
|
|
225
|
+
clientId: options.clientId,
|
|
226
|
+
clientSecret: options.clientSecret,
|
|
227
|
+
profile: profile => ({
|
|
228
|
+
id: profile.id,
|
|
229
|
+
name: profile.display_name,
|
|
230
|
+
email: profile.email,
|
|
231
|
+
image: profile.images?.[0]?.url,
|
|
232
|
+
}),
|
|
233
|
+
}),
|
|
234
|
+
// Twitch provider
|
|
235
|
+
twitch: (options) => ({
|
|
236
|
+
id: 'twitch',
|
|
237
|
+
name: 'Twitch',
|
|
238
|
+
type: 'oauth',
|
|
239
|
+
authorization: {
|
|
240
|
+
url: 'https://id.twitch.tv/oauth2/authorize',
|
|
241
|
+
params: {
|
|
242
|
+
scope: options.scope || 'user:read:email',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
token: 'https://id.twitch.tv/oauth2/token',
|
|
246
|
+
userinfo: 'https://api.twitch.tv/helix/users',
|
|
247
|
+
clientId: options.clientId,
|
|
248
|
+
clientSecret: options.clientSecret,
|
|
249
|
+
profile: profile => ({
|
|
250
|
+
id: profile.data[0].id,
|
|
251
|
+
name: profile.data[0].display_name,
|
|
252
|
+
email: profile.data[0].email,
|
|
253
|
+
image: profile.data[0].profile_image_url,
|
|
254
|
+
username: profile.data[0].login,
|
|
255
|
+
}),
|
|
256
|
+
}),
|
|
257
|
+
// Notion provider
|
|
258
|
+
notion: (options) => ({
|
|
259
|
+
id: 'notion',
|
|
260
|
+
name: 'Notion',
|
|
261
|
+
type: 'oauth',
|
|
262
|
+
authorization: 'https://api.notion.com/v1/oauth/authorize',
|
|
263
|
+
token: 'https://api.notion.com/v1/oauth/token',
|
|
264
|
+
userinfo: 'https://api.notion.com/v1/users/me',
|
|
265
|
+
clientId: options.clientId,
|
|
266
|
+
clientSecret: options.clientSecret,
|
|
267
|
+
profile: profile => ({
|
|
268
|
+
id: profile.id,
|
|
269
|
+
name: profile.name,
|
|
270
|
+
email: profile.person?.email,
|
|
271
|
+
image: profile.avatar_url,
|
|
272
|
+
}),
|
|
273
|
+
}),
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Enterprise/SAML providers
|
|
277
|
+
*/
|
|
278
|
+
exports.enterpriseProviders = {
|
|
279
|
+
// Generic SAML provider
|
|
280
|
+
saml: (options) => ({
|
|
281
|
+
id: 'saml',
|
|
282
|
+
name: options.name,
|
|
283
|
+
type: 'oauth',
|
|
284
|
+
authorization: options.entryPoint,
|
|
285
|
+
clientId: options.issuer,
|
|
286
|
+
// SAML-specific configuration would go here
|
|
287
|
+
entryPoint: options.entryPoint,
|
|
288
|
+
issuer: options.issuer,
|
|
289
|
+
cert: options.cert,
|
|
290
|
+
callbackUrl: options.callbackUrl,
|
|
291
|
+
}),
|
|
292
|
+
// Okta provider
|
|
293
|
+
okta: (options) => ({
|
|
294
|
+
id: 'okta',
|
|
295
|
+
name: 'Okta',
|
|
296
|
+
type: 'oidc',
|
|
297
|
+
issuer: `${options.domain}/oauth2/${options.authorizationServerId || 'default'}`,
|
|
298
|
+
clientId: options.clientId,
|
|
299
|
+
clientSecret: options.clientSecret,
|
|
300
|
+
profile: profile => ({
|
|
301
|
+
id: profile.sub,
|
|
302
|
+
name: profile.name,
|
|
303
|
+
email: profile.email,
|
|
304
|
+
username: profile.preferred_username,
|
|
305
|
+
}),
|
|
306
|
+
}),
|
|
307
|
+
// Auth0 provider
|
|
308
|
+
auth0: (options) => ({
|
|
309
|
+
id: 'auth0',
|
|
310
|
+
name: 'Auth0',
|
|
311
|
+
type: 'oidc',
|
|
312
|
+
issuer: `https://${options.domain}`,
|
|
313
|
+
clientId: options.clientId,
|
|
314
|
+
clientSecret: options.clientSecret,
|
|
315
|
+
authorization: {
|
|
316
|
+
url: `https://${options.domain}/authorize`,
|
|
317
|
+
params: {
|
|
318
|
+
audience: options.audience,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
profile: profile => ({
|
|
322
|
+
id: profile.sub,
|
|
323
|
+
name: profile.name,
|
|
324
|
+
email: profile.email,
|
|
325
|
+
image: profile.picture,
|
|
326
|
+
emailVerified: profile.email_verified,
|
|
327
|
+
}),
|
|
328
|
+
}),
|
|
329
|
+
// AWS Cognito provider
|
|
330
|
+
cognito: (options) => ({
|
|
331
|
+
id: 'cognito',
|
|
332
|
+
name: 'AWS Cognito',
|
|
333
|
+
type: 'oidc',
|
|
334
|
+
issuer: `https://cognito-idp.${options.region || 'us-east-1'}.amazonaws.com/${options.domain}`,
|
|
335
|
+
clientId: options.clientId,
|
|
336
|
+
clientSecret: options.clientSecret,
|
|
337
|
+
profile: profile => ({
|
|
338
|
+
id: profile.sub,
|
|
339
|
+
name: profile.name,
|
|
340
|
+
email: profile.email,
|
|
341
|
+
username: profile['cognito:username'],
|
|
342
|
+
emailVerified: profile.email_verified,
|
|
343
|
+
}),
|
|
344
|
+
}),
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Helper function to create custom OAuth provider
|
|
348
|
+
*/
|
|
349
|
+
function createCustomOAuthProvider(config) {
|
|
350
|
+
return {
|
|
351
|
+
id: config.id,
|
|
352
|
+
name: config.name,
|
|
353
|
+
type: 'oauth',
|
|
354
|
+
authorization: {
|
|
355
|
+
url: config.authorizationUrl,
|
|
356
|
+
params: {
|
|
357
|
+
scope: config.scope || 'openid email profile',
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
token: config.tokenUrl,
|
|
361
|
+
userinfo: config.userinfoUrl,
|
|
362
|
+
clientId: config.clientId,
|
|
363
|
+
clientSecret: config.clientSecret,
|
|
364
|
+
profile: config.profileMapper ||
|
|
365
|
+
(profile => ({
|
|
366
|
+
id: profile.id || profile.sub,
|
|
367
|
+
name: profile.name,
|
|
368
|
+
email: profile.email,
|
|
369
|
+
image: profile.picture || profile.avatar_url,
|
|
370
|
+
})),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Helper function to create custom OIDC provider
|
|
375
|
+
*/
|
|
376
|
+
function createCustomOIDCProvider(config) {
|
|
377
|
+
return {
|
|
378
|
+
id: config.id,
|
|
379
|
+
name: config.name,
|
|
380
|
+
type: 'oidc',
|
|
381
|
+
issuer: config.issuer,
|
|
382
|
+
clientId: config.clientId,
|
|
383
|
+
clientSecret: config.clientSecret,
|
|
384
|
+
profile: config.profileMapper ||
|
|
385
|
+
(profile => ({
|
|
386
|
+
id: profile.sub,
|
|
387
|
+
name: profile.name,
|
|
388
|
+
email: profile.email,
|
|
389
|
+
image: profile.picture,
|
|
390
|
+
emailVerified: profile.email_verified,
|
|
391
|
+
})),
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=auth-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-providers.js","sourceRoot":"","sources":["../../../../src/core/middleware/built-in/auth-providers.ts"],"names":[],"mappings":";;;AA+ZA,8DAkCC;AAKD,4DAyBC;AA5dD;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B,6CAA6C;IAC7C,MAAM,EAAE,CAAC,OAKR,EAAgB,EAAE,CAAC,CAAC;QACnB,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,OAAgB;QACtB,aAAa,EAAE;YACb,GAAG,EAAE,0CAA0C;YAC/C,MAAM,EAAE;gBACN,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,sBAAsB;gBAC9C,YAAY,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;aAC1C;SACF;QACD,KAAK,EAAE,6CAA6C;QACpD,QAAQ,EAAE,6BAA6B;QACvC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YACnB,EAAE,EAAE,OAAO,CAA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,MAAM,CAAC,YAAY;QACjC,OAAO,EACL,MAAM,CAAC,aAAa;YACpB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBACX,EAAE,EAAE,OAAO,CAAC,GAAG;gBACf,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,KAAK,EAAE,OAAO,CAAC,OAAO;gBACtB,aAAa,EAAE,OAAO,CAAC,cAAc;aACtC,CAAC,CAAC;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
import { MiddlewareInterface } from '../../../types/hooks';
|
|
2
|
-
|
|
2
|
+
import { AuthOptions, AuthProvider } from '../../../types/auth';
|
|
3
|
+
export declare const providers: {
|
|
4
|
+
google: (options: {
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
}) => AuthProvider;
|
|
8
|
+
github: (options: {
|
|
9
|
+
clientId: string;
|
|
10
|
+
clientSecret: string;
|
|
11
|
+
}) => AuthProvider;
|
|
12
|
+
discord: (options: {
|
|
13
|
+
clientId: string;
|
|
14
|
+
clientSecret: string;
|
|
15
|
+
}) => AuthProvider;
|
|
16
|
+
credentials: (options: {
|
|
17
|
+
name?: string;
|
|
18
|
+
credentials: Record<string, any>;
|
|
19
|
+
authorize: (credentials: any) => Promise<any>;
|
|
20
|
+
}) => AuthProvider;
|
|
21
|
+
email: (options: {
|
|
22
|
+
server: string | {
|
|
23
|
+
host: string;
|
|
24
|
+
port: number;
|
|
25
|
+
auth: any;
|
|
26
|
+
};
|
|
27
|
+
from: string;
|
|
28
|
+
}) => AuthProvider;
|
|
29
|
+
};
|
|
30
|
+
export declare const auth: (options: AuthOptions) => MiddlewareInterface;
|