@snokam/auth 1.0.20 → 1.0.22

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,25 @@
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
+ ## [1.0.22](https://github.com/snokam/components/compare/@snokam/auth@1.0.21...@snokam/auth@1.0.22) (2024-08-31)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add error for AZURE_AD_SECRET" ([9654d6f](https://github.com/snokam/components/commit/9654d6f6228777c9786bda102286bccce021d924))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.0.21](https://github.com/snokam/components/compare/@snokam/auth@1.0.20...@snokam/auth@1.0.21) (2024-08-31)
18
+
19
+ **Note:** Version bump only for package @snokam/auth
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.0.20](https://github.com/snokam/components/compare/@snokam/auth@1.0.19...@snokam/auth@1.0.20) (2024-08-31)
7
26
 
8
27
  **Note:** Version bump only for package @snokam/auth
package/lib/server.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{getServerToken:()=>o});const n=require("@azure/msal-node");const o=e=>{return t=void 0,o=void 0,i=function*(){if(!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables");if(!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables");const t={auth:{clientId:`${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,authority:`https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,clientSecret:`${process.env.AZURE_AD_SECRET}`}},o=new n.ConfidentialClientApplication(t),r=yield o.acquireTokenByClientCredential({scopes:e.map((e=>e.replace("user_impersonation",".default")))});return`Bearer ${null==r?void 0:r.accessToken}`},new((r=void 0)||(r=Promise))((function(e,n){function c(e){try{a(i.next(e))}catch(e){n(e)}}function s(e){try{a(i.throw(e))}catch(e){n(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(c,s)}a((i=i.apply(t,o||[])).next())}));var t,o,r,i};return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{getServerToken:()=>o});const n=require("@azure/msal-node");const o=e=>{return t=void 0,o=void 0,i=function*(){if(!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables");if(!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID)throw new Error("NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables");if(!process.env.AZURE_AD_SECRET)throw new Error("AZURE_AD_SECRET must be set in the environment variables");const t={auth:{clientId:`${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,authority:`https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,clientSecret:`${process.env.AZURE_AD_SECRET}`}},o=new n.ConfidentialClientApplication(t),r=yield o.acquireTokenByClientCredential({scopes:e.map((e=>e.replace("user_impersonation",".default")))});return`Bearer ${null==r?void 0:r.accessToken}`},new((r=void 0)||(r=Promise))((function(e,n){function s(e){try{a(i.next(e))}catch(e){n(e)}}function c(e){try{a(i.throw(e))}catch(e){n(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,c)}a((i=i.apply(t,o||[])).next())}));var t,o,r,i};return t})()));
2
2
  //# sourceMappingURL=server.js.map
package/lib/server.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS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/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"@azure/msal-node\"","webpack://snokam/./src/server.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-node\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ConfidentialClientApplication } from \"@azure/msal-node\";\nexport const getServerToken = (scopes) => __awaiter(void 0, void 0, void 0, function* () {\n if (!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables\");\n }\n if (!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables\");\n }\n const config = {\n auth: {\n clientId: `${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,\n authority: `https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,\n clientSecret: `${process.env.AZURE_AD_SECRET}`,\n },\n };\n const cca = new ConfidentialClientApplication(config);\n const response = yield cca.acquireTokenByClientCredential({\n scopes: scopes.map((scope) => scope.replace(\"user_impersonation\", \".default\")),\n });\n return `Bearer ${response === null || response === void 0 ? void 0 : response.accessToken}`;\n});\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","getServerToken","scopes","__awaiter","thisArg","_arguments","generator","process","env","NEXT_PUBLIC_AZURE_AD_CLIENT_ID","Error","NEXT_PUBLIC_AZURE_AD_TENANT_ID","config","auth","clientId","authority","clientSecret","AZURE_AD_SECRET","cca","ConfidentialClientApplication","response","acquireTokenByClientCredential","map","scope","replace","accessToken","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply"],"sourceRoot":""}
1
+ {"version":3,"file":"server.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAA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EAIaoC,EAAOC,KAAOR,EAAQO,EAAOpC,QAJ1CA,EAIyDoC,EAAOpC,MAJhDA,aAAiB2B,EAAI3B,EAAQ,IAAI2B,GAAE,SAAUE,GAAWA,EAAQ7B,EAAQ,KAIjBsC,KAAKP,EAAWI,EAAW,CAC7GH,GAAMzB,EAAYA,EAAUgC,MAAMlC,EAASC,GAAc,KAAK2B,OAClE,IAPwC,IAAU5B,EAASC,EAAYqB,EAAGpB,CAgC5E,E","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"@azure/msal-node\"","webpack://snokam/./src/server.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-node\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ConfidentialClientApplication } from \"@azure/msal-node\";\nexport const getServerToken = (scopes) => __awaiter(void 0, void 0, void 0, function* () {\n if (!process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_CLIENT_ID must be set in the environment variables\");\n }\n if (!process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID) {\n throw new Error(\"NEXT_PUBLIC_AZURE_AD_TENANT_ID must be set in the environment variables\");\n }\n if (!process.env.AZURE_AD_SECRET) {\n throw new Error(\"AZURE_AD_SECRET must be set in the environment variables\");\n }\n const config = {\n auth: {\n clientId: `${process.env.NEXT_PUBLIC_AZURE_AD_CLIENT_ID}`,\n authority: `https://login.microsoftonline.com/${process.env.NEXT_PUBLIC_AZURE_AD_TENANT_ID}/oauth2/v2.0`,\n clientSecret: `${process.env.AZURE_AD_SECRET}`,\n },\n };\n const cca = new ConfidentialClientApplication(config);\n const response = yield cca.acquireTokenByClientCredential({\n scopes: scopes.map((scope) => scope.replace(\"user_impersonation\", \".default\")),\n });\n return `Bearer ${response === null || response === void 0 ? void 0 : response.accessToken}`;\n});\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","getServerToken","scopes","__awaiter","thisArg","_arguments","generator","process","env","NEXT_PUBLIC_AZURE_AD_CLIENT_ID","Error","NEXT_PUBLIC_AZURE_AD_TENANT_ID","AZURE_AD_SECRET","config","auth","clientId","authority","clientSecret","cca","ConfidentialClientApplication","response","acquireTokenByClientCredential","map","scope","replace","accessToken","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@snokam/auth",
3
3
  "description": "Snøkam auth components",
4
- "version": "1.0.20",
4
+ "version": "1.0.22",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -29,7 +29,7 @@
29
29
  "@azure/msal-react": "^2.0.22",
30
30
  "@emotion/react": "^11.13.0",
31
31
  "@emotion/styled": "^11.13.0",
32
- "@snokam/core": "^1.1.17"
32
+ "@snokam/core": "^1.1.18"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "next": "^14.2.7",
@@ -56,5 +56,5 @@
56
56
  ]
57
57
  }
58
58
  },
59
- "gitHead": "422e4326c8033a309e6114afca5d8fc7b4b0255a"
59
+ "gitHead": "5048c2df1dd07ba52bddeb19de94da40d1139544"
60
60
  }