@multiplatform.one/keycloak 1.0.2 → 1.0.3

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.
Files changed (169) hide show
  1. package/package.json +32 -34
  2. package/routes/index.d.ts +1 -1
  3. package/routes/index.js +1 -1
  4. package/src/Authenticated.tsx +12 -13
  5. package/src/apollo.ts +1 -1
  6. package/src/authConfig.ts +2 -0
  7. package/src/hooks/useTokensFromQuery/index.ts +2 -0
  8. package/src/hooks/useTokensFromState.ts +2 -2
  9. package/{lib/@types/expoKeycloakAuth.d.d.mts → src/keycloak/config.ts} +17 -6
  10. package/src/keycloak/context.ts +3 -1
  11. package/src/keycloak/index.ts +1 -0
  12. package/src/keycloak/keycloak.native.ts +49 -15
  13. package/src/keycloak/keycloak.ts +66 -11
  14. package/src/provider/AfterAuth.tsx +2 -0
  15. package/src/provider/AuthProvider/AuthProvider.native.tsx +159 -6
  16. package/src/provider/AuthProvider/AuthProvider.tsx +66 -43
  17. package/src/provider/KeycloakProvider.tsx +12 -2
  18. package/src/routes.ts +19 -0
  19. package/src/session/session.ts +4 -15
  20. package/src/token.ts +13 -5
  21. package/lib/@types/expoKeycloakAuth.d.d.ts +0 -25
  22. package/lib/@types/expoKeycloakAuth.d.js +0 -1
  23. package/lib/@types/expoKeycloakAuth.d.mjs +0 -0
  24. package/lib/Authenticated.d.mts +0 -32
  25. package/lib/Authenticated.d.ts +0 -32
  26. package/lib/Authenticated.js +0 -20
  27. package/lib/Authenticated.mjs +0 -20
  28. package/lib/apollo.d.mts +0 -7
  29. package/lib/apollo.d.ts +0 -7
  30. package/lib/apollo.js +0 -15
  31. package/lib/apollo.mjs +0 -15
  32. package/lib/authConfig.d.mts +0 -12
  33. package/lib/authConfig.d.ts +0 -12
  34. package/lib/authConfig.js +0 -9
  35. package/lib/authConfig.mjs +0 -9
  36. package/lib/chunk-2L5TXBDK.mjs +0 -7
  37. package/lib/chunk-2MYOFYAK.mjs +0 -53
  38. package/lib/chunk-2VDDEPLF.js +0 -27
  39. package/lib/chunk-2VGMJ7WP.js +0 -34
  40. package/lib/chunk-32AVT4GA.js +0 -9
  41. package/lib/chunk-3ZTSLDX7.js +0 -13
  42. package/lib/chunk-6APOOEW6.js +0 -28
  43. package/lib/chunk-6F4PWJZI.js +0 -1
  44. package/lib/chunk-6FRYV4MK.mjs +0 -27
  45. package/lib/chunk-6WBHOY7M.js +0 -50
  46. package/lib/chunk-74FSREBY.js +0 -161
  47. package/lib/chunk-A2V2S4HP.js +0 -22
  48. package/lib/chunk-BUZONXAW.js +0 -1
  49. package/lib/chunk-C6TOWKPW.mjs +0 -245
  50. package/lib/chunk-DNEUOHZQ.mjs +0 -28
  51. package/lib/chunk-EGCPD3BX.js +0 -51
  52. package/lib/chunk-HH32BME2.mjs +0 -0
  53. package/lib/chunk-HTWZLBA4.mjs +0 -13
  54. package/lib/chunk-I5FNGKQ6.js +0 -16
  55. package/lib/chunk-IGSEESI3.mjs +0 -51
  56. package/lib/chunk-JAFUI2JQ.mjs +0 -9
  57. package/lib/chunk-JPQI72HR.mjs +0 -0
  58. package/lib/chunk-KWNIT4G4.mjs +0 -34
  59. package/lib/chunk-L3HTVJ4B.mjs +0 -13
  60. package/lib/chunk-MDAAMGTE.js +0 -1
  61. package/lib/chunk-NQMFZ6RW.mjs +0 -50
  62. package/lib/chunk-OAUYHIWG.mjs +0 -0
  63. package/lib/chunk-OBB23GPX.mjs +0 -0
  64. package/lib/chunk-OYWXU5N7.mjs +0 -161
  65. package/lib/chunk-P57PW2II.js +0 -11
  66. package/lib/chunk-TUJRPTZE.js +0 -13
  67. package/lib/chunk-UESWAK47.mjs +0 -0
  68. package/lib/chunk-UKSHA3X3.mjs +0 -16
  69. package/lib/chunk-VS4M7GMO.js +0 -1
  70. package/lib/chunk-W4LGQZMF.js +0 -245
  71. package/lib/chunk-WBQAMGXK.mjs +0 -0
  72. package/lib/chunk-WMH347OL.mjs +0 -22
  73. package/lib/chunk-WS4IMGVL.js +0 -1
  74. package/lib/chunk-YACGLW5Q.js +0 -7
  75. package/lib/chunk-YYYDFAI4.js +0 -53
  76. package/lib/chunk-ZCBD6HWK.js +0 -1
  77. package/lib/chunk-ZFXKCRJC.mjs +0 -11
  78. package/lib/hooks/index.d.mts +0 -5
  79. package/lib/hooks/index.d.ts +0 -5
  80. package/lib/hooks/index.js +0 -19
  81. package/lib/hooks/index.mjs +0 -19
  82. package/lib/hooks/useAuthConfig.d.mts +0 -6
  83. package/lib/hooks/useAuthConfig.d.ts +0 -6
  84. package/lib/hooks/useAuthConfig.js +0 -8
  85. package/lib/hooks/useAuthConfig.mjs +0 -8
  86. package/lib/hooks/useTokensFromQuery/index.d.mts +0 -3
  87. package/lib/hooks/useTokensFromQuery/index.d.ts +0 -3
  88. package/lib/hooks/useTokensFromQuery/index.js +0 -7
  89. package/lib/hooks/useTokensFromQuery/index.mjs +0 -7
  90. package/lib/hooks/useTokensFromQuery/index.native.d.mts +0 -3
  91. package/lib/hooks/useTokensFromQuery/index.native.d.ts +0 -3
  92. package/lib/hooks/useTokensFromQuery/index.native.js +0 -7
  93. package/lib/hooks/useTokensFromQuery/index.native.mjs +0 -7
  94. package/lib/hooks/useTokensFromState.d.mts +0 -3
  95. package/lib/hooks/useTokensFromState.d.ts +0 -3
  96. package/lib/hooks/useTokensFromState.js +0 -9
  97. package/lib/hooks/useTokensFromState.mjs +0 -9
  98. package/lib/index.d.mts +0 -18
  99. package/lib/index.d.ts +0 -18
  100. package/lib/index.js +0 -70
  101. package/lib/index.mjs +0 -70
  102. package/lib/keycloak/context.d.mts +0 -12
  103. package/lib/keycloak/context.d.ts +0 -12
  104. package/lib/keycloak/context.js +0 -7
  105. package/lib/keycloak/context.mjs +0 -7
  106. package/lib/keycloak/index.d.mts +0 -7
  107. package/lib/keycloak/index.d.ts +0 -7
  108. package/lib/keycloak/index.js +0 -14
  109. package/lib/keycloak/index.mjs +0 -14
  110. package/lib/keycloak/keycloak.d.mts +0 -37
  111. package/lib/keycloak/keycloak.d.ts +0 -37
  112. package/lib/keycloak/keycloak.js +0 -13
  113. package/lib/keycloak/keycloak.mjs +0 -13
  114. package/lib/keycloak/keycloak.native.d.mts +0 -33
  115. package/lib/keycloak/keycloak.native.d.ts +0 -33
  116. package/lib/keycloak/keycloak.native.js +0 -134
  117. package/lib/keycloak/keycloak.native.mjs +0 -134
  118. package/lib/provider/AfterAuth.d.mts +0 -28
  119. package/lib/provider/AfterAuth.d.ts +0 -28
  120. package/lib/provider/AfterAuth.js +0 -18
  121. package/lib/provider/AfterAuth.mjs +0 -18
  122. package/lib/provider/AuthProvider/AuthProvider.d.mts +0 -37
  123. package/lib/provider/AuthProvider/AuthProvider.d.ts +0 -37
  124. package/lib/provider/AuthProvider/AuthProvider.js +0 -19
  125. package/lib/provider/AuthProvider/AuthProvider.mjs +0 -19
  126. package/lib/provider/AuthProvider/AuthProvider.native.d.mts +0 -29
  127. package/lib/provider/AuthProvider/AuthProvider.native.d.ts +0 -29
  128. package/lib/provider/AuthProvider/AuthProvider.native.js +0 -25
  129. package/lib/provider/AuthProvider/AuthProvider.native.mjs +0 -25
  130. package/lib/provider/AuthProvider/index.d.mts +0 -4
  131. package/lib/provider/AuthProvider/index.d.ts +0 -4
  132. package/lib/provider/AuthProvider/index.js +0 -20
  133. package/lib/provider/AuthProvider/index.mjs +0 -20
  134. package/lib/provider/KeycloakProvider.d.mts +0 -34
  135. package/lib/provider/KeycloakProvider.d.ts +0 -34
  136. package/lib/provider/KeycloakProvider.js +0 -21
  137. package/lib/provider/KeycloakProvider.mjs +0 -21
  138. package/lib/provider/index.d.mts +0 -8
  139. package/lib/provider/index.d.ts +0 -8
  140. package/lib/provider/index.js +0 -28
  141. package/lib/provider/index.mjs +0 -28
  142. package/lib/routes.d.mts +0 -34
  143. package/lib/routes.d.ts +0 -34
  144. package/lib/routes.js +0 -131
  145. package/lib/routes.mjs +0 -131
  146. package/lib/session/index.d.mts +0 -3
  147. package/lib/session/index.d.ts +0 -3
  148. package/lib/session/index.js +0 -10
  149. package/lib/session/index.mjs +0 -10
  150. package/lib/session/session.d.mts +0 -18
  151. package/lib/session/session.d.ts +0 -18
  152. package/lib/session/session.js +0 -9
  153. package/lib/session/session.mjs +0 -9
  154. package/lib/session/session.native.d.mts +0 -8
  155. package/lib/session/session.native.d.ts +0 -8
  156. package/lib/session/session.native.js +0 -13
  157. package/lib/session/session.native.mjs +0 -13
  158. package/lib/state.d.mts +0 -12
  159. package/lib/state.d.ts +0 -12
  160. package/lib/state.js +0 -9
  161. package/lib/state.mjs +0 -9
  162. package/lib/token.d.mts +0 -17
  163. package/lib/token.d.ts +0 -17
  164. package/lib/token.js +0 -9
  165. package/lib/token.mjs +0 -9
  166. package/lib/types.d.mts +0 -20
  167. package/lib/types.d.ts +0 -20
  168. package/lib/types.js +0 -1
  169. package/lib/types.mjs +0 -1
