@backstage/plugin-auth-backend-module-google-provider 0.2.2 → 0.2.3-next.1

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
@@ -1,5 +1,22 @@
1
1
  # @backstage/plugin-auth-backend-module-google-provider
2
2
 
3
+ ## 0.2.3-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 79b055a: Pass through `includeGrantedScopes` in order to persist scopes across refresh calls
8
+ - Updated dependencies
9
+ - @backstage/plugin-auth-node@0.5.5-next.1
10
+ - @backstage/backend-plugin-api@1.1.0-next.1
11
+
12
+ ## 0.2.3-next.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @backstage/backend-plugin-api@1.0.3-next.0
18
+ - @backstage/plugin-auth-node@0.5.5-next.0
19
+
3
20
  ## 0.2.2
4
21
 
5
22
  ### Patch Changes
@@ -43,7 +43,8 @@ const googleAuthenticator = pluginAuthNode.createOAuthAuthenticator({
43
43
  async start(input, helper) {
44
44
  return helper.start(input, {
45
45
  accessType: "offline",
46
- prompt: "consent"
46
+ prompt: "consent",
47
+ includeGrantedScopes: "true"
47
48
  });
48
49
  },
49
50
  async authenticate(input, helper) {
@@ -1 +1 @@
1
- {"version":3,"file":"authenticator.cjs.js","sources":["../src/authenticator.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PassportOAuthAuthenticatorHelper,\n PassportOAuthDoneCallback,\n PassportProfile,\n createOAuthAuthenticator,\n} from '@backstage/plugin-auth-node';\nimport { OAuth2Client } from 'google-auth-library';\nimport { Strategy as GoogleStrategy } from 'passport-google-oauth20';\n\n/** @public */\nexport const googleAuthenticator = createOAuthAuthenticator({\n defaultProfileTransform:\n PassportOAuthAuthenticatorHelper.defaultProfileTransform,\n scopes: {\n required: [\n 'openid',\n `https://www.googleapis.com/auth/userinfo.email`,\n `https://www.googleapis.com/auth/userinfo.profile`,\n ],\n },\n initialize({ callbackUrl, config }) {\n const clientId = config.getString('clientId');\n const clientSecret = config.getString('clientSecret');\n\n return PassportOAuthAuthenticatorHelper.from(\n new GoogleStrategy(\n {\n clientID: clientId,\n clientSecret: clientSecret,\n callbackURL: callbackUrl,\n passReqToCallback: false,\n },\n (\n accessToken: string,\n refreshToken: string,\n params: any,\n fullProfile: PassportProfile,\n done: PassportOAuthDoneCallback,\n ) => {\n done(\n undefined,\n {\n fullProfile,\n params,\n accessToken,\n },\n {\n refreshToken,\n },\n );\n },\n ),\n );\n },\n\n async start(input, helper) {\n return helper.start(input, {\n accessType: 'offline',\n prompt: 'consent',\n });\n },\n\n async authenticate(input, helper) {\n return helper.authenticate(input);\n },\n\n async refresh(input, helper) {\n return helper.refresh(input);\n },\n\n async logout(input) {\n if (input.refreshToken) {\n const oauthClient = new OAuth2Client();\n await oauthClient.revokeToken(input.refreshToken);\n }\n },\n});\n"],"names":["createOAuthAuthenticator","PassportOAuthAuthenticatorHelper","GoogleStrategy","OAuth2Client"],"mappings":";;;;;;AA0BO,MAAM,sBAAsBA,uCAAyB,CAAA;AAAA,EAC1D,yBACEC,+CAAiC,CAAA,uBAAA;AAAA,EACnC,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA;AAAA,MACR,QAAA;AAAA,MACA,CAAA,8CAAA,CAAA;AAAA,MACA,CAAA,gDAAA;AAAA;AACF,GACF;AAAA,EACA,UAAW,CAAA,EAAE,WAAa,EAAA,MAAA,EAAU,EAAA;AAClC,IAAM,MAAA,QAAA,GAAW,MAAO,CAAA,SAAA,CAAU,UAAU,CAAA;AAC5C,IAAM,MAAA,YAAA,GAAe,MAAO,CAAA,SAAA,CAAU,cAAc,CAAA;AAEpD,IAAA,OAAOA,+CAAiC,CAAA,IAAA;AAAA,MACtC,IAAIC,8BAAA;AAAA,QACF;AAAA,UACE,QAAU,EAAA,QAAA;AAAA,UACV,YAAA;AAAA,UACA,WAAa,EAAA,WAAA;AAAA,UACb,iBAAmB,EAAA;AAAA,SACrB;AAAA,QACA,CACE,WAAA,EACA,YACA,EAAA,MAAA,EACA,aACA,IACG,KAAA;AACH,UAAA,IAAA;AAAA,YACE,KAAA,CAAA;AAAA,YACA;AAAA,cACE,WAAA;AAAA,cACA,MAAA;AAAA,cACA;AAAA,aACF;AAAA,YACA;AAAA,cACE;AAAA;AACF,WACF;AAAA;AACF;AACF,KACF;AAAA,GACF;AAAA,EAEA,MAAM,KAAM,CAAA,KAAA,EAAO,MAAQ,EAAA;AACzB,IAAO,OAAA,MAAA,CAAO,MAAM,KAAO,EAAA;AAAA,MACzB,UAAY,EAAA,SAAA;AAAA,MACZ,MAAQ,EAAA;AAAA,KACT,CAAA;AAAA,GACH;AAAA,EAEA,MAAM,YAAa,CAAA,KAAA,EAAO,MAAQ,EAAA;AAChC,IAAO,OAAA,MAAA,CAAO,aAAa,KAAK,CAAA;AAAA,GAClC;AAAA,EAEA,MAAM,OAAQ,CAAA,KAAA,EAAO,MAAQ,EAAA;AAC3B,IAAO,OAAA,MAAA,CAAO,QAAQ,KAAK,CAAA;AAAA,GAC7B;AAAA,EAEA,MAAM,OAAO,KAAO,EAAA;AAClB,IAAA,IAAI,MAAM,YAAc,EAAA;AACtB,MAAM,MAAA,WAAA,GAAc,IAAIC,8BAAa,EAAA;AACrC,MAAM,MAAA,WAAA,CAAY,WAAY,CAAA,KAAA,CAAM,YAAY,CAAA;AAAA;AAClD;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"authenticator.cjs.js","sources":["../src/authenticator.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PassportOAuthAuthenticatorHelper,\n PassportOAuthDoneCallback,\n PassportProfile,\n createOAuthAuthenticator,\n} from '@backstage/plugin-auth-node';\nimport { OAuth2Client } from 'google-auth-library';\nimport { Strategy as GoogleStrategy } from 'passport-google-oauth20';\n\n/** @public */\nexport const googleAuthenticator = createOAuthAuthenticator({\n defaultProfileTransform:\n PassportOAuthAuthenticatorHelper.defaultProfileTransform,\n scopes: {\n required: [\n 'openid',\n `https://www.googleapis.com/auth/userinfo.email`,\n `https://www.googleapis.com/auth/userinfo.profile`,\n ],\n },\n initialize({ callbackUrl, config }) {\n const clientId = config.getString('clientId');\n const clientSecret = config.getString('clientSecret');\n\n return PassportOAuthAuthenticatorHelper.from(\n new GoogleStrategy(\n {\n clientID: clientId,\n clientSecret: clientSecret,\n callbackURL: callbackUrl,\n passReqToCallback: false,\n },\n (\n accessToken: string,\n refreshToken: string,\n params: any,\n fullProfile: PassportProfile,\n done: PassportOAuthDoneCallback,\n ) => {\n done(\n undefined,\n {\n fullProfile,\n params,\n accessToken,\n },\n {\n refreshToken,\n },\n );\n },\n ),\n );\n },\n\n async start(input, helper) {\n return helper.start(input, {\n accessType: 'offline',\n prompt: 'consent',\n includeGrantedScopes: 'true',\n });\n },\n\n async authenticate(input, helper) {\n return helper.authenticate(input);\n },\n\n async refresh(input, helper) {\n return helper.refresh(input);\n },\n\n async logout(input) {\n if (input.refreshToken) {\n const oauthClient = new OAuth2Client();\n await oauthClient.revokeToken(input.refreshToken);\n }\n },\n});\n"],"names":["createOAuthAuthenticator","PassportOAuthAuthenticat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Q,CAAA,KAAA,EAAO,MAAQ,EAAA;AAC3B,IAAO,OAAA,MAAA,CAAO,QAAQ,KAAK,CAAA;AAAA,GAC7B;AAAA,EAEA,MAAM,OAAO,KAAO,EAAA;AAClB,IAAA,IAAI,MAAM,YAAc,EAAA;AACtB,MAAM,MAAA,WAAA,GAAc,IAAIC,8BAAa,EAAA;AACrC,MAAM,MAAA,WAAA,CAAY,WAAY,CAAA,KAAA,CAAM,YAAY,CAAA;AAAA;AAClD;AAEJ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-auth-backend-module-google-provider",
3
- "version": "0.2.2",
3
+ "version": "0.2.3-next.1",
4
4
  "description": "A Google auth provider module for the Backstage auth backend",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -38,15 +38,15 @@
38
38
  "test": "backstage-cli package test"
39
39
  },
40
40
  "dependencies": {
41
- "@backstage/backend-plugin-api": "^1.0.2",
42
- "@backstage/plugin-auth-node": "^0.5.4",
41
+ "@backstage/backend-plugin-api": "1.1.0-next.1",
42
+ "@backstage/plugin-auth-node": "0.5.5-next.1",
43
43
  "google-auth-library": "^9.0.0",
44
44
  "passport-google-oauth20": "^2.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@backstage/backend-test-utils": "^1.1.0",
48
- "@backstage/cli": "^0.29.0",
49
- "@backstage/plugin-auth-backend": "^0.24.0",
47
+ "@backstage/backend-test-utils": "1.2.0-next.1",
48
+ "@backstage/cli": "0.29.3-next.1",
49
+ "@backstage/plugin-auth-backend": "0.24.1-next.1",
50
50
  "@types/passport-google-oauth20": "^2.0.3",
51
51
  "supertest": "^7.0.0"
52
52
  },