@inrupt/solid-client-authn-browser 1.11.9-alpha.2 → 1.11.9-alpha.5
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/dist/index.es.js +1 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/solid-client-authn.bundle.js +1 -0
- package/dist/solid-client-authn.bundle.js.map +1 -0
- package/package.json +8 -5
- package/.eslintrc.js +0 -16
- package/NOTICE +0 -5
- package/coverage/clover.xml +0 -547
- package/coverage/coverage-final.json +0 -28
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -266
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/ClientAuthentication.ts.html +0 -631
- package/coverage/lcov-report/src/Session.ts.html +0 -1435
- package/coverage/lcov-report/src/constant.ts.html +0 -163
- package/coverage/lcov-report/src/defaultSession.ts.html +0 -460
- package/coverage/lcov-report/src/dependencies.ts.html +0 -400
- package/coverage/lcov-report/src/iframe.ts.html +0 -394
- package/coverage/lcov-report/src/index.browser.ts.html +0 -157
- package/coverage/lcov-report/src/index.html +0 -206
- package/coverage/lcov-report/src/login/AggregateLoginHandler.ts.html +0 -226
- package/coverage/lcov-report/src/login/index.html +0 -116
- package/coverage/lcov-report/src/login/oidc/AggregateOidcHandler.ts.html +0 -226
- package/coverage/lcov-report/src/login/oidc/ClientRegistrar.ts.html +0 -415
- package/coverage/lcov-report/src/login/oidc/IssuerConfigFetcher.ts.html +0 -646
- package/coverage/lcov-report/src/login/oidc/OidcLoginHandler.ts.html +0 -436
- package/coverage/lcov-report/src/login/oidc/Redirector.ts.html +0 -229
- package/coverage/lcov-report/src/login/oidc/index.html +0 -176
- package/coverage/lcov-report/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.ts.html +0 -478
- package/coverage/lcov-report/src/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.ts.html +0 -319
- package/coverage/lcov-report/src/login/oidc/oidcHandlers/index.html +0 -131
- package/coverage/lcov-report/src/login/oidc/redirectHandler/AggregateRedirectHandler.ts.html +0 -226
- package/coverage/lcov-report/src/login/oidc/redirectHandler/AuthCodeRedirectHandler.ts.html +0 -667
- package/coverage/lcov-report/src/login/oidc/redirectHandler/ErrorOidcHandler.ts.html +0 -283
- package/coverage/lcov-report/src/login/oidc/redirectHandler/FallbackRedirectHandler.ts.html +0 -265
- package/coverage/lcov-report/src/login/oidc/redirectHandler/index.html +0 -161
- package/coverage/lcov-report/src/login/oidc/refresh/TokenRefresher.ts.html +0 -385
- package/coverage/lcov-report/src/login/oidc/refresh/index.html +0 -116
- package/coverage/lcov-report/src/login/webid/WebIdLoginHandler.ts.html +0 -250
- package/coverage/lcov-report/src/login/webid/index.html +0 -116
- package/coverage/lcov-report/src/logout/GeneralLogoutHandler.ts.html +0 -220
- package/coverage/lcov-report/src/logout/index.html +0 -116
- package/coverage/lcov-report/src/sessionInfo/SessionInfoManager.ts.html +0 -775
- package/coverage/lcov-report/src/sessionInfo/index.html +0 -116
- package/coverage/lcov-report/src/storage/BrowserStorage.ts.html +0 -229
- package/coverage/lcov-report/src/storage/StorageUtility.ts.html +0 -214
- package/coverage/lcov-report/src/storage/index.html +0 -131
- package/coverage/lcov-report/src/util/UuidGenerator.ts.html +0 -226
- package/coverage/lcov-report/src/util/index.html +0 -131
- package/coverage/lcov-report/src/util/urlPath.ts.html +0 -208
- package/coverage/lcov.info +0 -1001
- package/dist/ClientAuthentication.js +0 -64
- package/dist/ClientAuthentication.js.map +0 -1
- package/dist/Session.js +0 -165
- package/dist/Session.js.map +0 -1
- package/dist/constant.js +0 -7
- package/dist/constant.js.map +0 -1
- package/dist/defaultSession.js +0 -48
- package/dist/defaultSession.js.map +0 -1
- package/dist/dependencies.js +0 -41
- package/dist/dependencies.js.map +0 -1
- package/dist/iframe.js +0 -43
- package/dist/iframe.js.map +0 -1
- package/dist/index.browser.d.ts +0 -1
- package/dist/index.browser.js +0 -28
- package/dist/index.browser.js.map +0 -1
- package/dist/login/AggregateLoginHandler.js +0 -10
- package/dist/login/AggregateLoginHandler.js.map +0 -1
- package/dist/login/oidc/AggregateOidcHandler.js +0 -10
- package/dist/login/oidc/AggregateOidcHandler.js.map +0 -1
- package/dist/login/oidc/ClientRegistrar.js +0 -51
- package/dist/login/oidc/ClientRegistrar.js.map +0 -1
- package/dist/login/oidc/IssuerConfigFetcher.js +0 -124
- package/dist/login/oidc/IssuerConfigFetcher.js.map +0 -1
- package/dist/login/oidc/OidcLoginHandler.js +0 -40
- package/dist/login/oidc/OidcLoginHandler.js.map +0 -1
- package/dist/login/oidc/Redirector.js +0 -21
- package/dist/login/oidc/Redirector.js.map +0 -1
- package/dist/login/oidc/__mocks__/IOidcOptions.d.ts +0 -2
- package/dist/login/oidc/__mocks__/IOidcOptions.js +0 -25
- package/dist/login/oidc/__mocks__/IOidcOptions.js.map +0 -1
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js +0 -56
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js.map +0 -1
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js +0 -47
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.js.map +0 -1
- package/dist/login/oidc/redirectHandler/AggregateRedirectHandler.js +0 -10
- package/dist/login/oidc/redirectHandler/AggregateRedirectHandler.js.map +0 -1
- package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js +0 -92
- package/dist/login/oidc/redirectHandler/AuthCodeRedirectHandler.js.map +0 -1
- package/dist/login/oidc/redirectHandler/ErrorOidcHandler.js +0 -26
- package/dist/login/oidc/redirectHandler/ErrorOidcHandler.js.map +0 -1
- package/dist/login/oidc/redirectHandler/FallbackRedirectHandler.js +0 -20
- package/dist/login/oidc/redirectHandler/FallbackRedirectHandler.js.map +0 -1
- package/dist/login/oidc/refresh/TokenRefresher.js +0 -31
- package/dist/login/oidc/refresh/TokenRefresher.js.map +0 -1
- package/dist/login/webid/WebIdLoginHandler.js +0 -12
- package/dist/login/webid/WebIdLoginHandler.js.map +0 -1
- package/dist/logout/GeneralLogoutHandler.js +0 -15
- package/dist/logout/GeneralLogoutHandler.js.map +0 -1
- package/dist/sessionInfo/SessionInfoManager.js +0 -95
- package/dist/sessionInfo/SessionInfoManager.js.map +0 -1
- package/dist/solid-client-authn.bundle.js.LICENSE.txt +0 -17
- package/dist/storage/BrowserStorage.js +0 -18
- package/dist/storage/BrowserStorage.js.map +0 -1
- package/dist/storage/StorageUtility.js +0 -10
- package/dist/storage/StorageUtility.js.map +0 -1
- package/dist/util/UuidGenerator.js +0 -10
- package/dist/util/UuidGenerator.js.map +0 -1
- package/dist/util/urlPath.js +0 -11
- package/dist/util/urlPath.js.map +0 -1
- package/docs/api/Makefile +0 -76
- package/docs/api/README.md +0 -46
- package/docs/api/build/docs-assets/README.md +0 -183
- package/docs/api/build/docs-assets/_static/css/inrupt.css +0 -349
- package/docs/api/build/docs-assets/_templates/breadcrumb-navigation.html +0 -10
- package/docs/api/build/docs-assets/_templates/copyright.html +0 -3
- package/docs/api/build/docs-assets/_templates/docs-sidebar.html +0 -32
- package/docs/api/build/docs-assets/_templates/docs-version-selector.html +0 -21
- package/docs/api/build/docs-assets/_templates/jira-feedback.html +0 -21
- package/docs/api/build/docs-assets/_templates/layout.html +0 -34
- package/docs/api/build/docs-assets/_templates/matomo.html +0 -18
- package/docs/api/build/docs-assets/_templates/navbar-logo.html +0 -5
- package/docs/api/build/docs-assets/_templates/navbar-nav.html +0 -44
- package/docs/api/build/docs-assets/_templates/prev-next.html +0 -19
- package/docs/api/build/docs-assets/_templates/versioned-canonical.html +0 -8
- package/docs/api/build/docs-assets/themes/inrupt/theme.conf +0 -18
- package/docs/api/build/doctrees/classes/ConfigurationError.doctree +0 -0
- package/docs/api/build/doctrees/classes/InMemoryStorage.doctree +0 -0
- package/docs/api/build/doctrees/classes/NotImplementedError.doctree +0 -0
- package/docs/api/build/doctrees/classes/Session.doctree +0 -0
- package/docs/api/build/doctrees/environment.pickle +0 -0
- package/docs/api/build/doctrees/functions.doctree +0 -0
- package/docs/api/build/doctrees/index.doctree +0 -0
- package/docs/api/build/doctrees/interfaces/ILoginInputOptions.doctree +0 -0
- package/docs/api/build/doctrees/interfaces/ISessionInfo.doctree +0 -0
- package/docs/api/build/doctrees/interfaces/ISessionOptions.doctree +0 -0
- package/docs/api/build/doctrees/interfaces/IStorage.doctree +0 -0
- package/docs/api/build/html/.buildinfo +0 -4
- package/docs/api/build/html/_static/basic.css +0 -905
- package/docs/api/build/html/_static/css/blank.css +0 -2
- package/docs/api/build/html/_static/css/index.ff1ffe594081f20da1ef19478df9384b.css +0 -6
- package/docs/api/build/html/_static/css/inrupt.css +0 -349
- package/docs/api/build/html/_static/css/theme.css +0 -120
- package/docs/api/build/html/_static/doctools.js +0 -323
- package/docs/api/build/html/_static/documentation_options.js +0 -12
- package/docs/api/build/html/_static/file.png +0 -0
- package/docs/api/build/html/_static/jquery-3.5.1.js +0 -10872
- package/docs/api/build/html/_static/jquery.js +0 -2
- package/docs/api/build/html/_static/js/index.be7d3bbb2ef33a8344ce.js +0 -32
- package/docs/api/build/html/_static/language_data.js +0 -297
- package/docs/api/build/html/_static/minus.png +0 -0
- package/docs/api/build/html/_static/plus.png +0 -0
- package/docs/api/build/html/_static/pygments.css +0 -74
- package/docs/api/build/html/_static/searchtools.js +0 -529
- package/docs/api/build/html/_static/underscore-1.13.1.js +0 -2042
- package/docs/api/build/html/_static/underscore.js +0 -6
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/LICENSE.txt +0 -34
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/css/all.min.css +0 -5
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.svg +0 -3570
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2 +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.svg +0 -803
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2 +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.svg +0 -4938
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff +0 -0
- package/docs/api/build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/api/build/html/_static/webpack-macros.html +0 -25
- package/docs/api/build/html/classes/ConfigurationError.html +0 -726
- package/docs/api/build/html/classes/InMemoryStorage.html +0 -636
- package/docs/api/build/html/classes/NotImplementedError.html +0 -726
- package/docs/api/build/html/classes/Session.html +0 -2428
- package/docs/api/build/html/functions.html +0 -834
- package/docs/api/build/html/genindex.html +0 -311
- package/docs/api/build/html/index.html +0 -342
- package/docs/api/build/html/interfaces/ILoginInputOptions.html +0 -595
- package/docs/api/build/html/interfaces/ISessionInfo.html +0 -481
- package/docs/api/build/html/interfaces/ISessionOptions.html +0 -463
- package/docs/api/build/html/interfaces/IStorage.html +0 -531
- package/docs/api/build/html/objects.inv +0 -0
- package/docs/api/build/html/search.html +0 -340
- package/docs/api/build/html/searchindex.js +0 -1
- package/docs/api/build/source/classes/ConfigurationError.md +0 -159
- package/docs/api/build/source/classes/InMemoryStorage.md +0 -112
- package/docs/api/build/source/classes/NotImplementedError.md +0 -159
- package/docs/api/build/source/classes/Session.md +0 -907
- package/docs/api/build/source/functions.md +0 -235
- package/docs/api/build/source/index.rst +0 -13
- package/docs/api/build/source/interfaces/ILoginInputOptions.md +0 -109
- package/docs/api/build/source/interfaces/ISessionInfo.md +0 -63
- package/docs/api/build/source/interfaces/ISessionOptions.md +0 -60
- package/docs/api/build/source/interfaces/IStorage.md +0 -76
- package/docs/api/conf.py +0 -135
- package/docs/api/redirects.txt +0 -41
- package/docs/api/requirements.txt +0 -5
- package/docs/api/source/api/.nojekyll +0 -1
- package/docs/api/source/api/classes/ConfigurationError.md +0 -163
- package/docs/api/source/api/classes/InMemoryStorage.md +0 -112
- package/docs/api/source/api/classes/NotImplementedError.md +0 -163
- package/docs/api/source/api/classes/Session.md +0 -1426
- package/docs/api/source/api/index.md +0 -251
- package/docs/api/source/api/interfaces/ILoginInputOptions.md +0 -109
- package/docs/api/source/api/interfaces/ISessionInfo.md +0 -63
- package/docs/api/source/api/interfaces/ISessionOptions.md +0 -60
- package/docs/api/source/api/interfaces/IStorage.md +0 -76
- package/docs/api/source/functions.md +0 -3
- package/docs/api/source/index.rst +0 -13
- package/examples/demoAuthentiationMonitor/index.js +0 -34
- package/examples/demoAuthentiationMonitor/package-lock.json +0 -916
- package/examples/demoAuthentiationMonitor/package.json +0 -15
- package/examples/demoClientApp/.babelrc +0 -3
- package/examples/demoClientApp/package-lock.json +0 -11710
- package/examples/demoClientApp/package.json +0 -37
- package/examples/demoClientApp/src/DemoClientApp.js +0 -686
- package/examples/demoClientApp/src/index.html +0 -142
- package/examples/demoClientApp/src/index.js +0 -26
- package/examples/demoClientApp/webpack.config.js +0 -39
- package/examples/single/bundle/.babelrc +0 -3
- package/examples/single/bundle/README.md +0 -11
- package/examples/single/bundle/client-app-profile.ttl +0 -10
- package/examples/single/bundle/package-lock.json +0 -11196
- package/examples/single/bundle/package.json +0 -31
- package/examples/single/bundle/src/App.js +0 -123
- package/examples/single/bundle/src/index.html +0 -10
- package/examples/single/bundle/src/index.js +0 -26
- package/examples/single/bundle/webpack.config.js +0 -33
- package/examples/single/script/README.md +0 -11
- package/examples/single/script/index.html +0 -36
- package/examples/single/script/package-lock.json +0 -1293
- package/examples/single/script/package.json +0 -20
- package/examples/single/script/server.ts +0 -18
- package/jest.config.js +0 -10
- package/licenses.csv +0 -147
- package/rollup.config.js +0 -54
- package/sampleFlows/SolidAuthClientArchitecture.png +0 -0
- package/sampleFlows/authorization-code-with-pkce.png +0 -0
- package/sampleFlows/authorization-code-with-pkce.seqdiag +0 -46
- package/sampleFlows/authorization-code.png +0 -0
- package/sampleFlows/authorization-code.seqdiag +0 -50
- package/sampleFlows/client-credentials.png +0 -0
- package/sampleFlows/client-credentials.seqdiag +0 -38
- package/sampleFlows/legacy-implicit-flow.png +0 -0
- package/sampleFlows/legacy-implicit-flow.seqdiag +0 -43
- package/sampleFlows/self-signed.png +0 -0
- package/sampleFlows/self-signed.seqdiag +0 -49
- package/sampleFlows/signatory-access-control.seqdiag +0 -36
- package/sampleFlows/signatory-access-control.svg +0 -1
- package/tsconfig.eslint.json +0 -6
- package/tsconfig.json +0 -17
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "browser-in-bundle",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rm -rf ./dist",
|
|
8
|
-
"start": "webpack serve",
|
|
9
|
-
"dev": "npm run start",
|
|
10
|
-
"build": "webpack --mode production",
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [],
|
|
14
|
-
"author": "",
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@babel/core": "^7.16.7",
|
|
17
|
-
"@babel/preset-env": "^7.16.8",
|
|
18
|
-
"@babel/preset-react": "^7.16.7",
|
|
19
|
-
"babel-loader": "^8.2.3",
|
|
20
|
-
"html-loader": "^3.1.0",
|
|
21
|
-
"html-webpack-plugin": "^5.5.0",
|
|
22
|
-
"webpack": "^5.66.0",
|
|
23
|
-
"webpack-cli": "^4.9.1",
|
|
24
|
-
"webpack-dev-server": "^4.7.3"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"react": "^17.0.2",
|
|
28
|
-
"react-dom": "^17.0.2",
|
|
29
|
-
"regenerator-runtime": "^0.13.9"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Inrupt Inc.
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal in
|
|
6
|
-
* the Software without restriction, including without limitation the rights to use,
|
|
7
|
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
8
|
-
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
-
* subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in
|
|
12
|
-
* all copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
15
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
16
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
17
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
18
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
19
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import React, { useState, useEffect } from "react";
|
|
23
|
-
import "regenerator-runtime/runtime";
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
login,
|
|
27
|
-
logout,
|
|
28
|
-
handleIncomingRedirect,
|
|
29
|
-
fetch,
|
|
30
|
-
getDefaultSession,
|
|
31
|
-
} from "../../../../dist/index";
|
|
32
|
-
|
|
33
|
-
const REDIRECT_URL = "http://localhost:3113/";
|
|
34
|
-
const CLIENT_APP_WEBID =
|
|
35
|
-
"https://raw.githubusercontent.com/inrupt/solid-client-authn-js/main/packages/browser/examples/single/bundle/client-app-profile.ttl#app";
|
|
36
|
-
|
|
37
|
-
export default function App() {
|
|
38
|
-
const [webId, setWebId] = useState(getDefaultSession().info.webId);
|
|
39
|
-
const [issuer, setIssuer] = useState("https://broker.pod.inrupt.com/");
|
|
40
|
-
const [resource, setResource] = useState(webId);
|
|
41
|
-
const [data, setData] = useState(null);
|
|
42
|
-
|
|
43
|
-
// The useEffect hook is executed on page load, and in particular when the user
|
|
44
|
-
// is redirected to the page after logging in the identity provider.
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
// After redirect, the current URL contains login information.
|
|
47
|
-
handleIncomingRedirect({
|
|
48
|
-
restorePreviousSession: true,
|
|
49
|
-
onError: errorHandle,
|
|
50
|
-
}).then((info) => {
|
|
51
|
-
setWebId(info.webId);
|
|
52
|
-
setResource(webId);
|
|
53
|
-
});
|
|
54
|
-
}, [webId]);
|
|
55
|
-
|
|
56
|
-
const errorHandle = (error, errorDescription) => {
|
|
57
|
-
console.log(`${error} has occured: `, errorDescription);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const handleLogin = (e) => {
|
|
61
|
-
// The default behaviour of the button is to resubmit.
|
|
62
|
-
// This prevents the page from reloading.
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
// Login will redirect the user away so that they can log in the OIDC issuer,
|
|
65
|
-
// and back to the provided redirect URL (which should be controlled by your app).
|
|
66
|
-
login({
|
|
67
|
-
redirectUrl: REDIRECT_URL,
|
|
68
|
-
oidcIssuer: issuer,
|
|
69
|
-
clientName: "Demo app",
|
|
70
|
-
clientId: CLIENT_APP_WEBID,
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const handleLogout = (e) => {
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
logout();
|
|
77
|
-
// The following has no impact on the logout, it just resets the UI.
|
|
78
|
-
setWebId(undefined);
|
|
79
|
-
setData("");
|
|
80
|
-
setResource("");
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const handleFetch = (e) => {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
fetch(resource, { headers: new Headers({ Accept: "text/turtle" }) })
|
|
86
|
-
.then((response) => response.text())
|
|
87
|
-
.then(setData);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div>
|
|
92
|
-
<main>
|
|
93
|
-
<h1>Sandbox app</h1>
|
|
94
|
-
<p>{webId ? `Logged in as ${webId}` : "Not logged in yet"}</p>
|
|
95
|
-
<div>
|
|
96
|
-
<form>
|
|
97
|
-
<input
|
|
98
|
-
type="text"
|
|
99
|
-
value={issuer}
|
|
100
|
-
onChange={(e) => {
|
|
101
|
-
setIssuer(e.target.value);
|
|
102
|
-
}}
|
|
103
|
-
/>
|
|
104
|
-
<button onClick={(e) => handleLogin(e)}>Log In</button>
|
|
105
|
-
<button onClick={(e) => handleLogout(e)}>Log Out</button>
|
|
106
|
-
</form>
|
|
107
|
-
</div>
|
|
108
|
-
<hr />
|
|
109
|
-
<div>
|
|
110
|
-
<input
|
|
111
|
-
type="text"
|
|
112
|
-
value={resource}
|
|
113
|
-
onChange={(e) => {
|
|
114
|
-
setResource(e.target.value);
|
|
115
|
-
}}
|
|
116
|
-
/>
|
|
117
|
-
<button onClick={(e) => handleFetch(e)}>Fetch</button>
|
|
118
|
-
</div>
|
|
119
|
-
<pre>{data}</pre>
|
|
120
|
-
</main>
|
|
121
|
-
</div>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Inrupt Inc.
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal in
|
|
6
|
-
* the Software without restriction, including without limitation the rights to use,
|
|
7
|
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
8
|
-
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
-
* subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in
|
|
12
|
-
* all copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
15
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
16
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
17
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
18
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
19
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import React from "react";
|
|
23
|
-
import ReactDOM from "react-dom";
|
|
24
|
-
import App from "./App";
|
|
25
|
-
|
|
26
|
-
ReactDOM.render(<App />, document.getElementById("container"));
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const HtmlWebPackPlugin = require("html-webpack-plugin");
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
module: {
|
|
5
|
-
rules: [
|
|
6
|
-
{
|
|
7
|
-
test: /\.(js|jsx)$/,
|
|
8
|
-
exclude: /node_modules/,
|
|
9
|
-
use: {
|
|
10
|
-
loader: "babel-loader",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
test: /\.html$/,
|
|
15
|
-
use: [
|
|
16
|
-
{
|
|
17
|
-
loader: "html-loader",
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
plugins: [
|
|
24
|
-
new HtmlWebPackPlugin({
|
|
25
|
-
template: "./src/index.html",
|
|
26
|
-
filename: "./index.html",
|
|
27
|
-
}),
|
|
28
|
-
],
|
|
29
|
-
devServer: {
|
|
30
|
-
port: 3113,
|
|
31
|
-
historyApiFallback: true,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# `solid-client-authn-browser` sample app
|
|
2
|
-
|
|
3
|
-
This application provides a snippet of code showcasing usage of the
|
|
4
|
-
`solid-client-authn-browser` library in a `script` tag, without using a bundler.
|
|
5
|
-
|
|
6
|
-
## Install and run
|
|
7
|
-
|
|
8
|
-
- Run `npm ci` in the **root** directory, to build `solid-client-authn-browser`.
|
|
9
|
-
- Run `npm ci` in the current directory, to build the sample app.
|
|
10
|
-
- Run `npm run dev` to start the app. It will start a small web server bound to
|
|
11
|
-
`http://localhost:3001`, that resolves the browser bundle for `solid-client-authn-browser`.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<!-- This file is a work in progress. It should be fixed -->
|
|
2
|
-
<html>
|
|
3
|
-
<body>
|
|
4
|
-
<h1>solid-client-authn Script Tag Tester</h1>
|
|
5
|
-
<p>
|
|
6
|
-
Logging in to
|
|
7
|
-
<a id="oidcIssuer" href="https://broker.pod.inrupt.com/"
|
|
8
|
-
>https://broker.pod.inrupt.com/</a
|
|
9
|
-
>
|
|
10
|
-
</p>
|
|
11
|
-
<div>
|
|
12
|
-
WebID of the user you just logged in as:
|
|
13
|
-
<strong><span id="WebId"></span></strong>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<script type="text/javascript" src="/solid-client-authn.bundle.js"></script>
|
|
17
|
-
<script>
|
|
18
|
-
const session = new solidClientAuthentication.Session();
|
|
19
|
-
// When loading the page, check if you are being redirected from the IdP
|
|
20
|
-
session
|
|
21
|
-
.handleIncomingRedirect(window.location.href)
|
|
22
|
-
.then((sessionInfo) => {
|
|
23
|
-
if(!sessionInfo.isLoggedIn) {
|
|
24
|
-
// If you are not logged in, initiate the login
|
|
25
|
-
session.login({
|
|
26
|
-
redirectUrl: "http://localhost:3001/",
|
|
27
|
-
oidcIssuer: document.getElementById("oidcIssuer").innerHTML,
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
// The page was loaded after a redirect from the IdP
|
|
31
|
-
document.getElementById("WebId").innerHTML = sessionInfo.webId;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
</script>
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|