@xwiki/cristal-electron-authentication-github-renderer 0.20.0 → 0.21.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 +23 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +10 -9
- package/src/GitHubAuthenticationManager.ts +1 -1
- package/src/index.ts +1 -1
- package/vite.config.ts +1 -1
- package/vitest.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @xwiki/cristal-electron-authentication-github-renderer
|
|
2
2
|
|
|
3
|
+
## 0.21.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Cristal 0.21.1 Release
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @xwiki/cristal-api@0.21.1
|
|
10
|
+
- @xwiki/cristal-authentication-api@0.21.1
|
|
11
|
+
- @xwiki/cristal-authentication-github-state@0.21.1
|
|
12
|
+
|
|
13
|
+
## 0.21.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Cristal 0.21 Release
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @xwiki/cristal-api@0.21.0
|
|
23
|
+
- @xwiki/cristal-authentication-api@0.21.0
|
|
24
|
+
- @xwiki/cristal-authentication-github-state@0.21.0
|
|
25
|
+
|
|
3
26
|
## 0.20.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":";;;;;;;;AAkDA,IAAMA,IAAN,MAAmE;AAAA,EACjE,YACyCC,GAEtBC,GACjB;AAHuC,SAAA,aAAAD,GAEtB,KAAA,sBAAAC,GAGnB,KAAiB,yBAAyB,8BAE1C,KAAiB,uBAAuB,4BAExC,KAAiB,wBAAwB,6BAEzC,KAAiB,uBAAuB;AAAA,EARrC;AAAA,EAUH,MAAM,QAAuB;AAC3B,UAAMC,IAAmB,IAAI;AAAA,MAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB;AAAA,IAAA,GAIpDC,IAKF,OANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA;AAEnB,WAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLC,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,WAAW,SAAA;AAAA,IAAS,GAEnC,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,SAAS,SAAA;AAAA,IAAS,GAEjC,KAAK,oBAAoB,YAAY,QAAQ;AAAA,EAC/C;AAAA,EAEA,MAAM,WAA0B;AAC9B,WAAO,OAAO,qBAAqB;AAAA,MACjC,KAAK,WAAW,cAAA,EAAgB;AAAA,MAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB;AAAA,MACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB;AAAA,MACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEA,MAAM,yBAAsD;AAE1D,QADsB,MAAM,KAAK,gBAAA,GACd;AACjB,YAAM,EAAE,WAAAC,GAAW,aAAAC,EAAA,IACjB,MAAM,OAAO,qBAAqB,sBAAA;AACpC,aAAO,GAAGD,CAAS,IAAIC,CAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAoC;AACxC,WAAO,OAAO,qBAAqB,WAAA;AAAA,EACrC;AAAA,EAEA,MAAM,iBAAuC;AAC3C,WAAO,OAAO,qBAAqB,eAAA;AAAA,EACrC;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,OAAO,qBAAqB,OAAA;AAAA,EACpC;AACF;AA5EMN,IAANO,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAOC,CAAyB,CAAA;AAAA,GAH/BV,CAAA;ACzBN,MAAMW,EAAc;AAAA,EAClB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,GACrBY,EACG,KAAgCF,CAAyB,EACzD,OAAA,EACA,iBAAA;AAAA,EACL;AACF;"}
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":"6lBAkDA,IAAMA,EAAN,KAAmE,CACjE,YACyCC,EAEtBC,EACjB,CAHuC,KAAA,WAAAD,EAEtB,KAAA,oBAAAC,EAGnB,KAAiB,uBAAyB,6BAE1C,KAAiB,qBAAuB,2BAExC,KAAiB,sBAAwB,4BAEzC,KAAiB,qBAAuB,yBARrC,CAUH,MAAM,OAAuB,CAC3B,MAAMC,EAAmB,IAAI,IAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB,eAAA,EAIpDC,EAKF,MANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA,EAEnB,OAAO,aAAa,QAClB,KAAK,uBACLC,EAAa,WAAA,EAEf,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAA,EAEf,OAAO,aAAa,QAClB,KAAK,sBACLA,EAAa,WAAW,SAAA,CAAS,EAEnC,OAAO,aAAa,QAClB,KAAK,qBACLA,EAAa,SAAS,SAAA,CAAS,EAEjC,KAAK,oBAAoB,YAAY,MAAQ,EAC/C,CAEA,MAAM,UAA0B,CAC9B,OAAO,OAAO,qBAAqB,MACjC,KAAK,WAAW,cAAA,EAAgB,sBAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB,EACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB,EACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB,CAAA,CAE1D,CAEA,MAAM,wBAAsD,CAE1D,GADsB,MAAM,KAAK,gBAAA,EACd,CACjB,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAA,EACjB,MAAM,OAAO,qBAAqB,sBAAA,EACpC,MAAO,GAAGD,CAAS,IAAIC,CAAW,EACpC,CACF,CAEA,MAAM,iBAAoC,CACxC,OAAO,OAAO,qBAAqB,WAAA,CACrC,CAEA,MAAM,gBAAuC,CAC3C,OAAO,OAAO,qBAAqB,eAAA,CACrC,CAEA,MAAM,QAAwB,CAC5B,MAAM,OAAO,qBAAqB,OAAA,CACpC,CACF,EA5EMN,EAANO,EAAA,CADCC,aAAA,EAGIC,aAAO,YAAY,CAAA,EACnBA,aAAOC,2BAAyB,CAAA,CAAA,EAH/BV,CAAA,ECzBN,MAAMW,CAAc,CAClB,YAAYC,EAAsB,CAChCA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,EACrBY,EACG,KAAgCF,EAAAA,yBAAyB,EACzD,OAAA,EACA,iBAAA,CACL,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-electron-authentication-github-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -27,20 +27,21 @@
|
|
|
27
27
|
},
|
|
28
28
|
"main": "./dist/index.es.js",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"@xwiki/cristal-
|
|
32
|
-
"@xwiki/cristal-authentication-api": "0.
|
|
33
|
-
"@xwiki/cristal-authentication-github-state": "0.20.0"
|
|
30
|
+
"@xwiki/cristal-api": "0.21.1",
|
|
31
|
+
"@xwiki/cristal-authentication-github-state": "0.21.1",
|
|
32
|
+
"@xwiki/cristal-authentication-api": "0.21.1"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
35
|
+
"inversify": "7.x",
|
|
36
36
|
"reflect-metadata": "0.x"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"inversify": "7.7.0",
|
|
39
40
|
"reflect-metadata": "0.2.2",
|
|
40
|
-
"typescript": "5.
|
|
41
|
-
"vite": "7.0.
|
|
42
|
-
"vue": "3.5.
|
|
43
|
-
"@xwiki/cristal-dev-config": "0.
|
|
41
|
+
"typescript": "5.9.2",
|
|
42
|
+
"vite": "7.0.6",
|
|
43
|
+
"vue": "3.5.18",
|
|
44
|
+
"@xwiki/cristal-dev-config": "0.21.1"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "tsc --project tsconfig.json && vite build",
|
package/src/index.ts
CHANGED
package/vite.config.ts
CHANGED
package/vitest.config.ts
CHANGED