package/lib/index.js DELETED
@@ -1,70 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-WS4IMGVL.js');
2
- require('./chunk-BUZONXAW.js');
3
-
4
-
5
- var _chunk6APOOEW6js = require('./chunk-6APOOEW6.js');
6
- require('./chunk-MDAAMGTE.js');
7
-
8
-
9
- var _chunkW4LGQZMFjs = require('./chunk-W4LGQZMF.js');
10
-
11
-
12
- var _chunkEGCPD3BXjs = require('./chunk-EGCPD3BX.js');
13
-
14
-
15
-
16
- var _chunk6WBHOY7Mjs = require('./chunk-6WBHOY7M.js');
17
- require('./chunk-ZCBD6HWK.js');
18
-
19
-
20
- var _chunkTUJRPTZEjs = require('./chunk-TUJRPTZE.js');
21
-
22
-
23
- var _chunk3ZTSLDX7js = require('./chunk-3ZTSLDX7.js');
24
-
25
-
26
- var _chunkI5FNGKQ6js = require('./chunk-I5FNGKQ6.js');
27
-
28
-
29
-
30
-
31
- var _chunkYYYDFAI4js = require('./chunk-YYYDFAI4.js');
32
- require('./chunk-VS4M7GMO.js');
33
-
34
-
35
-
36
-
37
- var _chunk74FSREBYjs = require('./chunk-74FSREBY.js');
38
- require('./chunk-YACGLW5Q.js');
39
-
40
-
41
-
42
- var _chunk2VGMJ7WPjs = require('./chunk-2VGMJ7WP.js');
43
-
44
-
45
-
46
- var _chunk32AVT4GAjs = require('./chunk-32AVT4GA.js');
47
- require('./chunk-A2V2S4HP.js');
48
- require('./chunk-2VDDEPLF.js');
49
- require('./chunk-P57PW2II.js');
50
- require('./chunk-6F4PWJZI.js');
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
- exports.AfterAuth = _chunkEGCPD3BXjs.AfterAuth; exports.AuthConfigContext = _chunk32AVT4GAjs.AuthConfigContext; exports.AuthProvider = _chunkW4LGQZMFjs.AuthProvider; exports.Authenticated = _chunk6WBHOY7Mjs.Authenticated; exports.Keycloak = _chunk74FSREBYjs.Keycloak; exports.KeycloakProvider = _chunk6APOOEW6js.KeycloakProvider; exports.defaultAuthConfig = _chunk32AVT4GAjs.defaultAuthConfig; exports.getKeycloak = _chunk74FSREBYjs.getKeycloak; exports.getSession = _chunk2VGMJ7WPjs.getSession; exports.useAuthConfig = _chunk3ZTSLDX7js.useAuthConfig; exports.useAuthMutation = _chunkYYYDFAI4js.useAuthMutation; exports.useAuthQuery = _chunkYYYDFAI4js.useAuthQuery; exports.useAuthSubscription = _chunkYYYDFAI4js.useAuthSubscription; exports.useKeycloak = _chunk74FSREBYjs.useKeycloak; exports.useSession = _chunk2VGMJ7WPjs.useSession; exports.useTokensFromQuery = _chunkTUJRPTZEjs.useTokensFromQuery; exports.useTokensFromState = _chunkI5FNGKQ6js.useTokensFromState; exports.withAuthenticated = _chunk6WBHOY7Mjs.withAuthenticated;
package/lib/index.mjs DELETED
@@ -1,70 +0,0 @@
1
- import "./chunk-OAUYHIWG.mjs";
2
- import "./chunk-UESWAK47.mjs";
3
- import {
4
- KeycloakProvider
5
- } from "./chunk-DNEUOHZQ.mjs";
6
- import "./chunk-JPQI72HR.mjs";
7
- import {
8
- AuthProvider
9
- } from "./chunk-C6TOWKPW.mjs";
10
- import {
11
- AfterAuth
12
- } from "./chunk-IGSEESI3.mjs";
13
- import {
14
- Authenticated,
15
- withAuthenticated
16
- } from "./chunk-NQMFZ6RW.mjs";
17
- import "./chunk-HH32BME2.mjs";
18
- import {
19
- useTokensFromQuery
20
- } from "./chunk-L3HTVJ4B.mjs";
21
- import {
22
- useAuthConfig
23
- } from "./chunk-HTWZLBA4.mjs";
24
- import {
25
- useTokensFromState
26
- } from "./chunk-UKSHA3X3.mjs";
27
- import {
28
- useAuthMutation,
29
- useAuthQuery,
30
- useAuthSubscription
31
- } from "./chunk-2MYOFYAK.mjs";
32
- import "./chunk-OBB23GPX.mjs";
33
- import {
34
- Keycloak,
35
- getKeycloak,
36
- useKeycloak
37
- } from "./chunk-OYWXU5N7.mjs";
38
- import "./chunk-2L5TXBDK.mjs";
39
- import {
40
- getSession,
41
- useSession
42
- } from "./chunk-KWNIT4G4.mjs";
43
- import {
44
- AuthConfigContext,
45
- defaultAuthConfig
46
- } from "./chunk-JAFUI2JQ.mjs";
47
- import "./chunk-WMH347OL.mjs";
48
- import "./chunk-6FRYV4MK.mjs";
49
- import "./chunk-ZFXKCRJC.mjs";
50
- import "./chunk-WBQAMGXK.mjs";
51
- export {
52
- AfterAuth,
53
- AuthConfigContext,
54
- AuthProvider,
55
- Authenticated,
56
- Keycloak,
57
- KeycloakProvider,
58
- defaultAuthConfig,
59
- getKeycloak,
60
- getSession,
61
- useAuthConfig,
62
- useAuthMutation,
63
- useAuthQuery,
64
- useAuthSubscription,
65
- useKeycloak,
66
- useSession,
67
- useTokensFromQuery,
68
- useTokensFromState,
69
- withAuthenticated
70
- };
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { Keycloak } from './keycloak.mjs';
3
- import 'keycloak-js';
4
- import '../token.mjs';
5
- import 'next-auth';
6
- import 'next-auth/react';
7
- import '../types.mjs';
8
- import '../session/session.mjs';
9
-
10
- declare const KeycloakContext: React.Context<Keycloak | undefined>;
11
-
12
- export { KeycloakContext };
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { Keycloak } from './keycloak.js';
3
- import 'keycloak-js';
4
- import '../token.js';
5
- import 'next-auth';
6
- import 'next-auth/react';
7
- import '../types.js';
8
- import '../session/session.js';
9
-
10
- declare const KeycloakContext: React.Context<Keycloak | undefined>;
11
-
12
- export { KeycloakContext };
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkYACGLW5Qjs = require('../chunk-YACGLW5Q.js');
4
- require('../chunk-P57PW2II.js');
5
-
6
-
7
- exports.KeycloakContext = _chunkYACGLW5Qjs.KeycloakContext;
@@ -1,7 +0,0 @@
1
- import {
2
- KeycloakContext
3
- } from "../chunk-2L5TXBDK.mjs";
4
- import "../chunk-ZFXKCRJC.mjs";
5
- export {
6
- KeycloakContext
7
- };
@@ -1,7 +0,0 @@
1
- export { Keycloak, getKeycloak, useKeycloak } from './keycloak.mjs';
2
- import 'keycloak-js';
3
- import '../token.mjs';
4
- import 'next-auth';
5
- import 'next-auth/react';
6
- import '../types.mjs';
7
- import '../session/session.mjs';
@@ -1,7 +0,0 @@
1
- export { Keycloak, getKeycloak, useKeycloak } from './keycloak.js';
2
- import 'keycloak-js';
3
- import '../token.js';
4
- import 'next-auth';
5
- import 'next-auth/react';
6
- import '../types.js';
7
- import '../session/session.js';
@@ -1,14 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-VS4M7GMO.js');
2
-
3
-
4
-
5
-
6
- var _chunk74FSREBYjs = require('../chunk-74FSREBY.js');
7
- require('../chunk-YACGLW5Q.js');
8
- require('../chunk-2VGMJ7WP.js');
9
- require('../chunk-P57PW2II.js');
10
-
11
-
12
-
13
-
14
- exports.Keycloak = _chunk74FSREBYjs.Keycloak; exports.getKeycloak = _chunk74FSREBYjs.getKeycloak; exports.useKeycloak = _chunk74FSREBYjs.useKeycloak;
@@ -1,14 +0,0 @@
1
- import "../chunk-OBB23GPX.mjs";
2
- import {
3
- Keycloak,
4
- getKeycloak,
5
- useKeycloak
6
- } from "../chunk-OYWXU5N7.mjs";
7
- import "../chunk-2L5TXBDK.mjs";
8
- import "../chunk-KWNIT4G4.mjs";
9
- import "../chunk-ZFXKCRJC.mjs";
10
- export {
11
- Keycloak,
12
- getKeycloak,
13
- useKeycloak
14
- };
@@ -1,37 +0,0 @@
1
- import * as keycloak_js from 'keycloak-js';
2
- import keycloak_js__default, { KeycloakLoginOptions, KeycloakLogoutOptions } from 'keycloak-js';
3
- import { AccessTokenParsed, TokenParsed } from '../token.mjs';
4
- import { AuthOptions } from 'next-auth';
5
- import { GetSessionParams } from 'next-auth/react';
6
- import { KeycloakMock } from '../types.mjs';
7
- import { Session } from '../session/session.mjs';
8
-
9
- declare class Keycloak {
10
- token?: string;
11
- idToken?: string;
12
- refreshToken?: string;
13
- private _idTokenParsed?;
14
- private _refreshTokenParsed?;
15
- private _tokenParsed?;
16
- private keycloakClient?;
17
- private mock;
18
- constructor(input?: string | keycloak_js__default | KeycloakMock | Session, idToken?: string, refreshToken?: string);
19
- get tokenParsed(): AccessTokenParsed | undefined;
20
- get idTokenParsed(): TokenParsed | undefined;
21
- get refreshTokenParsed(): TokenParsed | undefined;
22
- get clientId(): string | undefined;
23
- get email(): any;
24
- get realm(): string | undefined;
25
- get realmAccess(): keycloak_js.KeycloakRoles | undefined;
26
- get resourceAccess(): keycloak_js.KeycloakResourceAccess | undefined;
27
- get sessionId(): string | undefined;
28
- get subject(): string | undefined;
29
- get username(): string | undefined;
30
- login(options?: KeycloakLoginOptions): Promise<void>;
31
- logout(options?: KeycloakLogoutOptions): Promise<void>;
32
- get authenticated(): boolean;
33
- }
34
- declare function useKeycloak(): Keycloak | undefined;
35
- declare function getKeycloak(options?: AuthOptions | GetSessionParams, req?: any, res?: any): Promise<Keycloak>;
36
-
37
- export { Keycloak, getKeycloak, useKeycloak };
@@ -1,37 +0,0 @@
1
- import * as keycloak_js from 'keycloak-js';
2
- import keycloak_js__default, { KeycloakLoginOptions, KeycloakLogoutOptions } from 'keycloak-js';
3
- import { AccessTokenParsed, TokenParsed } from '../token.js';
4
- import { AuthOptions } from 'next-auth';
5
- import { GetSessionParams } from 'next-auth/react';
6
- import { KeycloakMock } from '../types.js';
7
- import { Session } from '../session/session.js';
8
-
9
- declare class Keycloak {
10
- token?: string;
11
- idToken?: string;
12
- refreshToken?: string;
13
- private _idTokenParsed?;
14
- private _refreshTokenParsed?;
15
- private _tokenParsed?;
16
- private keycloakClient?;
17
- private mock;
18
- constructor(input?: string | keycloak_js__default | KeycloakMock | Session, idToken?: string, refreshToken?: string);
19
- get tokenParsed(): AccessTokenParsed | undefined;
20
- get idTokenParsed(): TokenParsed | undefined;
21
- get refreshTokenParsed(): TokenParsed | undefined;
22
- get clientId(): string | undefined;
23
- get email(): any;
24
- get realm(): string | undefined;
25
- get realmAccess(): keycloak_js.KeycloakRoles | undefined;
26
- get resourceAccess(): keycloak_js.KeycloakResourceAccess | undefined;
27
- get sessionId(): string | undefined;
28
- get subject(): string | undefined;
29
- get username(): string | undefined;
30
- login(options?: KeycloakLoginOptions): Promise<void>;
31
- logout(options?: KeycloakLogoutOptions): Promise<void>;
32
- get authenticated(): boolean;
33
- }
34
- declare function useKeycloak(): Keycloak | undefined;
35
- declare function getKeycloak(options?: AuthOptions | GetSessionParams, req?: any, res?: any): Promise<Keycloak>;
36
-
37
- export { Keycloak, getKeycloak, useKeycloak };
@@ -1,13 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunk74FSREBYjs = require('../chunk-74FSREBY.js');
6
- require('../chunk-YACGLW5Q.js');
7
- require('../chunk-2VGMJ7WP.js');
8
- require('../chunk-P57PW2II.js');
9
-
10
-
11
-
12
-
13
- exports.Keycloak = _chunk74FSREBYjs.Keycloak; exports.getKeycloak = _chunk74FSREBYjs.getKeycloak; exports.useKeycloak = _chunk74FSREBYjs.useKeycloak;
@@ -1,13 +0,0 @@
1
- import {
2
- Keycloak,
3
- getKeycloak,
4
- useKeycloak
5
- } from "../chunk-OYWXU5N7.mjs";
6
- import "../chunk-2L5TXBDK.mjs";
7
- import "../chunk-KWNIT4G4.mjs";
8
- import "../chunk-ZFXKCRJC.mjs";
9
- export {
10
- Keycloak,
11
- getKeycloak,
12
- useKeycloak
13
- };
@@ -1,33 +0,0 @@
1
- import * as keycloak_js from 'keycloak-js';
2
- import keycloak_js__default, { KeycloakLoginOptions, KeycloakLogoutOptions } from 'keycloak-js';
3
- import { AccessTokenParsed, TokenParsed } from '../token.mjs';
4
- import { KeycloakMock } from '../types.mjs';
5
-
6
- declare class Keycloak {
7
- token: string;
8
- idToken?: string;
9
- refreshToken?: string;
10
- private _tokenParsed?;
11
- private _idTokenParsed?;
12
- private _refreshTokenParsed?;
13
- private keycloakClient?;
14
- private mock;
15
- constructor(input: string | keycloak_js__default | KeycloakMock, idToken?: string, refreshToken?: string);
16
- get tokenParsed(): AccessTokenParsed | undefined;
17
- get idTokenParsed(): TokenParsed | undefined;
18
- get refreshTokenParsed(): TokenParsed | undefined;
19
- get clientId(): string | undefined;
20
- get email(): any;
21
- get realm(): string | undefined;
22
- get realmAccess(): keycloak_js.KeycloakRoles | undefined;
23
- get resourceAccess(): keycloak_js.KeycloakResourceAccess | undefined;
24
- get sessionId(): string | undefined;
25
- get subject(): string | undefined;
26
- get username(): string | undefined;
27
- login(options?: KeycloakLoginOptions): Promise<void>;
28
- logout(options?: KeycloakLogoutOptions): Promise<void>;
29
- isAuthenticated(): Promise<boolean>;
30
- }
31
- declare function useKeycloak(): Keycloak | undefined;
32
-
33
- export { Keycloak, useKeycloak };
@@ -1,33 +0,0 @@
1
- import * as keycloak_js from 'keycloak-js';
2
- import keycloak_js__default, { KeycloakLoginOptions, KeycloakLogoutOptions } from 'keycloak-js';
3
- import { AccessTokenParsed, TokenParsed } from '../token.js';
4
- import { KeycloakMock } from '../types.js';
5
-
6
- declare class Keycloak {
7
- token: string;
8
- idToken?: string;
9
- refreshToken?: string;
10
- private _tokenParsed?;
11
- private _idTokenParsed?;
12
- private _refreshTokenParsed?;
13
- private keycloakClient?;
14
- private mock;
15
- constructor(input: string | keycloak_js__default | KeycloakMock, idToken?: string, refreshToken?: string);
16
- get tokenParsed(): AccessTokenParsed | undefined;
17
- get idTokenParsed(): TokenParsed | undefined;
18
- get refreshTokenParsed(): TokenParsed | undefined;
19
- get clientId(): string | undefined;
20
- get email(): any;
21
- get realm(): string | undefined;
22
- get realmAccess(): keycloak_js.KeycloakRoles | undefined;
23
- get resourceAccess(): keycloak_js.KeycloakResourceAccess | undefined;
24
- get sessionId(): string | undefined;
25
- get subject(): string | undefined;
26
- get username(): string | undefined;
27
- login(options?: KeycloakLoginOptions): Promise<void>;
28
- logout(options?: KeycloakLogoutOptions): Promise<void>;
29
- isAuthenticated(): Promise<boolean>;
30
- }
31
- declare function useKeycloak(): Keycloak | undefined;
32
-
33
- export { Keycloak, useKeycloak };
@@ -1,134 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunk2VGMJ7WPjs = require('../chunk-2VGMJ7WP.js');
4
- require('../chunk-P57PW2II.js');
5
-
6
- // src/keycloak/keycloak.native.ts
7
- var _multiplatformone = require('multiplatform.one');
8
- var _jwtdecode = require('jwt-decode');
9
- var _expokeycloakauth = require('expo-keycloak-auth');
10
- var Keycloak = class {
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
- constructor(input, idToken, refreshToken) {
20
- if (typeof input === "string") {
21
- this.token = input;
22
- this.idToken = idToken;
23
- this.refreshToken = refreshToken;
24
- } else if (typeof input === "object") {
25
- if (typeof input.init === "function") {
26
- this.keycloakClient = input;
27
- } else {
28
- this.mock = input;
29
- }
30
- }
31
- if (this.token && !this._tokenParsed)
32
- this._tokenParsed = _jwtdecode.jwtDecode.call(void 0, this.token);
33
- if (this.idToken && !this._idTokenParsed)
34
- this._idTokenParsed = _jwtdecode.jwtDecode.call(void 0, this.idToken);
35
- if (this.refreshToken && !this._refreshTokenParsed) {
36
- this._refreshTokenParsed = _jwtdecode.jwtDecode.call(void 0, this.refreshToken);
37
- }
38
- }
39
- get tokenParsed() {
40
- if (this.keycloakClient)
41
- return this.keycloakClient.tokenParsed;
42
- return this._tokenParsed;
43
- }
44
- get idTokenParsed() {
45
- if (this.keycloakClient)
46
- return this.keycloakClient.idTokenParsed;
47
- return this._idTokenParsed;
48
- }
49
- get refreshTokenParsed() {
50
- if (this.keycloakClient)
51
- return this.keycloakClient.refreshTokenParsed;
52
- return this._refreshTokenParsed;
53
- }
54
- get clientId() {
55
- if (this.keycloakClient)
56
- return this.keycloakClient.clientId;
57
- return _optionalChain([this, 'access', _ => _.tokenParsed, 'optionalAccess', _2 => _2.azp]);
58
- }
59
- get email() {
60
- if (this.keycloakClient)
61
- return _optionalChain([this, 'access', _3 => _3.keycloakClient, 'access', _4 => _4.tokenParsed, 'optionalAccess', _5 => _5.email]);
62
- if (this.mock)
63
- return this.mock.email;
64
- return _optionalChain([this, 'access', _6 => _6.tokenParsed, 'optionalAccess', _7 => _7.email]);
65
- }
66
- get realm() {
67
- if (this.keycloakClient)
68
- return this.keycloakClient.realm;
69
- return _optionalChain([this, 'access', _8 => _8.tokenParsed, 'optionalAccess', _9 => _9.iss, 'optionalAccess', _10 => _10.split, 'call', _11 => _11("/"), 'access', _12 => _12.pop, 'call', _13 => _13()]);
70
- }
71
- get realmAccess() {
72
- if (this.keycloakClient)
73
- return this.keycloakClient.realmAccess;
74
- return _optionalChain([this, 'access', _14 => _14.tokenParsed, 'optionalAccess', _15 => _15.realm_access]);
75
- }
76
- get resourceAccess() {
77
- if (this.keycloakClient)
78
- return this.keycloakClient.resourceAccess;
79
- return _optionalChain([this, 'access', _16 => _16.tokenParsed, 'optionalAccess', _17 => _17.resource_access]);
80
- }
81
- get sessionId() {
82
- if (this.keycloakClient)
83
- return this.keycloakClient.sessionId;
84
- return _optionalChain([this, 'access', _18 => _18.tokenParsed, 'optionalAccess', _19 => _19.session_state]);
85
- }
86
- get subject() {
87
- if (this.keycloakClient)
88
- return this.keycloakClient.subject;
89
- return _optionalChain([this, 'access', _20 => _20.tokenParsed, 'optionalAccess', _21 => _21.sub]);
90
- }
91
- get username() {
92
- if (this.mock)
93
- return this.mock.username;
94
- return _optionalChain([this, 'access', _22 => _22.tokenParsed, 'optionalAccess', _23 => _23.preferred_username]);
95
- }
96
- async login(options = {}) {
97
- if (this.keycloakClient) {
98
- await this.keycloakClient.login(options);
99
- }
100
- }
101
- async logout(options = {}) {
102
- if (this.keycloakClient) {
103
- await this.keycloakClient.logout(options);
104
- }
105
- }
106
- async isAuthenticated() {
107
- if (this.mock)
108
- return true;
109
- if (this.keycloakClient)
110
- return !!this.keycloakClient.authenticated;
111
- if (_multiplatformone.MultiPlatform.isNext)
112
- return !!await _chunk2VGMJ7WPjs.getSession.call(void 0, );
113
- if (!_optionalChain([this, 'access', _24 => _24.tokenParsed, 'optionalAccess', _25 => _25.exp]))
114
- return false;
115
- return this.tokenParsed.exp > Date.now() / 1e3;
116
- }
117
- };
118
- function useKeycloak() {
119
- const { token, refreshToken, idToken } = _expokeycloakauth.useKeycloak.call(void 0, );
120
- if (_multiplatformone.MultiPlatform.isServer)
121
- return;
122
- if (_multiplatformone.MultiPlatform.isStorybook) {
123
- return new Keycloak({
124
- email: "storybook@example.com",
125
- username: "storybook"
126
- });
127
- }
128
- if (token)
129
- return new Keycloak(token, idToken, refreshToken);
130
- }
131
-
132
-
133
-
134
- exports.Keycloak = Keycloak; exports.useKeycloak = useKeycloak;
@@ -1,134 +0,0 @@
1
- import {
2
- getSession
3
- } from "../chunk-KWNIT4G4.mjs";
4
- import "../chunk-ZFXKCRJC.mjs";
5
-
6
- // src/keycloak/keycloak.native.ts
7
- import { MultiPlatform } from "multiplatform.one";
8
- import { jwtDecode } from "jwt-decode";
9
- import { useKeycloak as useExpoKeycloak } from "expo-keycloak-auth";
10
- var Keycloak = class {
11
- token;
12
- idToken;
13
- refreshToken;
14
- _tokenParsed;
15
- _idTokenParsed;
16
- _refreshTokenParsed;
17
- keycloakClient;
18
- mock;
19
- constructor(input, idToken, refreshToken) {
20
- if (typeof input === "string") {
21
- this.token = input;
22
- this.idToken = idToken;
23
- this.refreshToken = refreshToken;
24
- } else if (typeof input === "object") {
25
- if (typeof input.init === "function") {
26
- this.keycloakClient = input;
27
- } else {
28
- this.mock = input;
29
- }
30
- }
31
- if (this.token && !this._tokenParsed)
32
- this._tokenParsed = jwtDecode(this.token);
33
- if (this.idToken && !this._idTokenParsed)
34
- this._idTokenParsed = jwtDecode(this.idToken);
35
- if (this.refreshToken && !this._refreshTokenParsed) {
36
- this._refreshTokenParsed = jwtDecode(this.refreshToken);
37
- }
38
- }
39
- get tokenParsed() {
40
- if (this.keycloakClient)
41
- return this.keycloakClient.tokenParsed;
42
- return this._tokenParsed;
43
- }
44
- get idTokenParsed() {
45
- if (this.keycloakClient)
46
- return this.keycloakClient.idTokenParsed;
47
- return this._idTokenParsed;
48
- }
49
- get refreshTokenParsed() {
50
- if (this.keycloakClient)
51
- return this.keycloakClient.refreshTokenParsed;
52
- return this._refreshTokenParsed;
53
- }
54
- get clientId() {
55
- if (this.keycloakClient)
56
- return this.keycloakClient.clientId;
57
- return this.tokenParsed?.azp;
58
- }
59
- get email() {
60
- if (this.keycloakClient)
61
- return this.keycloakClient.tokenParsed?.email;
62
- if (this.mock)
63
- return this.mock.email;
64
- return this.tokenParsed?.email;
65
- }
66
- get realm() {
67
- if (this.keycloakClient)
68
- return this.keycloakClient.realm;
69
- return this.tokenParsed?.iss?.split("/").pop();
70
- }
71
- get realmAccess() {
72
- if (this.keycloakClient)
73
- return this.keycloakClient.realmAccess;
74
- return this.tokenParsed?.realm_access;
75
- }
76
- get resourceAccess() {
77
- if (this.keycloakClient)
78
- return this.keycloakClient.resourceAccess;
79
- return this.tokenParsed?.resource_access;
80
- }
81
- get sessionId() {
82
- if (this.keycloakClient)
83
- return this.keycloakClient.sessionId;
84
- return this.tokenParsed?.session_state;
85
- }
86
- get subject() {
87
- if (this.keycloakClient)
88
- return this.keycloakClient.subject;
89
- return this.tokenParsed?.sub;
90
- }
91
- get username() {
92
- if (this.mock)
93
- return this.mock.username;
94
- return this.tokenParsed?.preferred_username;
95
- }
96
- async login(options = {}) {
97
- if (this.keycloakClient) {
98
- await this.keycloakClient.login(options);
99
- }
100
- }
101
- async logout(options = {}) {
102
- if (this.keycloakClient) {
103
- await this.keycloakClient.logout(options);
104
- }
105
- }
106
- async isAuthenticated() {
107
- if (this.mock)
108
- return true;
109
- if (this.keycloakClient)
110
- return !!this.keycloakClient.authenticated;
111
- if (MultiPlatform.isNext)
112
- return !!await getSession();
113
- if (!this.tokenParsed?.exp)
114
- return false;
115
- return this.tokenParsed.exp > Date.now() / 1e3;
116
- }
117
- };
118
- function useKeycloak() {
119
- const { token, refreshToken, idToken } = useExpoKeycloak();
120
- if (MultiPlatform.isServer)
121
- return;
122
- if (MultiPlatform.isStorybook) {
123
- return new Keycloak({
124
- email: "storybook@example.com",
125
- username: "storybook"
126
- });
127
- }
128
- if (token)
129
- return new Keycloak(token, idToken, refreshToken);
130
- }
131
- export {
132
- Keycloak,
133
- useKeycloak
134
- };