alp-node-auth 9.1.0 → 9.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/CHANGELOG.md +24 -0
- package/package.json +19 -12
- package/src/.eslintrc.json +2 -0
- package/strategies/.eslintrc.json +3 -0
- package/strategies/dropbox.js +28 -0
- package/strategies/facebook.js +28 -0
- package/strategies/foursquare.js +28 -0
- package/strategies/github.js +28 -0
- package/strategies/google.js +29 -0
- package/strategies/slack.js +28 -0
- package/strategies/strategies.d.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.3.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@9.2.0...alp-node-auth@9.3.0) (2024-01-06)
|
|
7
|
+
|
|
8
|
+
Note: no notable changes
|
|
9
|
+
|
|
10
|
+
Version bump for dependency: alp-node
|
|
11
|
+
Version bump for dependency: alp-router
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [9.2.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@9.1.0...alp-node-auth@9.2.0) (2024-01-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **deps:** update dependency liwi-mongo to v11 ([#465](https://github.com/christophehurpeau/alp/issues/465)) ([f8c4804](https://github.com/christophehurpeau/alp/commit/f8c4804621cf179e4155a18121f5a8d4f144b11e))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* add missing strategies in files ([119028e](https://github.com/christophehurpeau/alp/commit/119028e54c83c3fc391458cc1c454f7244f15ca1))
|
|
25
|
+
|
|
26
|
+
Version bump for dependency: alp-node
|
|
27
|
+
Version bump for dependency: alp-router
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [9.1.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@9.0.1...alp-node-auth@9.1.0) (2023-12-25)
|
|
7
31
|
|
|
8
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alp-node-auth",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "authentication with alp",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alp"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=18.12.0"
|
|
19
19
|
},
|
|
20
|
+
"sideEffects": false,
|
|
20
21
|
"main": "./dist/index-node18.mjs",
|
|
21
22
|
"types": "./dist/definitions/index.d.ts",
|
|
22
23
|
"typesVersions": {
|
|
@@ -59,10 +60,10 @@
|
|
|
59
60
|
"default": "./strategies/slack.js"
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
|
-
"sideEffects": false,
|
|
63
63
|
"files": [
|
|
64
64
|
"src",
|
|
65
|
-
"dist"
|
|
65
|
+
"dist",
|
|
66
|
+
"strategies"
|
|
66
67
|
],
|
|
67
68
|
"scripts": {
|
|
68
69
|
"build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
|
|
@@ -73,7 +74,6 @@
|
|
|
73
74
|
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/alp-node-auth",
|
|
74
75
|
"watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
|
|
75
76
|
},
|
|
76
|
-
"prettier": "@pob/root/prettier-config",
|
|
77
77
|
"pob": {
|
|
78
78
|
"babelEnvs": [
|
|
79
79
|
{
|
|
@@ -86,35 +86,42 @@
|
|
|
86
86
|
],
|
|
87
87
|
"extraEntries": [
|
|
88
88
|
{
|
|
89
|
+
"directory": "strategies",
|
|
89
90
|
"name": "strategies/dropbox",
|
|
90
91
|
"types": "strategies/strategies.d.ts"
|
|
91
92
|
},
|
|
92
93
|
{
|
|
94
|
+
"directory": "strategies",
|
|
93
95
|
"name": "strategies/facebook",
|
|
94
96
|
"types": "strategies/strategies.d.ts"
|
|
95
97
|
},
|
|
96
98
|
{
|
|
99
|
+
"directory": "strategies",
|
|
97
100
|
"name": "strategies/foursquare",
|
|
98
101
|
"types": "strategies/strategies.d.ts"
|
|
99
102
|
},
|
|
100
103
|
{
|
|
104
|
+
"directory": "strategies",
|
|
101
105
|
"name": "strategies/github",
|
|
102
106
|
"types": "strategies/strategies.d.ts"
|
|
103
107
|
},
|
|
104
108
|
{
|
|
109
|
+
"directory": "strategies",
|
|
105
110
|
"name": "strategies/google",
|
|
106
111
|
"types": "strategies/strategies.d.ts"
|
|
107
112
|
},
|
|
108
113
|
{
|
|
114
|
+
"directory": "strategies",
|
|
109
115
|
"name": "strategies/slack",
|
|
110
116
|
"types": "strategies/strategies.d.ts"
|
|
111
117
|
}
|
|
112
118
|
]
|
|
113
119
|
},
|
|
120
|
+
"prettier": "@pob/root/prettier-config",
|
|
114
121
|
"peerDependencies": {
|
|
115
|
-
"alp-node": "^6.
|
|
116
|
-
"alp-router": "^7.
|
|
117
|
-
"liwi-mongo": "^
|
|
122
|
+
"alp-node": "^6.1.1",
|
|
123
|
+
"alp-router": "^7.1.1",
|
|
124
|
+
"liwi-mongo": "^11.0.0",
|
|
118
125
|
"router-segments": "^9.1.0"
|
|
119
126
|
},
|
|
120
127
|
"dependencies": {
|
|
@@ -127,11 +134,11 @@
|
|
|
127
134
|
"simple-oauth2": "^5.0.0"
|
|
128
135
|
},
|
|
129
136
|
"devDependencies": {
|
|
130
|
-
"@babel/core": "7.23.
|
|
131
|
-
"alp-node": "6.
|
|
132
|
-
"alp-router": "7.
|
|
133
|
-
"liwi-mongo": "
|
|
134
|
-
"pob-babel": "38.0.
|
|
137
|
+
"@babel/core": "7.23.7",
|
|
138
|
+
"alp-node": "6.2.0",
|
|
139
|
+
"alp-router": "7.2.0",
|
|
140
|
+
"liwi-mongo": "11.0.0",
|
|
141
|
+
"pob-babel": "38.0.2",
|
|
135
142
|
"router-segments": "9.1.0",
|
|
136
143
|
"typescript": "5.3.3"
|
|
137
144
|
}
|
package/src/.eslintrc.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"root": true,
|
|
3
3
|
"parser": "@typescript-eslint/parser",
|
|
4
4
|
"parserOptions": {
|
|
5
|
+
"EXPERIMENTAL_useProjectService": true,
|
|
5
6
|
"project": "packages/alp-node-auth/tsconfig.json"
|
|
6
7
|
},
|
|
7
8
|
"plugins": ["@typescript-eslint"],
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
],
|
|
12
13
|
"ignorePatterns": ["*.d.ts"],
|
|
13
14
|
"rules": {
|
|
15
|
+
"@typescript-eslint/max-params": "warn",
|
|
14
16
|
"@typescript-eslint/no-unsafe-return": "warn",
|
|
15
17
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
16
18
|
"@typescript-eslint/no-unsafe-call": "warn",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function dropboxStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('dropbox').get('clientId'),
|
|
7
|
+
secret: config.get('dropbox').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://www.dropbox.com',
|
|
11
|
+
tokenPath: '/1/oauth2/token',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/1/oauth2/authorize',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
type: 'oauth2',
|
|
23
|
+
oauth2: {
|
|
24
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
25
|
+
clientCredentials: new ClientCredentials(options),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function facebookStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('facebook').get('clientId'),
|
|
7
|
+
secret: config.get('facebook').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://www.facebook.com',
|
|
11
|
+
tokenPath: '/oauth/access_token',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/dialog/oauth',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
type: 'oauth2',
|
|
23
|
+
oauth2: {
|
|
24
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
25
|
+
clientCredentials: new ClientCredentials(options),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function foursquareStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('foursquare').get('clientId'),
|
|
7
|
+
secret: config.get('foursquare').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://foursquare.com',
|
|
11
|
+
tokenPath: '/oauth2/access_token',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/oauth2/authenticate',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
type: 'oauth2',
|
|
23
|
+
oauth2: {
|
|
24
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
25
|
+
clientCredentials: new ClientCredentials(options),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function githubStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('github').get('clientId'),
|
|
7
|
+
secret: config.get('github').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://github.com',
|
|
11
|
+
tokenPath: '/login/oauth/access_token',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/login/oauth/authorize',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
type: 'oauth2',
|
|
23
|
+
oauth2: {
|
|
24
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
25
|
+
clientCredentials: new ClientCredentials(options),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function googleStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('google').get('clientId'),
|
|
7
|
+
secret: config.get('google').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://accounts.google.com',
|
|
11
|
+
tokenPath: '/o/oauth2/token',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/o/oauth2/auth',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
type: 'oauth2',
|
|
24
|
+
oauth2: {
|
|
25
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
26
|
+
clientCredentials: new ClientCredentials(options),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
2
|
+
|
|
3
|
+
export default function slackStrategy(config) {
|
|
4
|
+
const options = {
|
|
5
|
+
client: {
|
|
6
|
+
id: config.get('slack').get('clientId'),
|
|
7
|
+
secret: config.get('slack').get('clientSecret'),
|
|
8
|
+
},
|
|
9
|
+
auth: {
|
|
10
|
+
tokenHost: 'https://slack.com',
|
|
11
|
+
tokenPath: '/api/oauth.access',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const authOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
auth: {
|
|
17
|
+
...options.auth,
|
|
18
|
+
authorizePath: '/oauth/authorize',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
type: 'oauth2',
|
|
23
|
+
oauth2: {
|
|
24
|
+
authorizationCode: new AuthorizationCode(authOptions),
|
|
25
|
+
clientCredentials: new ClientCredentials(options),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Config, SlackParams } from 'alp-types';
|
|
2
|
+
import { ClientCredentials, AuthorizationCode } from 'simple-oauth2';
|
|
3
|
+
|
|
4
|
+
export interface Strategy<Params = SlackParams> {
|
|
5
|
+
type: 'oauth2';
|
|
6
|
+
oauth2: {
|
|
7
|
+
authorizationCode: AuthorizationCode<Params>;
|
|
8
|
+
clientCredentials: ClientCredentials<Params>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function createStrategy<Params = SlackParams>(
|
|
13
|
+
config: Config,
|
|
14
|
+
): Strategy<Params>;
|