@adonisjs/ally 6.0.0 → 6.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 +2 -2
- package/build/{chunk-KWRXS6EG.js → chunk-4QTU45GZ.js} +33 -3
- package/build/{chunk-WM3V3APX.js → chunk-7V2EH7U6.js} +92 -15
- package/build/chunk-ISWHUP4Q.js +125 -0
- package/build/{chunk-KSJ4CFTC.js → chunk-NK6X76EQ.js} +16 -25
- package/build/chunk-TSIMPJ6I.js +119 -0
- package/build/index.js +90 -21
- package/build/providers/ally_provider.d.ts +10 -0
- package/build/providers/ally_provider.js +13 -2
- package/build/src/abstract_drivers/oauth1.d.ts +26 -0
- package/build/src/abstract_drivers/oauth2.d.ts +50 -2
- package/build/src/ally_manager.d.ts +67 -3
- package/build/src/define_config.d.ts +16 -1
- package/build/src/drivers/discord.d.ts +9 -0
- package/build/src/drivers/discord.js +13 -3
- package/build/src/drivers/facebook.d.ts +9 -0
- package/build/src/drivers/facebook.js +13 -3
- package/build/src/drivers/github.d.ts +12 -0
- package/build/src/drivers/github.js +17 -4
- package/build/src/drivers/google.d.ts +9 -0
- package/build/src/drivers/google.js +13 -3
- package/build/src/drivers/linked_in.d.ts +12 -0
- package/build/src/drivers/linked_in.js +16 -3
- package/build/src/drivers/linked_in_openid_connect.d.ts +14 -5
- package/build/src/drivers/linked_in_openid_connect.js +14 -5
- package/build/src/drivers/spotify.d.ts +11 -0
- package/build/src/drivers/spotify.js +15 -3
- package/build/src/drivers/twitter.d.ts +17 -0
- package/build/src/drivers/twitter.js +22 -3
- package/build/src/drivers/twitter_x.d.ts +137 -0
- package/build/src/drivers/twitter_x.js +169 -0
- package/build/src/errors.d.ts +190 -2
- package/build/src/redirect_request.d.ts +7 -0
- package/build/src/types.d.ts +150 -0
- package/package.json +19 -9
- package/build/chunk-MLKGABMK.js +0 -9
- package/build/chunk-SZ4YJCVU.js +0 -46
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
|
-
import type { AllyManagerDriverFactory } from './types.ts';
|
|
2
|
+
import type { AllyManagerDriverFactory, AllyManagerUseOptions } from './types.ts';
|
|
3
3
|
/**
|
|
4
4
|
* AllyManager is used to create and manage social authentication driver
|
|
5
5
|
* instances during an HTTP request. The drivers are cached during the
|
|
@@ -20,23 +20,87 @@ import type { AllyManagerDriverFactory } from './types.ts';
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class AllyManager<KnownSocialProviders extends Record<string, AllyManagerDriverFactory>> {
|
|
22
22
|
#private;
|
|
23
|
+
/**
|
|
24
|
+
* The configured provider factories available for the current application.
|
|
25
|
+
*/
|
|
23
26
|
config: KnownSocialProviders;
|
|
24
27
|
/**
|
|
28
|
+
* Create a new Ally manager for the current request.
|
|
29
|
+
*
|
|
25
30
|
* @param config - Map of provider names to driver factory functions
|
|
26
31
|
* @param ctx - The current HTTP context
|
|
27
32
|
*/
|
|
28
|
-
constructor(
|
|
33
|
+
constructor(
|
|
34
|
+
/**
|
|
35
|
+
* The configured provider factories available for the current application.
|
|
36
|
+
*/
|
|
37
|
+
config: KnownSocialProviders, ctx: HttpContext);
|
|
38
|
+
/**
|
|
39
|
+
* Find if a provider has been configured.
|
|
40
|
+
*
|
|
41
|
+
* @param provider - The provider name to check.
|
|
42
|
+
* @returns `true` when the provider exists in the manager config.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* if (ally.has(provider)) {
|
|
47
|
+
* await ally.use(provider).redirect()
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
has(provider: string): provider is Extract<keyof KnownSocialProviders, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Find if a provider allows local signup.
|
|
54
|
+
*
|
|
55
|
+
* @param provider - The configured provider name to inspect.
|
|
56
|
+
* @returns `true` when the provider does not opt out of local signup.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* if (ally.allowsLocalSignup('github')) {
|
|
61
|
+
* return ally.use('github', { intent: 'signup' }).redirect()
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
allowsLocalSignup(provider: keyof KnownSocialProviders & string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Returns configured provider names.
|
|
68
|
+
*
|
|
69
|
+
* @returns An array of configured provider names.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const providers = ally.configuredProviderNames()
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
configuredProviderNames(): Array<Extract<keyof KnownSocialProviders, string>>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns provider names that allow local signup.
|
|
79
|
+
*
|
|
80
|
+
* @returns An array of configured provider names that allow signup flows.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const signupProviders = ally.signupProviderNames()
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
signupProviderNames(): Array<Extract<keyof KnownSocialProviders, string>>;
|
|
29
88
|
/**
|
|
30
89
|
* Get a driver instance for the specified social provider. The driver
|
|
31
90
|
* instance is cached for the duration of the HTTP request.
|
|
32
91
|
*
|
|
33
92
|
* @param provider - The name of the social provider (e.g., 'github', 'google')
|
|
93
|
+
* @param options - Additional options used to qualify the provider usage.
|
|
94
|
+
* @returns The instantiated social authentication driver.
|
|
34
95
|
*
|
|
35
96
|
* @example
|
|
36
97
|
* ```ts
|
|
37
98
|
* const github = ally.use('github')
|
|
38
99
|
* await github.redirect()
|
|
100
|
+
*
|
|
101
|
+
* const signupDriver = ally.use('github', { intent: 'signup' })
|
|
102
|
+
* await signupDriver.redirect()
|
|
39
103
|
* ```
|
|
40
104
|
*/
|
|
41
|
-
use<SocialProvider extends keyof KnownSocialProviders>(provider: SocialProvider): ReturnType<KnownSocialProviders[SocialProvider]>;
|
|
105
|
+
use<SocialProvider extends keyof KnownSocialProviders>(provider: SocialProvider, options?: AllyManagerUseOptions): ReturnType<KnownSocialProviders[SocialProvider]>;
|
|
42
106
|
}
|
|
@@ -4,14 +4,17 @@ import type { GoogleDriver } from './drivers/google.ts';
|
|
|
4
4
|
import type { GithubDriver } from './drivers/github.ts';
|
|
5
5
|
import type { SpotifyDriver } from './drivers/spotify.ts';
|
|
6
6
|
import type { TwitterDriver } from './drivers/twitter.ts';
|
|
7
|
+
import type { TwitterXDriver } from './drivers/twitter_x.ts';
|
|
7
8
|
import type { DiscordDriver } from './drivers/discord.ts';
|
|
8
9
|
import type { FacebookDriver } from './drivers/facebook.ts';
|
|
9
10
|
import type { LinkedInDriver } from './drivers/linked_in.ts';
|
|
10
11
|
import type { LinkedInOpenidConnectDriver } from './drivers/linked_in_openid_connect.ts';
|
|
11
|
-
import type { GoogleDriverConfig, GithubDriverConfig, SpotifyDriverConfig, DiscordDriverConfig, TwitterDriverConfig, LinkedInDriverConfig, LinkedInOpenidConnectDriverConfig, FacebookDriverConfig, AllyManagerDriverFactory } from './types.ts';
|
|
12
|
+
import type { GoogleDriverConfig, GithubDriverConfig, SpotifyDriverConfig, DiscordDriverConfig, TwitterDriverConfig, TwitterXDriverConfig, LinkedInDriverConfig, LinkedInOpenidConnectDriverConfig, FacebookDriverConfig, AllyManagerDriverFactory } from './types.ts';
|
|
12
13
|
/**
|
|
13
14
|
* Shape of config after it has been resolved from
|
|
14
15
|
* the config provider
|
|
16
|
+
*
|
|
17
|
+
* Maps config providers to their resolved driver factory values.
|
|
15
18
|
*/
|
|
16
19
|
type ResolvedConfig<KnownSocialProviders extends Record<string, AllyManagerDriverFactory | ConfigProvider<AllyManagerDriverFactory>>> = {
|
|
17
20
|
[K in keyof KnownSocialProviders]: KnownSocialProviders[K] extends ConfigProvider<infer A> ? A : KnownSocialProviders[K];
|
|
@@ -22,6 +25,7 @@ type ResolvedConfig<KnownSocialProviders extends Record<string, AllyManagerDrive
|
|
|
22
25
|
* functions or config providers.
|
|
23
26
|
*
|
|
24
27
|
* @param config - An object mapping provider names to driver factories
|
|
28
|
+
* @returns A config provider that resolves all registered providers.
|
|
25
29
|
*
|
|
26
30
|
* @example
|
|
27
31
|
* ```ts
|
|
@@ -47,6 +51,16 @@ export declare function defineConfig<KnownSocialProviders extends Record<string,
|
|
|
47
51
|
*
|
|
48
52
|
* @example
|
|
49
53
|
* ```ts
|
|
54
|
+
* const github = services.github({
|
|
55
|
+
* clientId: env.get('GITHUB_CLIENT_ID'),
|
|
56
|
+
* clientSecret: env.get('GITHUB_CLIENT_SECRET'),
|
|
57
|
+
* callbackUrl: 'http://localhost:3333/github/callback',
|
|
58
|
+
* disallowLocalSignup: true,
|
|
59
|
+
* })
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
50
64
|
* export default defineConfig({
|
|
51
65
|
* github: services.github({
|
|
52
66
|
* clientId: env.get('GITHUB_CLIENT_ID'),
|
|
@@ -66,5 +80,6 @@ export declare const services: {
|
|
|
66
80
|
linkedinOpenidConnect: (config: LinkedInOpenidConnectDriverConfig) => ConfigProvider<(ctx: HttpContext) => LinkedInOpenidConnectDriver>;
|
|
67
81
|
spotify: (config: SpotifyDriverConfig) => ConfigProvider<(ctx: HttpContext) => SpotifyDriver>;
|
|
68
82
|
twitter: (config: TwitterDriverConfig) => ConfigProvider<(ctx: HttpContext) => TwitterDriver>;
|
|
83
|
+
twitterX: (config: TwitterXDriverConfig) => ConfigProvider<(ctx: HttpContext) => TwitterXDriver>;
|
|
69
84
|
};
|
|
70
85
|
export {};
|
|
@@ -36,8 +36,17 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class DiscordDriver extends Oauth2Driver<DiscordToken, DiscordScopes> {
|
|
38
38
|
config: DiscordDriverConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Discord token endpoint URL.
|
|
41
|
+
*/
|
|
39
42
|
protected accessTokenUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* Discord authorization endpoint URL.
|
|
45
|
+
*/
|
|
40
46
|
protected authorizeUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* Discord user profile endpoint URL.
|
|
49
|
+
*/
|
|
41
50
|
protected userInfoUrl: string;
|
|
42
51
|
/**
|
|
43
52
|
* The param name for the authorization code
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/discord.ts
|
|
8
8
|
var DiscordDriver = class extends Oauth2Driver {
|
|
@@ -15,8 +15,18 @@ var DiscordDriver = class extends Oauth2Driver {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
18
|
+
config;
|
|
19
|
+
/**
|
|
20
|
+
* Discord token endpoint URL.
|
|
21
|
+
*/
|
|
18
22
|
accessTokenUrl = "https://discord.com/api/oauth2/token";
|
|
23
|
+
/**
|
|
24
|
+
* Discord authorization endpoint URL.
|
|
25
|
+
*/
|
|
19
26
|
authorizeUrl = "https://discord.com/oauth2/authorize";
|
|
27
|
+
/**
|
|
28
|
+
* Discord user profile endpoint URL.
|
|
29
|
+
*/
|
|
20
30
|
userInfoUrl = "https://discord.com/api/users/@me";
|
|
21
31
|
/**
|
|
22
32
|
* The param name for the authorization code
|
|
@@ -36,8 +36,17 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class FacebookDriver extends Oauth2Driver<FacebookToken, FacebookScopes> {
|
|
38
38
|
config: FacebookDriverConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Facebook token endpoint URL.
|
|
41
|
+
*/
|
|
39
42
|
protected accessTokenUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* Facebook authorization endpoint URL.
|
|
45
|
+
*/
|
|
40
46
|
protected authorizeUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* Facebook profile endpoint URL.
|
|
49
|
+
*/
|
|
41
50
|
protected userInfoUrl: string;
|
|
42
51
|
/**
|
|
43
52
|
* The default set of fields to query for the user request
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/facebook.ts
|
|
8
8
|
var FacebookDriver = class extends Oauth2Driver {
|
|
@@ -15,8 +15,18 @@ var FacebookDriver = class extends Oauth2Driver {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
18
|
+
config;
|
|
19
|
+
/**
|
|
20
|
+
* Facebook token endpoint URL.
|
|
21
|
+
*/
|
|
18
22
|
accessTokenUrl = "https://graph.facebook.com/v10.0/oauth/access_token";
|
|
23
|
+
/**
|
|
24
|
+
* Facebook authorization endpoint URL.
|
|
25
|
+
*/
|
|
19
26
|
authorizeUrl = "https://www.facebook.com/v10.0/dialog/oauth";
|
|
27
|
+
/**
|
|
28
|
+
* Facebook profile endpoint URL.
|
|
29
|
+
*/
|
|
20
30
|
userInfoUrl = "https://graph.facebook.com/v10.0/me";
|
|
21
31
|
/**
|
|
22
32
|
* The default set of fields to query for the user request
|
|
@@ -36,9 +36,21 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class GithubDriver extends Oauth2Driver<GithubToken, GithubScopes> {
|
|
38
38
|
config: GithubDriverConfig;
|
|
39
|
+
/**
|
|
40
|
+
* GitHub token endpoint URL.
|
|
41
|
+
*/
|
|
39
42
|
protected accessTokenUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* GitHub authorization endpoint URL.
|
|
45
|
+
*/
|
|
40
46
|
protected authorizeUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* GitHub profile endpoint URL.
|
|
49
|
+
*/
|
|
41
50
|
protected userInfoUrl: string;
|
|
51
|
+
/**
|
|
52
|
+
* GitHub email endpoint URL.
|
|
53
|
+
*/
|
|
42
54
|
protected userEmailUrl: string;
|
|
43
55
|
/**
|
|
44
56
|
* The param name for the authorization code
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/github.ts
|
|
8
8
|
var GithubDriver = class extends Oauth2Driver {
|
|
@@ -15,9 +15,22 @@ var GithubDriver = class extends Oauth2Driver {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
18
|
+
config;
|
|
19
|
+
/**
|
|
20
|
+
* GitHub token endpoint URL.
|
|
21
|
+
*/
|
|
18
22
|
accessTokenUrl = "https://github.com/login/oauth/access_token";
|
|
23
|
+
/**
|
|
24
|
+
* GitHub authorization endpoint URL.
|
|
25
|
+
*/
|
|
19
26
|
authorizeUrl = "https://github.com/login/oauth/authorize";
|
|
27
|
+
/**
|
|
28
|
+
* GitHub profile endpoint URL.
|
|
29
|
+
*/
|
|
20
30
|
userInfoUrl = "https://api.github.com/user";
|
|
31
|
+
/**
|
|
32
|
+
* GitHub email endpoint URL.
|
|
33
|
+
*/
|
|
21
34
|
userEmailUrl = "https://api.github.com/user/emails";
|
|
22
35
|
/**
|
|
23
36
|
* The param name for the authorization code
|
|
@@ -137,7 +150,7 @@ var GithubDriver = class extends Oauth2Driver {
|
|
|
137
150
|
}
|
|
138
151
|
return mainEmail;
|
|
139
152
|
} catch (error) {
|
|
140
|
-
if (error && error.response && error.response.statusCode === 404) {
|
|
153
|
+
if (error && typeof error === "object" && "response" in error && error.response && typeof error.response === "object" && "statusCode" in error.response && error.response.statusCode === 404) {
|
|
141
154
|
return;
|
|
142
155
|
}
|
|
143
156
|
throw error;
|
|
@@ -37,8 +37,17 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
37
37
|
*/
|
|
38
38
|
export declare class GoogleDriver extends Oauth2Driver<GoogleToken, GoogleScopes> {
|
|
39
39
|
config: GoogleDriverConfig;
|
|
40
|
+
/**
|
|
41
|
+
* Google token endpoint URL.
|
|
42
|
+
*/
|
|
40
43
|
protected accessTokenUrl: string;
|
|
44
|
+
/**
|
|
45
|
+
* Google authorization endpoint URL.
|
|
46
|
+
*/
|
|
41
47
|
protected authorizeUrl: string;
|
|
48
|
+
/**
|
|
49
|
+
* Google user profile endpoint URL.
|
|
50
|
+
*/
|
|
42
51
|
protected userInfoUrl: string;
|
|
43
52
|
/**
|
|
44
53
|
* The param name for the authorization code
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/google.ts
|
|
8
8
|
var SCOPE_PREFIXES = {
|
|
@@ -52,8 +52,18 @@ var GoogleDriver = class extends Oauth2Driver {
|
|
|
52
52
|
this.config = config;
|
|
53
53
|
this.loadState();
|
|
54
54
|
}
|
|
55
|
+
config;
|
|
56
|
+
/**
|
|
57
|
+
* Google token endpoint URL.
|
|
58
|
+
*/
|
|
55
59
|
accessTokenUrl = "https://oauth2.googleapis.com/token";
|
|
60
|
+
/**
|
|
61
|
+
* Google authorization endpoint URL.
|
|
62
|
+
*/
|
|
56
63
|
authorizeUrl = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
64
|
+
/**
|
|
65
|
+
* Google user profile endpoint URL.
|
|
66
|
+
*/
|
|
57
67
|
userInfoUrl = "https://www.googleapis.com/oauth2/v3/userinfo";
|
|
58
68
|
/**
|
|
59
69
|
* The param name for the authorization code
|
|
@@ -37,9 +37,21 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
37
37
|
*/
|
|
38
38
|
export declare class LinkedInDriver extends Oauth2Driver<LinkedInToken, LinkedInScopes> {
|
|
39
39
|
config: LinkedInDriverConfig;
|
|
40
|
+
/**
|
|
41
|
+
* LinkedIn token endpoint URL.
|
|
42
|
+
*/
|
|
40
43
|
protected accessTokenUrl: string;
|
|
44
|
+
/**
|
|
45
|
+
* LinkedIn authorization endpoint URL.
|
|
46
|
+
*/
|
|
41
47
|
protected authorizeUrl: string;
|
|
48
|
+
/**
|
|
49
|
+
* LinkedIn profile endpoint URL.
|
|
50
|
+
*/
|
|
42
51
|
protected userInfoUrl: string;
|
|
52
|
+
/**
|
|
53
|
+
* LinkedIn email endpoint URL.
|
|
54
|
+
*/
|
|
43
55
|
protected userEmailUrl: string;
|
|
44
56
|
/**
|
|
45
57
|
* The param name for the authorization code
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/linked_in.ts
|
|
8
8
|
import { Exception } from "@adonisjs/core/exceptions";
|
|
@@ -16,9 +16,22 @@ var LinkedInDriver = class extends Oauth2Driver {
|
|
|
16
16
|
this.config = config;
|
|
17
17
|
this.loadState();
|
|
18
18
|
}
|
|
19
|
+
config;
|
|
20
|
+
/**
|
|
21
|
+
* LinkedIn token endpoint URL.
|
|
22
|
+
*/
|
|
19
23
|
accessTokenUrl = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
24
|
+
/**
|
|
25
|
+
* LinkedIn authorization endpoint URL.
|
|
26
|
+
*/
|
|
20
27
|
authorizeUrl = "https://www.linkedin.com/oauth/v2/authorization";
|
|
28
|
+
/**
|
|
29
|
+
* LinkedIn profile endpoint URL.
|
|
30
|
+
*/
|
|
21
31
|
userInfoUrl = "https://api.linkedin.com/v2/me";
|
|
32
|
+
/**
|
|
33
|
+
* LinkedIn email endpoint URL.
|
|
34
|
+
*/
|
|
22
35
|
userEmailUrl = "https://api.linkedin.com/v2/clientAwareMemberHandles";
|
|
23
36
|
/**
|
|
24
37
|
* The param name for the authorization code
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
2
|
import type { HttpClient } from '@poppinss/oauth-client';
|
|
3
3
|
import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
4
|
-
import type { ApiRequestContract, LinkedInOpenidConnectAccessToken, LinkedInOpenidConnectDriverConfig, LinkedInOpenidConnectScopes, RedirectRequestContract } from '../types.ts';
|
|
4
|
+
import type { ApiRequestContract, LinkedInOpenidConnectAccessToken, LinkedInOpenidConnectDriverConfig, LinkedInOpenidConnectScopes, Oauth2AccessToken, RedirectRequestContract } from '../types.ts';
|
|
5
5
|
/**
|
|
6
6
|
* LinkedIn OpenID Connect OAuth2 driver for authenticating users via LinkedIn.
|
|
7
7
|
* This driver uses the OpenID Connect protocol for authentication.
|
|
@@ -37,8 +37,17 @@ import type { ApiRequestContract, LinkedInOpenidConnectAccessToken, LinkedInOpen
|
|
|
37
37
|
*/
|
|
38
38
|
export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOpenidConnectAccessToken, LinkedInOpenidConnectScopes> {
|
|
39
39
|
config: LinkedInOpenidConnectDriverConfig;
|
|
40
|
+
/**
|
|
41
|
+
* LinkedIn OpenID authorization endpoint URL.
|
|
42
|
+
*/
|
|
40
43
|
protected authorizeUrl: string;
|
|
44
|
+
/**
|
|
45
|
+
* LinkedIn OpenID token endpoint URL.
|
|
46
|
+
*/
|
|
41
47
|
protected accessTokenUrl: string;
|
|
48
|
+
/**
|
|
49
|
+
* LinkedIn OpenID userinfo endpoint URL.
|
|
50
|
+
*/
|
|
42
51
|
protected userInfoUrl: string;
|
|
43
52
|
/**
|
|
44
53
|
* The param name for the authorization code
|
|
@@ -97,7 +106,7 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
97
106
|
name: any;
|
|
98
107
|
avatarUrl: any;
|
|
99
108
|
email: any;
|
|
100
|
-
emailVerificationState: "
|
|
109
|
+
emailVerificationState: "unsupported";
|
|
101
110
|
original: any;
|
|
102
111
|
}>;
|
|
103
112
|
/**
|
|
@@ -122,14 +131,14 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
122
131
|
token: string;
|
|
123
132
|
type: "bearer";
|
|
124
133
|
expiresIn: number;
|
|
125
|
-
expiresAt: Exclude<
|
|
134
|
+
expiresAt: Exclude<Oauth2AccessToken["expiresAt"], undefined>;
|
|
126
135
|
};
|
|
127
136
|
id: any;
|
|
128
137
|
nickName: any;
|
|
129
138
|
name: any;
|
|
130
139
|
avatarUrl: any;
|
|
131
140
|
email: any;
|
|
132
|
-
emailVerificationState: "
|
|
141
|
+
emailVerificationState: "unsupported";
|
|
133
142
|
original: any;
|
|
134
143
|
}>;
|
|
135
144
|
/**
|
|
@@ -154,7 +163,7 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
154
163
|
name: any;
|
|
155
164
|
avatarUrl: any;
|
|
156
165
|
email: any;
|
|
157
|
-
emailVerificationState: "
|
|
166
|
+
emailVerificationState: "unsupported";
|
|
158
167
|
original: any;
|
|
159
168
|
}>;
|
|
160
169
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/linked_in_openid_connect.ts
|
|
8
8
|
var LinkedInOpenidConnectDriver = class extends Oauth2Driver {
|
|
@@ -15,8 +15,18 @@ var LinkedInOpenidConnectDriver = class extends Oauth2Driver {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
18
|
+
config;
|
|
19
|
+
/**
|
|
20
|
+
* LinkedIn OpenID authorization endpoint URL.
|
|
21
|
+
*/
|
|
18
22
|
authorizeUrl = "https://www.linkedin.com/oauth/v2/authorization";
|
|
23
|
+
/**
|
|
24
|
+
* LinkedIn OpenID token endpoint URL.
|
|
25
|
+
*/
|
|
19
26
|
accessTokenUrl = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
27
|
+
/**
|
|
28
|
+
* LinkedIn OpenID userinfo endpoint URL.
|
|
29
|
+
*/
|
|
20
30
|
userInfoUrl = "https://api.linkedin.com/v2/userinfo";
|
|
21
31
|
/**
|
|
22
32
|
* The param name for the authorization code
|
|
@@ -80,14 +90,13 @@ var LinkedInOpenidConnectDriver = class extends Oauth2Driver {
|
|
|
80
90
|
callback(request);
|
|
81
91
|
}
|
|
82
92
|
const body = await request.get();
|
|
83
|
-
const emailVerificationState = body.email_verified ? "verified" : "unverified";
|
|
84
93
|
return {
|
|
85
94
|
id: body.sub,
|
|
86
95
|
nickName: body.given_name,
|
|
87
96
|
name: body.family_name,
|
|
88
97
|
avatarUrl: body.picture,
|
|
89
98
|
email: body.email,
|
|
90
|
-
emailVerificationState,
|
|
99
|
+
emailVerificationState: "unsupported",
|
|
91
100
|
original: body
|
|
92
101
|
};
|
|
93
102
|
}
|
|
@@ -36,8 +36,17 @@ import { Oauth2Driver } from '../abstract_drivers/oauth2.ts';
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class SpotifyDriver extends Oauth2Driver<SpotifyToken, SpotifyScopes> {
|
|
38
38
|
config: SpotifyDriverConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Spotify token endpoint URL.
|
|
41
|
+
*/
|
|
39
42
|
protected accessTokenUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* Spotify authorization endpoint URL.
|
|
45
|
+
*/
|
|
40
46
|
protected authorizeUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* Spotify profile endpoint URL.
|
|
49
|
+
*/
|
|
41
50
|
protected userInfoUrl: string;
|
|
42
51
|
/**
|
|
43
52
|
* The param name for the authorization code
|
|
@@ -104,6 +113,8 @@ export declare class SpotifyDriver extends Oauth2Driver<SpotifyToken, SpotifySco
|
|
|
104
113
|
/**
|
|
105
114
|
* Check if the error from the callback indicates that the user
|
|
106
115
|
* denied authorization.
|
|
116
|
+
*
|
|
117
|
+
* @returns `true` when the provider reported an access-denied error.
|
|
107
118
|
*/
|
|
108
119
|
accessDenied(): boolean;
|
|
109
120
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-7V2EH7U6.js";
|
|
4
|
+
import "../../chunk-NK6X76EQ.js";
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/spotify.ts
|
|
8
8
|
var SpotifyDriver = class extends Oauth2Driver {
|
|
@@ -15,8 +15,18 @@ var SpotifyDriver = class extends Oauth2Driver {
|
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
18
|
+
config;
|
|
19
|
+
/**
|
|
20
|
+
* Spotify token endpoint URL.
|
|
21
|
+
*/
|
|
18
22
|
accessTokenUrl = "https://accounts.spotify.com/api/token";
|
|
23
|
+
/**
|
|
24
|
+
* Spotify authorization endpoint URL.
|
|
25
|
+
*/
|
|
19
26
|
authorizeUrl = "https://accounts.spotify.com/authorize";
|
|
27
|
+
/**
|
|
28
|
+
* Spotify profile endpoint URL.
|
|
29
|
+
*/
|
|
20
30
|
userInfoUrl = "https://api.spotify.com/v1/me";
|
|
21
31
|
/**
|
|
22
32
|
* The param name for the authorization code
|
|
@@ -98,6 +108,8 @@ var SpotifyDriver = class extends Oauth2Driver {
|
|
|
98
108
|
/**
|
|
99
109
|
* Check if the error from the callback indicates that the user
|
|
100
110
|
* denied authorization.
|
|
111
|
+
*
|
|
112
|
+
* @returns `true` when the provider reported an access-denied error.
|
|
101
113
|
*/
|
|
102
114
|
accessDenied() {
|
|
103
115
|
const error = this.getError();
|
|
@@ -35,9 +35,21 @@ import { Oauth1Driver } from '../abstract_drivers/oauth1.ts';
|
|
|
35
35
|
export declare class TwitterDriver extends Oauth1Driver<TwitterToken, string> {
|
|
36
36
|
protected ctx: HttpContext;
|
|
37
37
|
config: TwitterDriverConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Twitter request-token endpoint URL.
|
|
40
|
+
*/
|
|
38
41
|
protected requestTokenUrl: string;
|
|
42
|
+
/**
|
|
43
|
+
* Twitter authorization endpoint URL.
|
|
44
|
+
*/
|
|
39
45
|
protected authorizeUrl: string;
|
|
46
|
+
/**
|
|
47
|
+
* Twitter access-token endpoint URL.
|
|
48
|
+
*/
|
|
40
49
|
protected accessTokenUrl: string;
|
|
50
|
+
/**
|
|
51
|
+
* Twitter profile endpoint URL.
|
|
52
|
+
*/
|
|
41
53
|
protected userInfoUrl: string;
|
|
42
54
|
/**
|
|
43
55
|
* The query string param name for the error.
|
|
@@ -65,6 +77,9 @@ export declare class TwitterDriver extends Oauth1Driver<TwitterToken, string> {
|
|
|
65
77
|
* Twitter doesn't support scopes
|
|
66
78
|
*/
|
|
67
79
|
protected scopeParamName: string;
|
|
80
|
+
/**
|
|
81
|
+
* Scope separator placeholder maintained for OAuth1 compatibility.
|
|
82
|
+
*/
|
|
68
83
|
protected scopesSeparator: string;
|
|
69
84
|
/**
|
|
70
85
|
* @param ctx - The HTTP context
|
|
@@ -131,6 +146,8 @@ export declare class TwitterDriver extends Oauth1Driver<TwitterToken, string> {
|
|
|
131
146
|
/**
|
|
132
147
|
* Check if the error from the callback indicates that the user
|
|
133
148
|
* denied authorization.
|
|
149
|
+
*
|
|
150
|
+
* @returns `true` when the request contains the denial marker.
|
|
134
151
|
*/
|
|
135
152
|
accessDenied(): boolean;
|
|
136
153
|
}
|