@adonisjs/ally 6.1.0 → 6.3.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/build/{chunk-46TOMXWK.js → chunk-EXGR73T6.js} +6 -2
- package/build/{chunk-TFPW7D75.js → chunk-ISWHUP4Q.js} +1 -1
- package/build/{chunk-SBQAXPUK.js → chunk-STBND7WI.js} +6 -2
- package/build/chunk-TSIMPJ6I.js +119 -0
- package/build/config/ally.stub +2 -2
- package/build/index.js +28 -19
- package/build/providers/ally_provider.js +2 -2
- package/build/src/drivers/discord.js +2 -2
- package/build/src/drivers/facebook.js +2 -2
- package/build/src/drivers/github.js +2 -2
- package/build/src/drivers/google.js +2 -2
- package/build/src/drivers/linked_in.js +2 -2
- package/build/src/drivers/linked_in_openid_connect.d.ts +3 -3
- package/build/src/drivers/linked_in_openid_connect.js +3 -3
- package/build/src/drivers/spotify.js +2 -2
- package/build/src/drivers/twitter.js +2 -2
- package/build/src/drivers/twitter_x.js +2 -2
- package/build/src/errors.d.ts +163 -4
- package/package.json +20 -5
- package/build/chunk-6BP2DK5A.js +0 -43
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
E_OAUTH_MISSING_CODE,
|
|
6
6
|
E_OAUTH_STATE_MISMATCH
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TSIMPJ6I.js";
|
|
8
8
|
|
|
9
9
|
// src/abstract_drivers/oauth2.ts
|
|
10
10
|
import { Exception } from "@adonisjs/core/exceptions";
|
|
@@ -184,7 +184,11 @@ var Oauth2Driver = class extends Oauth2Client {
|
|
|
184
184
|
callback(request);
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
this.ctx.
|
|
187
|
+
if ("inertia" in this.ctx && this.ctx.inertia.requestInfo().isInertiaRequest) {
|
|
188
|
+
this.ctx.inertia.location(url);
|
|
189
|
+
} else {
|
|
190
|
+
this.ctx.response.redirect(url);
|
|
191
|
+
}
|
|
188
192
|
}
|
|
189
193
|
/**
|
|
190
194
|
* Check if the state parameter from the callback matches the state
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
E_OAUTH_MISSING_CODE,
|
|
6
6
|
E_OAUTH_STATE_MISMATCH
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TSIMPJ6I.js";
|
|
8
8
|
|
|
9
9
|
// src/abstract_drivers/oauth1.ts
|
|
10
10
|
import { Exception } from "@adonisjs/core/exceptions";
|
|
@@ -139,7 +139,11 @@ var Oauth1Driver = class extends Oauth1Client {
|
|
|
139
139
|
callback(request);
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
|
-
this.ctx.
|
|
142
|
+
if ("inertia" in this.ctx && this.ctx.inertia.requestInfo().isInertiaRequest) {
|
|
143
|
+
this.ctx.inertia.location(url);
|
|
144
|
+
} else {
|
|
145
|
+
this.ctx.response.redirect(url);
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
145
149
|
* Check if the OAuth token from the callback matches the token
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/errors.ts
|
|
8
|
+
var errors_exports = {};
|
|
9
|
+
__export(errors_exports, {
|
|
10
|
+
E_LOCAL_SIGNUP_DISALLOWED: () => E_LOCAL_SIGNUP_DISALLOWED,
|
|
11
|
+
E_OAUTH_MISSING_CODE: () => E_OAUTH_MISSING_CODE,
|
|
12
|
+
E_OAUTH_STATE_MISMATCH: () => E_OAUTH_STATE_MISMATCH,
|
|
13
|
+
E_UNKNOWN_ALLY_PROVIDER: () => E_UNKNOWN_ALLY_PROVIDER,
|
|
14
|
+
HttpResponseException: () => HttpResponseException
|
|
15
|
+
});
|
|
16
|
+
import { Exception } from "@adonisjs/core/exceptions";
|
|
17
|
+
var HttpResponseException = class extends Exception {
|
|
18
|
+
/**
|
|
19
|
+
* Returns the message to be sent in the HTTP response.
|
|
20
|
+
* Feel free to override this method and return a custom
|
|
21
|
+
* response.
|
|
22
|
+
*/
|
|
23
|
+
getResponseMessage(error, ctx) {
|
|
24
|
+
if ("i18n" in ctx) {
|
|
25
|
+
return ctx.i18n.t(error.identifier, {}, error.message);
|
|
26
|
+
}
|
|
27
|
+
return error.message;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts exception to an HTTP response
|
|
31
|
+
*/
|
|
32
|
+
async handle(error, ctx) {
|
|
33
|
+
const message = this.getResponseMessage(error, ctx);
|
|
34
|
+
switch (ctx.request.accepts(["html", "application/vnd.api+json", "json"])) {
|
|
35
|
+
case "html":
|
|
36
|
+
case null:
|
|
37
|
+
if (ctx.session) {
|
|
38
|
+
ctx.session.flash("error", message);
|
|
39
|
+
ctx.session.flashErrors({ [error.code]: message });
|
|
40
|
+
ctx.response.redirect().back();
|
|
41
|
+
} else {
|
|
42
|
+
ctx.response.status(error.status).send(message);
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case "json":
|
|
46
|
+
ctx.response.status(error.status).send({
|
|
47
|
+
errors: [
|
|
48
|
+
{
|
|
49
|
+
message
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
case "application/vnd.api+json":
|
|
55
|
+
ctx.response.status(error.status).send({
|
|
56
|
+
errors: [
|
|
57
|
+
{
|
|
58
|
+
code: error.code,
|
|
59
|
+
title: message
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var E_OAUTH_MISSING_CODE = class extends HttpResponseException {
|
|
68
|
+
static status = 500;
|
|
69
|
+
static code = "E_OAUTH_MISSING_CODE";
|
|
70
|
+
/**
|
|
71
|
+
* Translation identifier. Can be customized
|
|
72
|
+
*/
|
|
73
|
+
identifier = "errors.E_OAUTH_MISSING_CODE";
|
|
74
|
+
constructor(args, options) {
|
|
75
|
+
super(
|
|
76
|
+
`Cannot request access token. Redirect request is missing the "${args[0]}" param`,
|
|
77
|
+
options
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var E_OAUTH_STATE_MISMATCH = class extends HttpResponseException {
|
|
82
|
+
static status = 400;
|
|
83
|
+
static code = "E_OAUTH_STATE_MISMATCH";
|
|
84
|
+
static message = "Unable to verify re-redirect state";
|
|
85
|
+
/**
|
|
86
|
+
* Translation identifier. Can be customized
|
|
87
|
+
*/
|
|
88
|
+
identifier = "errors.E_OAUTH_STATE_MISMATCH";
|
|
89
|
+
};
|
|
90
|
+
var E_UNKNOWN_ALLY_PROVIDER = class extends HttpResponseException {
|
|
91
|
+
static status = 404;
|
|
92
|
+
static code = "E_UNKNOWN_ALLY_PROVIDER";
|
|
93
|
+
/**
|
|
94
|
+
* Translation identifier. Can be customized
|
|
95
|
+
*/
|
|
96
|
+
identifier = "errors.E_UNKNOWN_ALLY_PROVIDER";
|
|
97
|
+
constructor(args, options) {
|
|
98
|
+
super(`Unknown authentication provider "${args[0]}"`, options);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var E_LOCAL_SIGNUP_DISALLOWED = class extends HttpResponseException {
|
|
102
|
+
static status = 403;
|
|
103
|
+
static code = "E_LOCAL_SIGNUP_DISALLOWED";
|
|
104
|
+
/**
|
|
105
|
+
* Translation identifier. Can be customized
|
|
106
|
+
*/
|
|
107
|
+
identifier = "errors.E_LOCAL_SIGNUP_DISALLOWED";
|
|
108
|
+
constructor(args, options) {
|
|
109
|
+
super(`Cannot signup using "${args[0]}". Local signup is disabled for this provider`, options);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
E_OAUTH_MISSING_CODE,
|
|
115
|
+
E_OAUTH_STATE_MISMATCH,
|
|
116
|
+
E_UNKNOWN_ALLY_PROVIDER,
|
|
117
|
+
E_LOCAL_SIGNUP_DISALLOWED,
|
|
118
|
+
errors_exports
|
|
119
|
+
};
|
package/build/config/ally.stub
CHANGED
|
@@ -6,10 +6,10 @@ import { defineConfig, services } from '@adonisjs/ally'
|
|
|
6
6
|
|
|
7
7
|
const allyConfig = defineConfig({
|
|
8
8
|
{{#each providers as provider}}
|
|
9
|
-
{{provider.
|
|
9
|
+
{{provider.name}}: services.{{provider.provider}}({
|
|
10
10
|
clientId: env.get('{{provider.envPrefix}}_CLIENT_ID'),
|
|
11
11
|
clientSecret: env.get('{{provider.envPrefix}}_CLIENT_SECRET'),
|
|
12
|
-
callbackUrl: ''
|
|
12
|
+
callbackUrl: \`\${env.get('APP_URL')}/oauth/{{provider.name}}/callback\`,
|
|
13
13
|
}),
|
|
14
14
|
{{/each}}
|
|
15
15
|
})
|
package/build/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth1Driver
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-STBND7WI.js";
|
|
4
4
|
import {
|
|
5
5
|
AllyManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ISWHUP4Q.js";
|
|
7
7
|
import {
|
|
8
8
|
Oauth2Driver
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EXGR73T6.js";
|
|
10
10
|
import {
|
|
11
11
|
RedirectRequest
|
|
12
12
|
} from "./chunk-NK6X76EQ.js";
|
|
13
13
|
import {
|
|
14
14
|
errors_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TSIMPJ6I.js";
|
|
16
16
|
|
|
17
17
|
// index.ts
|
|
18
18
|
import { HttpClient } from "@poppinss/oauth-client";
|
|
@@ -22,14 +22,20 @@ var stubsRoot = import.meta.dirname;
|
|
|
22
22
|
|
|
23
23
|
// configure.ts
|
|
24
24
|
var AVAILABLE_PROVIDERS = [
|
|
25
|
-
"discord",
|
|
26
|
-
"facebook",
|
|
27
|
-
"github",
|
|
28
|
-
"google",
|
|
29
|
-
"linkedin",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
{ name: "discord", configKey: "discord", message: "Discord", envPrefix: "DISCORD" },
|
|
26
|
+
{ name: "facebook", configKey: "facebook", message: "Facebook", envPrefix: "FACEBOOK" },
|
|
27
|
+
{ name: "github", configKey: "github", message: "GitHub", envPrefix: "GITHUB" },
|
|
28
|
+
{ name: "google", configKey: "google", message: "Google", envPrefix: "GOOGLE" },
|
|
29
|
+
{ name: "linkedin", configKey: "linkedin", message: "LinkedIn", envPrefix: "LINKEDIN" },
|
|
30
|
+
{
|
|
31
|
+
name: "linkedinOpenidConnect",
|
|
32
|
+
configKey: "linkedin",
|
|
33
|
+
message: "LinkedIn (OpenID Connect)",
|
|
34
|
+
envPrefix: "LINKEDIN_OC"
|
|
35
|
+
},
|
|
36
|
+
{ name: "spotify", configKey: "spotify", message: "Spotify", envPrefix: "SPOTIFY" },
|
|
37
|
+
{ name: "twitter", configKey: "twitter", message: "Twitter", envPrefix: "TWITTER" },
|
|
38
|
+
{ name: "twitterX", configKey: "x", message: "Twitter X (OAuth2)", envPrefix: "TWITTER_X" }
|
|
33
39
|
];
|
|
34
40
|
async function configure(command) {
|
|
35
41
|
let selectedProviders = command.parsedFlags.providers;
|
|
@@ -44,17 +50,20 @@ async function configure(command) {
|
|
|
44
50
|
}
|
|
45
51
|
);
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
const unknownProvider =
|
|
53
|
+
const providerNames = typeof selectedProviders === "string" ? [selectedProviders] : selectedProviders;
|
|
54
|
+
const unknownProvider = providerNames.find(
|
|
55
|
+
(name) => !AVAILABLE_PROVIDERS.some((p) => p.name === name)
|
|
56
|
+
);
|
|
49
57
|
if (unknownProvider) {
|
|
50
58
|
command.exitCode = 1;
|
|
51
59
|
command.logger.error(`Invalid social provider "${unknownProvider}"`);
|
|
52
60
|
return;
|
|
53
61
|
}
|
|
62
|
+
const providers = providerNames.map((name) => AVAILABLE_PROVIDERS.find((p) => p.name === name));
|
|
54
63
|
const codemods = await command.createCodemods();
|
|
55
64
|
await codemods.makeUsingStub(stubsRoot, "config/ally.stub", {
|
|
56
65
|
providers: providers.map((provider) => {
|
|
57
|
-
return { provider, envPrefix: provider.
|
|
66
|
+
return { name: provider.configKey, provider: provider.name, envPrefix: provider.envPrefix };
|
|
58
67
|
})
|
|
59
68
|
});
|
|
60
69
|
await codemods.updateRcFile((rcFile) => {
|
|
@@ -62,15 +71,15 @@ async function configure(command) {
|
|
|
62
71
|
});
|
|
63
72
|
await codemods.defineEnvVariables(
|
|
64
73
|
providers.reduce((result, provider) => {
|
|
65
|
-
result[`${provider.
|
|
66
|
-
result[`${provider.
|
|
74
|
+
result[`${provider.envPrefix}_CLIENT_ID`] = "placeholder";
|
|
75
|
+
result[`${provider.envPrefix}_CLIENT_SECRET`] = "placeholder";
|
|
67
76
|
return result;
|
|
68
77
|
}, {})
|
|
69
78
|
);
|
|
70
79
|
await codemods.defineEnvValidations({
|
|
71
80
|
variables: providers.reduce((result, provider) => {
|
|
72
|
-
result[`${provider.
|
|
73
|
-
result[`${provider.
|
|
81
|
+
result[`${provider.envPrefix}_CLIENT_ID`] = "Env.schema.string()";
|
|
82
|
+
result[`${provider.envPrefix}_CLIENT_SECRET`] = "Env.schema.string()";
|
|
74
83
|
return result;
|
|
75
84
|
}, {}),
|
|
76
85
|
leadingComment: "Variables for configuring ally package"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/discord.ts
|
|
8
8
|
var DiscordDriver = class extends Oauth2Driver {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/facebook.ts
|
|
8
8
|
var FacebookDriver = class extends Oauth2Driver {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/github.ts
|
|
8
8
|
var GithubDriver = class extends Oauth2Driver {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/linked_in.ts
|
|
8
8
|
import { Exception } from "@adonisjs/core/exceptions";
|
|
@@ -106,7 +106,7 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
106
106
|
name: any;
|
|
107
107
|
avatarUrl: any;
|
|
108
108
|
email: any;
|
|
109
|
-
emailVerificationState: "
|
|
109
|
+
emailVerificationState: "verified" | "unverified";
|
|
110
110
|
original: any;
|
|
111
111
|
}>;
|
|
112
112
|
/**
|
|
@@ -138,7 +138,7 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
138
138
|
name: any;
|
|
139
139
|
avatarUrl: any;
|
|
140
140
|
email: any;
|
|
141
|
-
emailVerificationState: "
|
|
141
|
+
emailVerificationState: "verified" | "unverified";
|
|
142
142
|
original: any;
|
|
143
143
|
}>;
|
|
144
144
|
/**
|
|
@@ -163,7 +163,7 @@ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOp
|
|
|
163
163
|
name: any;
|
|
164
164
|
avatarUrl: any;
|
|
165
165
|
email: any;
|
|
166
|
-
emailVerificationState: "
|
|
166
|
+
emailVerificationState: "verified" | "unverified";
|
|
167
167
|
original: any;
|
|
168
168
|
}>;
|
|
169
169
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/linked_in_openid_connect.ts
|
|
8
8
|
var LinkedInOpenidConnectDriver = class extends Oauth2Driver {
|
|
@@ -96,7 +96,7 @@ var LinkedInOpenidConnectDriver = class extends Oauth2Driver {
|
|
|
96
96
|
name: body.family_name,
|
|
97
97
|
avatarUrl: body.picture,
|
|
98
98
|
email: body.email,
|
|
99
|
-
emailVerificationState: "
|
|
99
|
+
emailVerificationState: body.email_verified === true ? "verified" : "unverified",
|
|
100
100
|
original: body
|
|
101
101
|
};
|
|
102
102
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/spotify.ts
|
|
8
8
|
var SpotifyDriver = class extends Oauth2Driver {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth1Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-STBND7WI.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/twitter.ts
|
|
8
8
|
var TwitterDriver = class extends Oauth1Driver {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oauth2Driver
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EXGR73T6.js";
|
|
4
4
|
import "../../chunk-NK6X76EQ.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-TSIMPJ6I.js";
|
|
6
6
|
|
|
7
7
|
// src/drivers/twitter_x.ts
|
|
8
8
|
var TwitterXDriver = class extends Oauth2Driver {
|
package/build/src/errors.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { Exception } from '@adonisjs/core/exceptions';
|
|
2
|
+
import { type HttpContext } from '@adonisjs/core/http';
|
|
3
|
+
/**
|
|
4
|
+
* Base exception that self-handles by content-negotiating the
|
|
5
|
+
* HTTP response (HTML with session flash, JSON, JSONAPI)
|
|
6
|
+
* and supporting i18n translation.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class HttpResponseException extends Exception {
|
|
9
|
+
abstract identifier: string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the message to be sent in the HTTP response.
|
|
12
|
+
* Feel free to override this method and return a custom
|
|
13
|
+
* response.
|
|
14
|
+
*/
|
|
15
|
+
getResponseMessage(error: this, ctx: HttpContext): string;
|
|
16
|
+
/**
|
|
17
|
+
* Converts exception to an HTTP response
|
|
18
|
+
*/
|
|
19
|
+
handle(error: this, ctx: HttpContext): Promise<void>;
|
|
20
|
+
}
|
|
1
21
|
/**
|
|
2
22
|
* Error thrown when the OAuth redirect is missing the required
|
|
3
23
|
* authorization code or token parameter.
|
|
@@ -7,7 +27,41 @@
|
|
|
7
27
|
* throw new errors.E_OAUTH_MISSING_CODE(['code'])
|
|
8
28
|
* ```
|
|
9
29
|
*/
|
|
10
|
-
export declare const E_OAUTH_MISSING_CODE:
|
|
30
|
+
export declare const E_OAUTH_MISSING_CODE: {
|
|
31
|
+
new (args: [string], options?: ErrorOptions): {
|
|
32
|
+
/**
|
|
33
|
+
* Translation identifier. Can be customized
|
|
34
|
+
*/
|
|
35
|
+
identifier: string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the message to be sent in the HTTP response.
|
|
38
|
+
* Feel free to override this method and return a custom
|
|
39
|
+
* response.
|
|
40
|
+
*/
|
|
41
|
+
getResponseMessage(error: /*elided*/ any, ctx: HttpContext): string;
|
|
42
|
+
/**
|
|
43
|
+
* Converts exception to an HTTP response
|
|
44
|
+
*/
|
|
45
|
+
handle(error: /*elided*/ any, ctx: HttpContext): Promise<void>;
|
|
46
|
+
name: string;
|
|
47
|
+
help?: string;
|
|
48
|
+
code?: string;
|
|
49
|
+
status: number;
|
|
50
|
+
toString(): string;
|
|
51
|
+
get [Symbol.toStringTag](): string;
|
|
52
|
+
message: string;
|
|
53
|
+
stack?: string;
|
|
54
|
+
cause?: unknown;
|
|
55
|
+
};
|
|
56
|
+
status: number;
|
|
57
|
+
code: string;
|
|
58
|
+
help?: string;
|
|
59
|
+
message?: string;
|
|
60
|
+
isError(error: unknown): error is Error;
|
|
61
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
62
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
63
|
+
stackTraceLimit: number;
|
|
64
|
+
};
|
|
11
65
|
/**
|
|
12
66
|
* Error thrown when the OAuth state parameter does not match
|
|
13
67
|
* the expected value, indicating a potential CSRF attack.
|
|
@@ -17,7 +71,44 @@ export declare const E_OAUTH_MISSING_CODE: new (args: [string], options?: ErrorO
|
|
|
17
71
|
* throw new errors.E_OAUTH_STATE_MISMATCH()
|
|
18
72
|
* ```
|
|
19
73
|
*/
|
|
20
|
-
export declare const E_OAUTH_STATE_MISMATCH:
|
|
74
|
+
export declare const E_OAUTH_STATE_MISMATCH: {
|
|
75
|
+
new (message?: string, options?: ErrorOptions & {
|
|
76
|
+
code?: string;
|
|
77
|
+
status?: number;
|
|
78
|
+
}): {
|
|
79
|
+
/**
|
|
80
|
+
* Translation identifier. Can be customized
|
|
81
|
+
*/
|
|
82
|
+
identifier: string;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the message to be sent in the HTTP response.
|
|
85
|
+
* Feel free to override this method and return a custom
|
|
86
|
+
* response.
|
|
87
|
+
*/
|
|
88
|
+
getResponseMessage(error: /*elided*/ any, ctx: HttpContext): string;
|
|
89
|
+
/**
|
|
90
|
+
* Converts exception to an HTTP response
|
|
91
|
+
*/
|
|
92
|
+
handle(error: /*elided*/ any, ctx: HttpContext): Promise<void>;
|
|
93
|
+
name: string;
|
|
94
|
+
help?: string;
|
|
95
|
+
code?: string;
|
|
96
|
+
status: number;
|
|
97
|
+
toString(): string;
|
|
98
|
+
get [Symbol.toStringTag](): string;
|
|
99
|
+
message: string;
|
|
100
|
+
stack?: string;
|
|
101
|
+
cause?: unknown;
|
|
102
|
+
};
|
|
103
|
+
status: number;
|
|
104
|
+
code: string;
|
|
105
|
+
message: string;
|
|
106
|
+
help?: string;
|
|
107
|
+
isError(error: unknown): error is Error;
|
|
108
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
109
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
110
|
+
stackTraceLimit: number;
|
|
111
|
+
};
|
|
21
112
|
/**
|
|
22
113
|
* Error thrown when attempting to use an unknown Ally provider.
|
|
23
114
|
*
|
|
@@ -26,7 +117,41 @@ export declare const E_OAUTH_STATE_MISMATCH: new (args?: any, options?: ErrorOpt
|
|
|
26
117
|
* throw new errors.E_UNKNOWN_ALLY_PROVIDER(['github'])
|
|
27
118
|
* ```
|
|
28
119
|
*/
|
|
29
|
-
export declare const E_UNKNOWN_ALLY_PROVIDER:
|
|
120
|
+
export declare const E_UNKNOWN_ALLY_PROVIDER: {
|
|
121
|
+
new (args: [string], options?: ErrorOptions): {
|
|
122
|
+
/**
|
|
123
|
+
* Translation identifier. Can be customized
|
|
124
|
+
*/
|
|
125
|
+
identifier: string;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the message to be sent in the HTTP response.
|
|
128
|
+
* Feel free to override this method and return a custom
|
|
129
|
+
* response.
|
|
130
|
+
*/
|
|
131
|
+
getResponseMessage(error: /*elided*/ any, ctx: HttpContext): string;
|
|
132
|
+
/**
|
|
133
|
+
* Converts exception to an HTTP response
|
|
134
|
+
*/
|
|
135
|
+
handle(error: /*elided*/ any, ctx: HttpContext): Promise<void>;
|
|
136
|
+
name: string;
|
|
137
|
+
help?: string;
|
|
138
|
+
code?: string;
|
|
139
|
+
status: number;
|
|
140
|
+
toString(): string;
|
|
141
|
+
get [Symbol.toStringTag](): string;
|
|
142
|
+
message: string;
|
|
143
|
+
stack?: string;
|
|
144
|
+
cause?: unknown;
|
|
145
|
+
};
|
|
146
|
+
status: number;
|
|
147
|
+
code: string;
|
|
148
|
+
help?: string;
|
|
149
|
+
message?: string;
|
|
150
|
+
isError(error: unknown): error is Error;
|
|
151
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
152
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
153
|
+
stackTraceLimit: number;
|
|
154
|
+
};
|
|
30
155
|
/**
|
|
31
156
|
* Error thrown when a provider is used for signup but local signup
|
|
32
157
|
* is disabled for it.
|
|
@@ -36,4 +161,38 @@ export declare const E_UNKNOWN_ALLY_PROVIDER: new (args: [string], options?: Err
|
|
|
36
161
|
* throw new errors.E_LOCAL_SIGNUP_DISALLOWED(['github'])
|
|
37
162
|
* ```
|
|
38
163
|
*/
|
|
39
|
-
export declare const E_LOCAL_SIGNUP_DISALLOWED:
|
|
164
|
+
export declare const E_LOCAL_SIGNUP_DISALLOWED: {
|
|
165
|
+
new (args: [string], options?: ErrorOptions): {
|
|
166
|
+
/**
|
|
167
|
+
* Translation identifier. Can be customized
|
|
168
|
+
*/
|
|
169
|
+
identifier: string;
|
|
170
|
+
/**
|
|
171
|
+
* Returns the message to be sent in the HTTP response.
|
|
172
|
+
* Feel free to override this method and return a custom
|
|
173
|
+
* response.
|
|
174
|
+
*/
|
|
175
|
+
getResponseMessage(error: /*elided*/ any, ctx: HttpContext): string;
|
|
176
|
+
/**
|
|
177
|
+
* Converts exception to an HTTP response
|
|
178
|
+
*/
|
|
179
|
+
handle(error: /*elided*/ any, ctx: HttpContext): Promise<void>;
|
|
180
|
+
name: string;
|
|
181
|
+
help?: string;
|
|
182
|
+
code?: string;
|
|
183
|
+
status: number;
|
|
184
|
+
toString(): string;
|
|
185
|
+
get [Symbol.toStringTag](): string;
|
|
186
|
+
message: string;
|
|
187
|
+
stack?: string;
|
|
188
|
+
cause?: unknown;
|
|
189
|
+
};
|
|
190
|
+
status: number;
|
|
191
|
+
code: string;
|
|
192
|
+
help?: string;
|
|
193
|
+
message?: string;
|
|
194
|
+
isError(error: unknown): error is Error;
|
|
195
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
196
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
197
|
+
stackTraceLimit: number;
|
|
198
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/ally",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Social authentication provider for AdonisJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -40,9 +40,12 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@adonisjs/assembler": "^8.4.0",
|
|
43
|
-
"@adonisjs/core": "^7.3.
|
|
43
|
+
"@adonisjs/core": "^7.3.1",
|
|
44
44
|
"@adonisjs/eslint-config": "^3.0.0",
|
|
45
|
+
"@adonisjs/i18n": "^3.0.0",
|
|
46
|
+
"@adonisjs/inertia": "^4.2.0",
|
|
45
47
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
48
|
+
"@adonisjs/session": "^8.1.0",
|
|
46
49
|
"@adonisjs/tsconfig": "^2.0.0",
|
|
47
50
|
"@japa/assert": "^4.2.0",
|
|
48
51
|
"@japa/expect-type": "^2.0.4",
|
|
@@ -50,13 +53,13 @@
|
|
|
50
53
|
"@japa/runner": "^5.3.0",
|
|
51
54
|
"@poppinss/ts-exec": "^1.4.4",
|
|
52
55
|
"@release-it/conventional-changelog": "^10.0.6",
|
|
53
|
-
"@types/node": "^25.
|
|
56
|
+
"@types/node": "^25.6.0",
|
|
54
57
|
"c8": "^11.0.0",
|
|
55
58
|
"copyfiles": "^2.4.1",
|
|
56
59
|
"cross-env": "^10.1.0",
|
|
57
60
|
"del-cli": "^7.0.0",
|
|
58
61
|
"eslint": "^10.2.0",
|
|
59
|
-
"prettier": "^3.8.
|
|
62
|
+
"prettier": "^3.8.2",
|
|
60
63
|
"release-it": "^19.2.4",
|
|
61
64
|
"tsup": "^8.5.1",
|
|
62
65
|
"typescript": "^6.0.2"
|
|
@@ -65,12 +68,24 @@
|
|
|
65
68
|
"@poppinss/oauth-client": "^7.2.0"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
71
|
+
"@adonisjs/assembler": "^8.0.0",
|
|
68
72
|
"@adonisjs/core": "^7.0.0-next.8 || ^7.0.0",
|
|
69
|
-
"@adonisjs/
|
|
73
|
+
"@adonisjs/i18n": "^3.0.0",
|
|
74
|
+
"@adonisjs/session": "^8.0.0",
|
|
75
|
+
"@adonisjs/inertia": "^4.2.0"
|
|
70
76
|
},
|
|
71
77
|
"peerDependenciesMeta": {
|
|
72
78
|
"@adonisjs/assembler": {
|
|
73
79
|
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@adonisjs/i18n": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@adonisjs/session": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@adonisjs/inertia": {
|
|
88
|
+
"optional": true
|
|
74
89
|
}
|
|
75
90
|
},
|
|
76
91
|
"homepage": "https://github.com/adonisjs/ally#readme",
|
package/build/chunk-6BP2DK5A.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/errors.ts
|
|
8
|
-
var errors_exports = {};
|
|
9
|
-
__export(errors_exports, {
|
|
10
|
-
E_LOCAL_SIGNUP_DISALLOWED: () => E_LOCAL_SIGNUP_DISALLOWED,
|
|
11
|
-
E_OAUTH_MISSING_CODE: () => E_OAUTH_MISSING_CODE,
|
|
12
|
-
E_OAUTH_STATE_MISMATCH: () => E_OAUTH_STATE_MISMATCH,
|
|
13
|
-
E_UNKNOWN_ALLY_PROVIDER: () => E_UNKNOWN_ALLY_PROVIDER
|
|
14
|
-
});
|
|
15
|
-
import { createError } from "@adonisjs/core/exceptions";
|
|
16
|
-
var E_OAUTH_MISSING_CODE = createError(
|
|
17
|
-
'Cannot request access token. Redirect request is missing the "%s" param',
|
|
18
|
-
"E_OAUTH_MISSING_CODE",
|
|
19
|
-
500
|
|
20
|
-
);
|
|
21
|
-
var E_OAUTH_STATE_MISMATCH = createError(
|
|
22
|
-
"Unable to verify re-redirect state",
|
|
23
|
-
"E_OAUTH_STATE_MISMATCH",
|
|
24
|
-
400
|
|
25
|
-
);
|
|
26
|
-
var E_UNKNOWN_ALLY_PROVIDER = createError(
|
|
27
|
-
'Unknown ally provider "%s". Make sure it is registered inside the config/ally.ts file',
|
|
28
|
-
"E_UNKNOWN_ALLY_PROVIDER",
|
|
29
|
-
404
|
|
30
|
-
);
|
|
31
|
-
var E_LOCAL_SIGNUP_DISALLOWED = createError(
|
|
32
|
-
'Cannot use ally provider "%s" for signup. Local signup is disabled for this provider',
|
|
33
|
-
"E_LOCAL_SIGNUP_DISALLOWED",
|
|
34
|
-
403
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
E_OAUTH_MISSING_CODE,
|
|
39
|
-
E_OAUTH_STATE_MISMATCH,
|
|
40
|
-
E_UNKNOWN_ALLY_PROVIDER,
|
|
41
|
-
E_LOCAL_SIGNUP_DISALLOWED,
|
|
42
|
-
errors_exports
|
|
43
|
-
};
|