@inrupt/solid-client-authn-browser 4.0.0 → 4.0.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/dist/ClientAuthentication.d.ts.map +1 -0
- package/dist/Session.d.ts.map +1 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/defaultSession.d.ts.map +1 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/login/oidc/AggregateOidcHandler.d.ts.map +1 -0
- package/dist/login/oidc/AggregateRedirectHandler.d.ts.map +1 -0
- package/dist/login/oidc/ClientRegistrar.d.ts.map +1 -0
- package/dist/login/oidc/IssuerConfigFetcher.d.ts.map +1 -0
- package/dist/login/oidc/OidcLoginHandler.d.ts.map +1 -0
- package/dist/login/oidc/Redirector.d.ts.map +1 -0
- package/dist/login/oidc/__mocks__/IOidcOptions.d.ts.map +1 -0
- package/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.d.ts.map +1 -0
- package/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.d.ts.map +1 -0
- package/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.d.ts.map +1 -0
- package/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.d.ts.map +1 -0
- package/dist/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.d.ts.map +1 -0
- package/dist/login/oidc/refresh/TokenRefresher.d.ts.map +1 -0
- package/dist/logout/buildRpInitiatedLogout.d.ts.map +1 -0
- package/dist/sessionInfo/SessionInfoManager.d.ts.map +1 -0
- package/dist/solid-client-authn.bundle.js +1 -1
- package/dist/solid-client-authn.bundle.js.map +1 -1
- package/dist/src/ClientAuthentication.d.ts +16 -0
- package/dist/src/Session.d.ts +146 -0
- package/dist/src/constant.d.ts +2 -0
- package/dist/src/defaultSession.d.ts +52 -0
- package/dist/src/dependencies.d.ts +17 -0
- package/dist/src/index.browser.d.ts +2 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/login/oidc/AggregateOidcHandler.d.ts +15 -0
- package/dist/src/login/oidc/AggregateRedirectHandler.d.ts +15 -0
- package/dist/src/login/oidc/ClientRegistrar.d.ts +13 -0
- package/dist/src/login/oidc/IssuerConfigFetcher.d.ts +18 -0
- package/dist/src/login/oidc/OidcLoginHandler.d.ts +20 -0
- package/dist/src/login/oidc/Redirector.d.ts +11 -0
- package/dist/src/login/oidc/__mocks__/IOidcOptions.d.ts +2 -0
- package/dist/src/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.d.ts +19 -0
- package/dist/src/login/oidc/incomingRedirectHandler/ErrorOidcHandler.d.ts +18 -0
- package/dist/src/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.d.ts +17 -0
- package/dist/src/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.d.ts +17 -0
- package/dist/src/login/oidc/oidcHandlers/OidcHandlerCanHandleTest.d.ts +9 -0
- package/dist/src/login/oidc/refresh/TokenRefresher.d.ts +16 -0
- package/dist/src/logout/buildRpInitiatedLogout.d.ts +9 -0
- package/dist/src/sessionInfo/SessionInfoManager.d.ts +26 -0
- package/dist/src/storage/BrowserStorage.d.ts +14 -0
- package/dist/src/storage/StorageUtility.d.ts +19 -0
- package/dist/src/util/UuidGenerator.d.ts +12 -0
- package/dist/storage/BrowserStorage.d.ts.map +1 -0
- package/dist/storage/StorageUtility.d.ts.map +1 -0
- package/dist/util/UuidGenerator.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { ISessionInfo, ISessionInternalInfo, ILoginOptions } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
import { ClientAuthentication as ClientAuthenticationBase } from "@inrupt/solid-client-authn-core";
|
|
7
|
+
import type { EventEmitter } from "events";
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export default class ClientAuthentication extends ClientAuthenticationBase {
|
|
12
|
+
login: (options: ILoginOptions, eventEmitter: EventEmitter) => Promise<void>;
|
|
13
|
+
validateCurrentSession: (currentSessionId: string) => Promise<(ISessionInfo & ISessionInternalInfo) | null>;
|
|
14
|
+
handleIncomingRedirect: (url: string, eventEmitter: EventEmitter) => Promise<ISessionInfo | undefined>;
|
|
15
|
+
private cleanUrlAfterRedirect;
|
|
16
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
import type { ILoginInputOptions, ISessionInfo, IStorage, IHasSessionEventListener, ISessionEventListener, ILogoutOptions } from "@inrupt/solid-client-authn-core";
|
|
5
|
+
import type ClientAuthentication from "./ClientAuthentication";
|
|
6
|
+
export interface ISessionOptions {
|
|
7
|
+
/**
|
|
8
|
+
* A private storage, unreachable to other scripts on the page. Typically in-memory.
|
|
9
|
+
*/
|
|
10
|
+
secureStorage: IStorage;
|
|
11
|
+
/**
|
|
12
|
+
* A storage where non-sensitive information may be stored, potentially longer-lived than the secure storage.
|
|
13
|
+
*/
|
|
14
|
+
insecureStorage: IStorage;
|
|
15
|
+
/**
|
|
16
|
+
* Details about the current session
|
|
17
|
+
*/
|
|
18
|
+
sessionInfo: ISessionInfo;
|
|
19
|
+
/**
|
|
20
|
+
* An instance of the library core. Typically obtained using `getClientAuthenticationWithDependencies`.
|
|
21
|
+
*/
|
|
22
|
+
clientAuthentication: ClientAuthentication;
|
|
23
|
+
}
|
|
24
|
+
export interface IHandleIncomingRedirectOptions {
|
|
25
|
+
/**
|
|
26
|
+
* If the user has signed in before, setting this to `true` will automatically
|
|
27
|
+
* redirect them to their Solid Identity Provider, which will then attempt to
|
|
28
|
+
* re-activate the session and send the user back to your app without
|
|
29
|
+
* requiring user interaction.
|
|
30
|
+
* If your app's access has not expired yet and re-activation completed
|
|
31
|
+
* successfully, a `sessionRestore` event will be fired with the URL the user
|
|
32
|
+
* was at before they were redirected to their Solid Identity Provider.
|
|
33
|
+
* See {@link ISessionEventListener}: a callback can be registered to
|
|
34
|
+
* `session.events.on(EVENTS.SESSION_RESTORED, callback)`.
|
|
35
|
+
*/
|
|
36
|
+
restorePreviousSession?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The URL of the page handling the redirect, including the query
|
|
39
|
+
* parameters — these contain the information to process the login.
|
|
40
|
+
* Note: as a convenience, if no URL value is specified here, we default to
|
|
41
|
+
* using the browser's current location.
|
|
42
|
+
*/
|
|
43
|
+
url?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function silentlyAuthenticate(sessionId: string, clientAuthn: ClientAuthentication, session: Session): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling access to private resources after login for instance.
|
|
48
|
+
*/
|
|
49
|
+
export declare class Session implements IHasSessionEventListener {
|
|
50
|
+
/**
|
|
51
|
+
* Information regarding the current session.
|
|
52
|
+
*/
|
|
53
|
+
readonly info: ISessionInfo;
|
|
54
|
+
/**
|
|
55
|
+
* Session attribute exposing the EventEmitter interface, to listen on session
|
|
56
|
+
* events such as login, logout, etc.
|
|
57
|
+
* @since 1.15.0
|
|
58
|
+
*/
|
|
59
|
+
readonly events: ISessionEventListener;
|
|
60
|
+
private clientAuthentication;
|
|
61
|
+
private tokenRequestInProgress;
|
|
62
|
+
/**
|
|
63
|
+
* Session object constructor. Typically called as follows:
|
|
64
|
+
*
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const session = new Session();
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).
|
|
70
|
+
*
|
|
71
|
+
* @param sessionOptions The options enabling the correct instantiation of
|
|
72
|
+
* the session. Either both storages or clientAuthentication are required. For
|
|
73
|
+
* more information, see {@link ISessionOptions}.
|
|
74
|
+
* @param sessionId A string uniquely identifying the session.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
constructor(sessionOptions?: Partial<ISessionOptions>, sessionId?: string | undefined);
|
|
78
|
+
/**
|
|
79
|
+
* Triggers the login process. Note that this method will redirect the user away from your app.
|
|
80
|
+
*
|
|
81
|
+
* @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
|
|
82
|
+
* @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}.
|
|
83
|
+
*/
|
|
84
|
+
login: (options: ILoginInputOptions) => Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
|
|
87
|
+
*
|
|
88
|
+
* @param url The URL from which data should be fetched.
|
|
89
|
+
* @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/).
|
|
90
|
+
*/
|
|
91
|
+
fetch: typeof fetch;
|
|
92
|
+
/**
|
|
93
|
+
* An internal logout function, to control whether or not the logout signal
|
|
94
|
+
* should be sent, i.e. if the logout was user-initiated or is the result of
|
|
95
|
+
* an external event.
|
|
96
|
+
*
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
private internalLogout;
|
|
100
|
+
/**
|
|
101
|
+
* Logs the user out of the application.
|
|
102
|
+
*
|
|
103
|
+
* There are 2 types of logout supported by this library,
|
|
104
|
+
* `app` logout and `idp` logout.
|
|
105
|
+
*
|
|
106
|
+
* App logout will log the user out within the application
|
|
107
|
+
* by clearing any session data from the browser. It does
|
|
108
|
+
* not log the user out of their Solid identity provider,
|
|
109
|
+
* and should not redirect the user away.
|
|
110
|
+
* App logout can be performed as follows:
|
|
111
|
+
* ```typescript
|
|
112
|
+
* await session.logout({ logoutType: 'app' });
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* IDP logout will log the user out of their Solid identity provider,
|
|
116
|
+
* and will redirect the user away from the application to do so. In order
|
|
117
|
+
* for users to be redirected back to `postLogoutUrl` you MUST include the
|
|
118
|
+
* `postLogoutUrl` value in the `post_logout_redirect_uris` field in the
|
|
119
|
+
* [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id).
|
|
120
|
+
* IDP logout can be performed as follows:
|
|
121
|
+
* ```typescript
|
|
122
|
+
* await session.logout({
|
|
123
|
+
* logoutType: 'idp',
|
|
124
|
+
* // An optional URL to redirect to after logout has completed;
|
|
125
|
+
* // this MUST match a logout URL listed in the Client ID Document
|
|
126
|
+
* // of the application that is logged in.
|
|
127
|
+
* // If the application is logged in with a Client ID that is not
|
|
128
|
+
* // a URI dereferencing to a Client ID Document then users will
|
|
129
|
+
* // not be redirected back to the `postLogoutUrl` after logout.
|
|
130
|
+
* postLogoutUrl: 'https://example.com/logout',
|
|
131
|
+
* // An optional value to be included in the query parameters
|
|
132
|
+
* // when the IDP provider redirects the user to the postLogoutRedirectUrl.
|
|
133
|
+
* state: "my-state"
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
logout: (options?: ILogoutOptions) => Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Completes the login process by processing the information provided by the
|
|
140
|
+
* Solid identity provider through redirect.
|
|
141
|
+
*
|
|
142
|
+
* @param options See {@link IHandleIncomingRedirectOptions}.
|
|
143
|
+
*/
|
|
144
|
+
handleIncomingRedirect: (inputOptions?: string | IHandleIncomingRedirectOptions) => Promise<ISessionInfo | undefined>;
|
|
145
|
+
private setSessionInfo;
|
|
146
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Session } from "./Session";
|
|
2
|
+
/**
|
|
3
|
+
* Obtain the {@link Session} used when not explicitly instantiating one yourself.
|
|
4
|
+
*
|
|
5
|
+
* When using the top-level exports {@link fetch}, {@link login}, {@link logout},
|
|
6
|
+
* {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an
|
|
7
|
+
* implicitly-instantiated {@link Session}.
|
|
8
|
+
* This function returns a reference to that Session in order to obtain e.g. the current user's
|
|
9
|
+
* WebID.
|
|
10
|
+
* @since 1.3.0
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDefaultSession(): Session;
|
|
13
|
+
/**
|
|
14
|
+
* This function's signature is equal to `window.fetch`, but if the current user is authenticated
|
|
15
|
+
* (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's
|
|
16
|
+
* credentials. If not, this will behave just like the regular `window.fetch`.
|
|
17
|
+
*
|
|
18
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch}
|
|
19
|
+
* @since 1.3.0
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetch(...args: Parameters<Session["fetch"]>): ReturnType<Session["fetch"]>;
|
|
22
|
+
/**
|
|
23
|
+
* Triggers the login process. Note that this method will redirect the user away from your app.
|
|
24
|
+
*
|
|
25
|
+
* @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.
|
|
26
|
+
* @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].
|
|
27
|
+
* @since 1.3.0
|
|
28
|
+
*/
|
|
29
|
+
export declare function login(...args: Parameters<Session["login"]>): ReturnType<Session["login"]>;
|
|
30
|
+
/**
|
|
31
|
+
* Logs the user out of the application.
|
|
32
|
+
*
|
|
33
|
+
* By default this does not log the user out of their Solid identity provider.
|
|
34
|
+
* In order to do so, you must set the logoutType to `idp`. For usage details
|
|
35
|
+
* see {@link Session.logout}.
|
|
36
|
+
*
|
|
37
|
+
* @since 1.3.0
|
|
38
|
+
*/
|
|
39
|
+
export declare function logout(...args: Parameters<Session["logout"]>): ReturnType<Session["logout"]>;
|
|
40
|
+
/**
|
|
41
|
+
* Completes the login process by processing the information provided by the Solid identity provider through redirect.
|
|
42
|
+
*
|
|
43
|
+
* @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.
|
|
44
|
+
* @since 1.3.0
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleIncomingRedirect(...args: Parameters<Session["handleIncomingRedirect"]>): ReturnType<Session["handleIncomingRedirect"]>;
|
|
47
|
+
/**
|
|
48
|
+
* {@link SessionEventEmitter} instance to subscribe to events by the default session.
|
|
49
|
+
*
|
|
50
|
+
* @since 1.14.0
|
|
51
|
+
*/
|
|
52
|
+
export declare function events(): Session["events"];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Top Level core document. Responsible for setting up the dependency graph
|
|
7
|
+
*/
|
|
8
|
+
import type { IStorage } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
import ClientAuthentication from "./ClientAuthentication";
|
|
10
|
+
/**
|
|
11
|
+
* @param dependencies
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export declare function getClientAuthenticationWithDependencies(dependencies: {
|
|
15
|
+
secureStorage?: IStorage;
|
|
16
|
+
insecureStorage?: IStorage;
|
|
17
|
+
}): ClientAuthentication;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Session, ISessionOptions, IHandleIncomingRedirectOptions, } from "./Session";
|
|
2
|
+
export * from "./defaultSession";
|
|
3
|
+
export { ILoginInputOptions, ISessionInfo, IStorage, NotImplementedError, ConfigurationError, InMemoryStorage, IHasSessionEventListener, ISessionEventListener, IEndSessionOptions, ILogoutOptions, EVENTS, } from "@inrupt/solid-client-authn-core";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Responsible for selecting the correct OidcHandler to handle the provided OIDC Options
|
|
7
|
+
*/
|
|
8
|
+
import type { IOidcHandler, IOidcOptions, LoginResult } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
import { AggregateHandler } from "@inrupt/solid-client-authn-core";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export default class AggregateOidcHandler extends AggregateHandler<[IOidcOptions], LoginResult> implements IOidcHandler {
|
|
14
|
+
constructor(oidcLoginHandlers: IOidcHandler[]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Responsible for selecting the correct OidcHandler to handle the provided OIDC Options
|
|
7
|
+
*/
|
|
8
|
+
import type { IIncomingRedirectHandler, IncomingRedirectInput, IncomingRedirectResult } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
import { AggregateHandler } from "@inrupt/solid-client-authn-core";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export default class AggregateRedirectHandler extends AggregateHandler<IncomingRedirectInput, IncomingRedirectResult> implements IIncomingRedirectHandler {
|
|
14
|
+
constructor(redirectHandlers: IIncomingRedirectHandler[]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IStorageUtility, IClientRegistrar, IIssuerConfig, IClient, IClientRegistrarOptions } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export default class ClientRegistrar implements IClientRegistrar {
|
|
10
|
+
private storageUtility;
|
|
11
|
+
constructor(storageUtility: IStorageUtility);
|
|
12
|
+
getClient(options: IClientRegistrarOptions, issuerConfig: IIssuerConfig): Promise<IClient>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Responsible for fetching an IDP configuration
|
|
7
|
+
*/
|
|
8
|
+
import type { IIssuerConfig, IIssuerConfigFetcher, IStorageUtility } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
export declare const WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export default class IssuerConfigFetcher implements IIssuerConfigFetcher {
|
|
14
|
+
private storageUtility;
|
|
15
|
+
constructor(storageUtility: IStorageUtility);
|
|
16
|
+
static getLocalStorageKey(issuer: string): string;
|
|
17
|
+
fetchConfig(issuer: string): Promise<IIssuerConfig>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handles Common Oidc login functions (Like fetching the configuration)
|
|
7
|
+
*/
|
|
8
|
+
import type { IClientRegistrar, IIssuerConfigFetcher, ILoginOptions, ILoginHandler, IOidcHandler, IStorageUtility, LoginResult } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export default class OidcLoginHandler implements ILoginHandler {
|
|
13
|
+
private storageUtility;
|
|
14
|
+
private oidcHandler;
|
|
15
|
+
private issuerConfigFetcher;
|
|
16
|
+
private clientRegistrar;
|
|
17
|
+
constructor(storageUtility: IStorageUtility, oidcHandler: IOidcHandler, issuerConfigFetcher: IIssuerConfigFetcher, clientRegistrar: IClientRegistrar);
|
|
18
|
+
canHandle(options: ILoginOptions): Promise<boolean>;
|
|
19
|
+
handle(options: ILoginOptions): Promise<LoginResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IRedirector, IRedirectorOptions } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export default class Redirector implements IRedirector {
|
|
10
|
+
redirect(redirectUrl: string, options?: IRedirectorOptions): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IClientRegistrar, IIssuerConfigFetcher, IIncomingRedirectHandler, ISessionInfoManager, IStorageUtility, ITokenRefresher, IncomingRedirectResult } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
import type { EventEmitter } from "events";
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export declare class AuthCodeRedirectHandler implements IIncomingRedirectHandler {
|
|
11
|
+
private storageUtility;
|
|
12
|
+
private sessionInfoManager;
|
|
13
|
+
private issuerConfigFetcher;
|
|
14
|
+
private clientRegistrar;
|
|
15
|
+
private tokerRefresher;
|
|
16
|
+
constructor(storageUtility: IStorageUtility, sessionInfoManager: ISessionInfoManager, issuerConfigFetcher: IIssuerConfigFetcher, clientRegistrar: IClientRegistrar, tokerRefresher: ITokenRefresher);
|
|
17
|
+
canHandle(redirectUrl: string): Promise<boolean>;
|
|
18
|
+
handle(redirectUrl: string, eventEmitter?: EventEmitter): Promise<IncomingRedirectResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IIncomingRedirectHandler, ISessionInfo } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
import type { EventEmitter } from "events";
|
|
7
|
+
/**
|
|
8
|
+
* This class handles redirect IRIs without any query params, and returns an unauthenticated
|
|
9
|
+
* session. It serves as a fallback so that consuming libraries don't have to test
|
|
10
|
+
* for the query params themselves, and can always try to use them as a redirect IRI.
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare class ErrorOidcHandler implements IIncomingRedirectHandler {
|
|
14
|
+
canHandle(redirectUrl: string): Promise<boolean>;
|
|
15
|
+
handle(redirectUrl: string, eventEmitter?: EventEmitter): Promise<ISessionInfo & {
|
|
16
|
+
fetch: typeof fetch;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IIncomingRedirectHandler, ISessionInfo } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
/**
|
|
7
|
+
* This class handles redirect IRIs without any query params, and returns an unauthenticated
|
|
8
|
+
* session. It serves as a fallback so that consuming libraries don't have to test
|
|
9
|
+
* for the query params themselves, and can always try to use them as a redirect IRI.
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare class FallbackRedirectHandler implements IIncomingRedirectHandler {
|
|
13
|
+
canHandle(redirectUrl: string): Promise<boolean>;
|
|
14
|
+
handle(_redirectUrl: string): Promise<ISessionInfo & {
|
|
15
|
+
fetch: typeof fetch;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handler for the Authorization Code with PKCE Flow
|
|
7
|
+
*/
|
|
8
|
+
import type { IOidcHandler, IOidcOptions, LoginResult } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
import { AuthorizationCodeWithPkceOidcHandlerBase } from "@inrupt/solid-client-authn-core";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
* Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth
|
|
13
|
+
* PKCE: https://tools.ietf.org/html/rfc7636
|
|
14
|
+
*/
|
|
15
|
+
export default class AuthorizationCodeWithPkceOidcHandler extends AuthorizationCodeWithPkceOidcHandlerBase implements IOidcHandler {
|
|
16
|
+
handle(oidcLoginOptions: IOidcOptions): Promise<LoginResult>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IClientRegistrar, IIssuerConfigFetcher, IStorageUtility, KeyPair, ITokenRefresher, TokenEndpointResponse } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
import type { EventEmitter } from "events";
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export default class TokenRefresher implements ITokenRefresher {
|
|
11
|
+
private storageUtility;
|
|
12
|
+
private issuerConfigFetcher;
|
|
13
|
+
private clientRegistrar;
|
|
14
|
+
constructor(storageUtility: IStorageUtility, issuerConfigFetcher: IIssuerConfigFetcher, clientRegistrar: IClientRegistrar);
|
|
15
|
+
refresh(sessionId: string, refreshToken?: string, dpopKey?: KeyPair, eventEmitter?: EventEmitter): Promise<TokenEndpointResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IEndSessionOptions, IRpLogoutOptions } from "@inrupt/solid-client-authn-core";
|
|
2
|
+
/**
|
|
3
|
+
* @param options.endSessionEndpoint The end_session_endpoint advertised by the server
|
|
4
|
+
* @param options.idTokenHint The idToken supplied by the server after logging in
|
|
5
|
+
* Redirects the window to the location required to perform RP initiated logout
|
|
6
|
+
*
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }: Omit<IEndSessionOptions, keyof IRpLogoutOptions>): ({ state, postLogoutUrl }: IRpLogoutOptions) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { ISessionInfo, ISessionInfoManager, ISessionInternalInfo, IStorageUtility } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
import { SessionInfoManagerBase } from "@inrupt/solid-client-authn-core";
|
|
7
|
+
export { getUnauthenticatedSession } from "@inrupt/solid-client-authn-core";
|
|
8
|
+
/**
|
|
9
|
+
* @param sessionId
|
|
10
|
+
* @param storage
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare function clear(sessionId: string, storage: IStorageUtility): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare class SessionInfoManager extends SessionInfoManagerBase implements ISessionInfoManager {
|
|
18
|
+
get(sessionId: string): Promise<(ISessionInfo & ISessionInternalInfo) | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* This function removes all session-related information from storage.
|
|
21
|
+
* @param sessionId the session identifier
|
|
22
|
+
* @param storage the storage where session info is stored
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
clear(sessionId: string): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import type { IStorage } from "@inrupt/solid-client-authn-core";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export default class BrowserStorage implements IStorage {
|
|
10
|
+
get storage(): typeof window.localStorage;
|
|
11
|
+
get(key: string): Promise<string | undefined>;
|
|
12
|
+
set(key: string, value: string): Promise<void>;
|
|
13
|
+
delete(key: string): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A helper class that will validate items taken from local storage
|
|
7
|
+
*/
|
|
8
|
+
import type { IStorage } from "@inrupt/solid-client-authn-core";
|
|
9
|
+
import { StorageUtility } from "@inrupt/solid-client-authn-core";
|
|
10
|
+
/**
|
|
11
|
+
* This class in a no-value-added extension of StorageUtility from the core module.
|
|
12
|
+
* The reason it has to be declared is for TSyringe to find the decorators in the
|
|
13
|
+
* same modules as where the dependency container is declared (in this case,
|
|
14
|
+
* the browser module, with the dependancy container in dependencies.ts).
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export default class StorageUtilityBrowser extends StorageUtility {
|
|
18
|
+
constructor(secureStorage: IStorage, insecureStorage: IStorage);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserStorage.d.ts","sourceRoot":"","sources":["../../src/storage/BrowserStorage.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ;IACrD,IAAI,OAAO,IAAI,OAAO,MAAM,CAAC,YAAY,CAExC;IAEK,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI7C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageUtility.d.ts","sourceRoot":"","sources":["../../src/storage/StorageUtility.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AAEH;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,cAAc;gBACnD,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ;CAG/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UuidGenerator.d.ts","sourceRoot":"","sources":["../../src/util/UuidGenerator.ts"],"names":[],"mappings":"AA8BA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,IAAI,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,EAAE,IAAI,MAAM;CAGb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inrupt/solid-client-authn-browser",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@types/uuid": "^10.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@inrupt/oidc-client-ext": "^4.0.
|
|
34
|
-
"@inrupt/solid-client-authn-core": "^4.0.
|
|
33
|
+
"@inrupt/oidc-client-ext": "^4.0.1",
|
|
34
|
+
"@inrupt/solid-client-authn-core": "^4.0.1",
|
|
35
35
|
"events": "^3.3.0",
|
|
36
36
|
"jose": "^5.1.3",
|
|
37
37
|
"uuid": "^11.1.0"
|