@multiplatform.one/keycloak 0.2.0 → 0.2.2

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/lib/types.js CHANGED
@@ -22,6 +22,4 @@ __export(types_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(types_exports);
24
24
  var types_default = null;
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {});
27
25
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/keycloak",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "keycloak client for multiplatform.one ecosystem",
5
5
  "main": "dist/lib",
6
6
  "module": "dist/esm",
@@ -57,41 +57,40 @@
57
57
  "react-native": "~0.68.5"
58
58
  },
59
59
  "devDependencies": {
60
- "@babel/preset-env": "^7.20.2",
61
- "@babel/preset-flow": "^7.18.6",
60
+ "@babel/preset-env": "^7.21.4",
61
+ "@babel/preset-flow": "^7.21.4",
62
62
  "@babel/preset-react": "^7.18.6",
63
- "@babel/preset-typescript": "^7.21.0",
64
- "@react-native-async-storage/async-storage": "^1.17.11",
65
- "@react-navigation/native": "^6.1.5",
66
- "@types/eslint": "^8.21.1",
67
- "@types/jest": "^29.4.0",
63
+ "@babel/preset-typescript": "^7.21.4",
64
+ "@react-native-async-storage/async-storage": "^1.18.1",
65
+ "@react-navigation/native": "^6.1.6",
66
+ "@types/eslint": "^8.37.0",
67
+ "@types/jest": "^29.5.0",
68
68
  "@types/lodash.camelcase": "^4.3.7",
69
69
  "@types/lodash.startcase": "^4.4.7",
70
- "@types/react": "18.0.28",
71
- "@types/react-native": "0.71.3",
72
- "@typescript-eslint/eslint-plugin": "^5.53.0",
73
- "@typescript-eslint/parser": "^5.53.0",
70
+ "@types/react": "18.0.37",
71
+ "@types/react-native": "0.71.6",
72
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
73
+ "@typescript-eslint/parser": "^5.59.0",
74
74
  "babel-plugin-fully-specified": "^1.3.0",
75
- "cspell": "^6.26.3",
76
- "dripsy": "^3.10.0",
77
- "esbuild": "^0.17.10",
75
+ "cspell": "^6.31.1",
76
+ "esbuild": "^0.17.17",
78
77
  "esbuild-plugin-babel": "^0.2.3",
79
- "eslint": "^8.34.0",
78
+ "eslint": "^8.38.0",
80
79
  "eslint-config-alloy": "^4.9.0",
81
80
  "eslint-plugin-react": "^7.32.2",
82
81
  "eslint-plugin-spellcheck": "^0.0.20",
83
82
  "expo-keycloak-auth": "1.0.14",
84
- "jest": "^29.4.3",
83
+ "jest": "^29.5.0",
85
84
  "jest-sonar-reporter": "^2.0.0",
86
- "keycloak-js": "21.0.0",
85
+ "keycloak-js": "21.0.2",
87
86
  "lockfile-lint": "^4.10.1",
88
87
  "multiplatform.one": "^0.5.21",
89
- "next": "^13.2.1",
90
- "prettier": "^2.8.4",
88
+ "next": "^13.3.0",
89
+ "prettier": "^2.8.7",
91
90
  "react": "^18.2.0",
92
- "react-native": "~0.71.3",
91
+ "react-native": "~0.71.6",
93
92
  "ts-node": "^10.9.1",
94
- "typescript": "^4.9.5"
93
+ "typescript": "^5.0.4"
95
94
  },
96
95
  "packageManager": "yarn@3.3.0",
97
96
  "engines": {
@@ -119,13 +118,14 @@
119
118
  "dependencies": {
120
119
  "@react-keycloak/ssr": "^3.3.0",
121
120
  "@react-keycloak/web": "^3.4.0",
122
- "core-js-pure": "^3.28.0",
123
- "expo-auth-session": "^3.8.0",
124
- "solito": "^2.3.0"
121
+ "core-js-pure": "^3.30.1",
122
+ "expo-auth-session": "^4.0.3",
123
+ "solito": "^3.2.0"
125
124
  },
126
125
  "resolutions": {
127
126
  "expo-keycloak-auth@1.0.14": "patch:expo-keycloak-auth@npm%3A1.0.14#./.yarn/patches/expo-keycloak-auth-npm-1.0.14-78201597ce.patch",
128
- "keycloak-js@21.0.0": "patch:keycloak-js@npm%3A21.0.0#./.yarn/patches/keycloak-js-npm-21.0.0-1387a3b112.patch"
127
+ "keycloak-js@21.0.0": "patch:keycloak-js@npm%3A21.0.0#./.yarn/patches/keycloak-js-npm-21.0.0-1387a3b112.patch",
128
+ "keycloak-js@21.0.2": "patch:keycloak-js@npm%3A21.0.2#./.yarn/patches/keycloak-js-npm-21.0.2-0f4fb90576.patch"
129
129
  },
130
130
  "prettier": "eslint-config-alloy/.prettierrc.js"
131
131
  }
package/src/authConfig.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * File Created: 08-11-2022 09:21:15
5
5
  * Author: Clay Risser
6
6
  * -----
7
- * Last Modified: 25-11-2022 10:29:29
7
+ * Last Modified: 17-04-2023 22:55:41
8
8
  * Modified By: Clay Risser
9
9
  * -----
10
10
  * Risser Labs LLC (c) Copyright 2021 - 2022
@@ -25,6 +25,7 @@
25
25
  import { createContext } from 'react';
26
26
 
27
27
  export const defaultAuthConfig: AuthConfig = {
28
+ ensureFreshness: true,
28
29
  ssr: true,
29
30
  };
30
31
 
@@ -32,6 +33,7 @@ export const AuthConfigContext = createContext<AuthConfig>(defaultAuthConfig);
32
33
 
33
34
  export interface AuthConfig {
34
35
  debug?: boolean;
36
+ ensureFreshness?: boolean;
35
37
  loginRoute?: string;
36
38
  messageHandlerKeys?: string[];
37
39
  ssr?: boolean;
@@ -4,7 +4,7 @@
4
4
  * File Created: 08-11-2022 14:10:44
5
5
  * Author: Clay Risser
6
6
  * -----
7
- * Last Modified: 28-11-2022 14:56:28
7
+ * Last Modified: 17-04-2023 19:14:28
8
8
  * Modified By: Clay Risser
9
9
  * -----
10
10
  * Risser Labs LLC (c) Copyright 2021 - 2022
@@ -33,7 +33,15 @@ export interface IKeycloak {
33
33
  resourceAccess?: KeycloakResourceAccess;
34
34
  subject?: string;
35
35
  token?: string;
36
- tokenParsed?: KeycloakTokenParsed;
36
+ tokenParsed?: ITokenParsed;
37
37
  login: () => Promise<unknown> | unknown;
38
38
  logout: () => Promise<unknown> | unknown;
39
39
  }
40
+
41
+ export interface ITokenParsed extends KeycloakTokenParsed {
42
+ 'allowed-origins'?: string[];
43
+ email_verified?: boolean;
44
+ preferred_username?: string;
45
+ scope?: string;
46
+ sid?: string;
47
+ }
@@ -43,7 +43,7 @@ export const AfterAuth: FC<AfterAuthProps> = ({ children }: AfterAuthProps) => {
43
43
  if (!authenticated) return;
44
44
  if (token) {
45
45
  authState.setToken(token);
46
- if (refreshToken) authState.setRefreshToken(refreshToken);
46
+ if (authConfig.ensureFreshness && refreshToken) authState.setRefreshToken(refreshToken);
47
47
  }
48
48
  }, [token, refreshToken]);
49
49