capacitor-oidc 0.0.6 → 0.1.0
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/README.md +30 -23
- package/SECURITY.md +4 -3
- package/dist/esm/base-capacitor-user-manager.d.ts +30 -0
- package/dist/esm/base-capacitor-user-manager.js +104 -0
- package/dist/esm/base-capacitor-user-manager.js.map +1 -0
- package/dist/esm/capacitor-user-manager.d.ts +9 -32
- package/dist/esm/capacitor-user-manager.js +20 -174
- package/dist/esm/capacitor-user-manager.js.map +1 -1
- package/dist/esm/configuration.d.ts +14 -0
- package/dist/esm/configuration.js +72 -0
- package/dist/esm/configuration.js.map +1 -0
- package/dist/esm/definitions.d.ts +53 -3
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/native-capacitor-user-manager.d.ts +24 -0
- package/dist/esm/native-capacitor-user-manager.js +112 -0
- package/dist/esm/native-capacitor-user-manager.js.map +1 -0
- package/dist/esm/web-capacitor-user-manager.d.ts +11 -0
- package/dist/esm/web-capacitor-user-manager.js +44 -0
- package/dist/esm/web-capacitor-user-manager.js.map +1 -0
- package/dist/plugin.cjs +303 -126
- package/dist/plugin.cjs.map +1 -1
- package/docs/API.md +106 -60
- package/docs/GETTING_STARTED.md +85 -62
- package/docs/PLATFORM_SETUP.md +15 -4
- package/docs/PROVIDERS.md +30 -17
- package/docs/README.md +3 -3
- package/docs/TESTING.md +3 -1
- package/docs/TROUBLESHOOTING.md +23 -13
- package/docs/adr/0004-use-one-manager-across-platforms.md +64 -0
- package/package.json +3 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ADR 0004: Use one manager across platforms
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
The first package boundary was intentionally native-only. It kept the custom
|
|
10
|
+
code small by adapting `oidc-client-ts` only where Capacitor needed native system
|
|
11
|
+
authentication UI and secure storage. Browser methods were rejected, and the
|
|
12
|
+
documentation told applications to instantiate `oidc-client-ts` directly for
|
|
13
|
+
web.
|
|
14
|
+
|
|
15
|
+
That boundary moved platform selection into every consuming application. A
|
|
16
|
+
cross-platform app had to duplicate common settings, create two manager types,
|
|
17
|
+
branch for sign-in, callbacks, refresh, and logout, and depend directly on the
|
|
18
|
+
underlying library. The package abstracted native mechanics but did not provide
|
|
19
|
+
the originally intended application-level abstraction.
|
|
20
|
+
|
|
21
|
+
## Decision
|
|
22
|
+
|
|
23
|
+
`CapacitorUserManager` is the public manager for web, iOS, and Android.
|
|
24
|
+
Configuration is split into:
|
|
25
|
+
|
|
26
|
+
- required `common` public-client settings;
|
|
27
|
+
- optional `web` settings and redirect-or-popup interaction choices;
|
|
28
|
+
- optional `native` settings and native options;
|
|
29
|
+
- optional `ios` and `android` overrides of the native section.
|
|
30
|
+
|
|
31
|
+
Resolution is shallow and happens once:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
web: common -> web
|
|
35
|
+
iOS: common -> native -> ios
|
|
36
|
+
Android: common -> native -> android
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Web uses the upstream browser navigators and configured browser stores. Native
|
|
40
|
+
uses `CapacitorNavigator`, secure stores, refresh-token-only renewal, and the app
|
|
41
|
+
resume listener. `signin()` and `signout()` return `Promise<void>` on all
|
|
42
|
+
platforms; applications read session state through events or user accessors.
|
|
43
|
+
|
|
44
|
+
The public manager is a common base and factory backed by internal web and
|
|
45
|
+
native implementations. Legacy native input is normalized before implementation
|
|
46
|
+
selection, so both factory signatures use the same native behavior.
|
|
47
|
+
|
|
48
|
+
All platforms remain public clients using code flow with PKCE. Web-only
|
|
49
|
+
capabilities stay in the web settings. Native does not accept custom stores,
|
|
50
|
+
DPoP, iframe callbacks, or browser session monitoring.
|
|
51
|
+
|
|
52
|
+
## Consequences
|
|
53
|
+
|
|
54
|
+
- Applications no longer branch between two manager implementations or import
|
|
55
|
+
`oidc-client-ts` directly for normal use.
|
|
56
|
+
- Web callbacks remain explicit application routes through `signinCallback()`
|
|
57
|
+
and `signoutCallback()`.
|
|
58
|
+
- Platform-specific provider values and interaction arguments can differ without
|
|
59
|
+
duplicating common configuration.
|
|
60
|
+
- The pre-1.0 native factory signature is normalized into the new implementation
|
|
61
|
+
as a deprecated migration path. The `Promise<void>` sign-in contract remains a
|
|
62
|
+
return-type change for applications that previously used the returned user.
|
|
63
|
+
- The package still owns no OIDC protocol implementation or provider-specific
|
|
64
|
+
behavior.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-oidc",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OAuth 2.0 and OpenID Connect authentication for Capacitor web, iOS, and Android, powered by oidc-client-ts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"capacitor",
|
|
7
7
|
"capacitor-plugin",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"openid-connect",
|
|
12
12
|
"oidc",
|
|
13
13
|
"pkce",
|
|
14
|
+
"web",
|
|
14
15
|
"ios",
|
|
15
16
|
"android",
|
|
16
17
|
"oidc-client-ts"
|