alp-node-auth 9.1.0 → 9.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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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.2.0](https://github.com/christophehurpeau/alp/compare/alp-node-auth@9.1.0...alp-node-auth@9.2.0) (2024-01-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * **deps:** update dependency liwi-mongo to v11 ([#465](https://github.com/christophehurpeau/alp/issues/465)) ([f8c4804](https://github.com/christophehurpeau/alp/commit/f8c4804621cf179e4155a18121f5a8d4f144b11e))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add missing strategies in files ([119028e](https://github.com/christophehurpeau/alp/commit/119028e54c83c3fc391458cc1c454f7244f15ca1))
17
+
18
+ Version bump for dependency: alp-node
19
+ Version bump for dependency: alp-router
20
+
21
+
6
22
  ## [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
23
 
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alp-node-auth",
3
- "version": "9.1.0",
3
+ "version": "9.2.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
  {
@@ -111,10 +111,11 @@
111
111
  }
112
112
  ]
113
113
  },
114
+ "prettier": "@pob/root/prettier-config",
114
115
  "peerDependencies": {
115
116
  "alp-node": "^6.0.0",
116
117
  "alp-router": "^7.0.0",
117
- "liwi-mongo": "^10.5.0",
118
+ "liwi-mongo": "^10.5.0 || ^11.0.0",
118
119
  "router-segments": "^9.1.0"
119
120
  },
120
121
  "dependencies": {
@@ -127,11 +128,11 @@
127
128
  "simple-oauth2": "^5.0.0"
128
129
  },
129
130
  "devDependencies": {
130
- "@babel/core": "7.23.6",
131
- "alp-node": "6.1.0",
132
- "alp-router": "7.1.0",
133
- "liwi-mongo": "10.5.0",
134
- "pob-babel": "38.0.0",
131
+ "@babel/core": "7.23.7",
132
+ "alp-node": "6.1.1",
133
+ "alp-router": "7.1.1",
134
+ "liwi-mongo": "11.0.0",
135
+ "pob-babel": "38.0.2",
135
136
  "router-segments": "9.1.0",
136
137
  "typescript": "5.3.3"
137
138
  }
@@ -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,3 @@
1
+ {
2
+ "ignorePatterns": ["*.d.ts"]
3
+ }
@@ -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>;