academe-kit 0.1.1 → 0.1.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/index.d.ts CHANGED
@@ -47,6 +47,9 @@ type KeycloakUser = {
47
47
  name: string;
48
48
  lastName: string;
49
49
  email: string;
50
+ attributes: {
51
+ school_ids: Array<string>;
52
+ };
50
53
  };
51
54
  type SecurityContextType = {
52
55
  isInitialized: boolean;
package/dist/index.esm.js CHANGED
@@ -2239,6 +2239,9 @@ const SecurityContext = createContext({
2239
2239
  email: "",
2240
2240
  name: "",
2241
2241
  lastName: "",
2242
+ attributes: {
2243
+ school_ids: [],
2244
+ },
2242
2245
  }),
2243
2246
  signOut: () => null,
2244
2247
  goToLogin: () => null,
@@ -2257,10 +2260,14 @@ const SecurityProvider = ({ hubUrl, children, }) => {
2257
2260
  window.accessToken = keycloak.token;
2258
2261
  }, [keycloak.token]);
2259
2262
  const getUser = () => {
2263
+ const idTokenParsed = keycloak?.idTokenParsed || {};
2260
2264
  return {
2261
2265
  email: keycloak?.idTokenParsed?.email || "",
2262
2266
  name: keycloak?.idTokenParsed?.given_name || "",
2263
2267
  lastName: keycloak?.idTokenParsed?.family_name || "",
2268
+ attributes: {
2269
+ school_ids: (idTokenParsed.school_ids || []),
2270
+ },
2264
2271
  };
2265
2272
  };
2266
2273
  const redirectToHub = (errorMessage) => {