@backstage/plugin-auth-react 0.0.0-nightly-20240321021124
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/CHANGELOG.md +20 -0
- package/README.md +5 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.esm.js +96 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +53 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @backstage/plugin-auth-react
|
|
2
|
+
|
|
3
|
+
## 0.0.0-nightly-20240321021124
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-components@0.0.0-nightly-20240321021124
|
|
9
|
+
- @backstage/core-plugin-api@1.9.1
|
|
10
|
+
- @backstage/errors@1.2.4
|
|
11
|
+
|
|
12
|
+
## 0.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 62bcaf8: Create a generic React component for refreshing user cookie.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/core-components@0.14.1
|
|
19
|
+
- @backstage/errors@1.2.4
|
|
20
|
+
- @backstage/core-plugin-api@1.9.1
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* Props for the {@link CookieAuthRefreshProvider} component.
|
|
6
|
+
*/
|
|
7
|
+
type CookieAuthRefreshProviderProps = {
|
|
8
|
+
pluginId: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
* A provider that will refresh the cookie when it is about to expire.
|
|
15
|
+
*/
|
|
16
|
+
declare function CookieAuthRefreshProvider(props: CookieAuthRefreshProviderProps): JSX.Element;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
* A hook that will refresh the cookie when it is about to expire.
|
|
21
|
+
* @param options - Options for configuring the refresh cookie endpoint
|
|
22
|
+
*/
|
|
23
|
+
declare function useCookieAuthRefresh(options: {
|
|
24
|
+
pluginId: string;
|
|
25
|
+
path?: string;
|
|
26
|
+
}): {
|
|
27
|
+
status: 'loading';
|
|
28
|
+
} | {
|
|
29
|
+
status: 'error';
|
|
30
|
+
error: Error;
|
|
31
|
+
retry: () => void;
|
|
32
|
+
} | {
|
|
33
|
+
status: 'success';
|
|
34
|
+
data: {
|
|
35
|
+
expiresAt: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { CookieAuthRefreshProvider, type CookieAuthRefreshProviderProps, useCookieAuthRefresh };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useMemo, useCallback, useEffect } from 'react';
|
|
2
|
+
import { ErrorPanel } from '@backstage/core-components';
|
|
3
|
+
import { useApi, fetchApiRef, discoveryApiRef, useApp } from '@backstage/core-plugin-api';
|
|
4
|
+
import { Button } from '@material-ui/core';
|
|
5
|
+
import { useAsync, useMountEffect } from '@react-hookz/web';
|
|
6
|
+
import { ResponseError } from '@backstage/errors';
|
|
7
|
+
|
|
8
|
+
function useCookieAuthRefresh(options) {
|
|
9
|
+
const { pluginId, path = "/cookie" } = options != null ? options : {};
|
|
10
|
+
const fetchApi = useApi(fetchApiRef);
|
|
11
|
+
const discoveryApi = useApi(discoveryApiRef);
|
|
12
|
+
const channel = useMemo(() => {
|
|
13
|
+
return "BroadcastChannel" in window ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`) : null;
|
|
14
|
+
}, [pluginId]);
|
|
15
|
+
const [state, actions] = useAsync(async () => {
|
|
16
|
+
const apiOrigin = await discoveryApi.getBaseUrl(pluginId);
|
|
17
|
+
const requestUrl = `${apiOrigin}${path}`;
|
|
18
|
+
const response = await fetchApi.fetch(`${requestUrl}`, {
|
|
19
|
+
credentials: "include"
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
throw await ResponseError.fromResponse(response);
|
|
23
|
+
}
|
|
24
|
+
const data = await response.json();
|
|
25
|
+
if (!data.expiresAt) {
|
|
26
|
+
throw new Error("No expiration date found in response");
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
});
|
|
30
|
+
useMountEffect(actions.execute);
|
|
31
|
+
const retry = useCallback(() => {
|
|
32
|
+
actions.execute();
|
|
33
|
+
}, [actions]);
|
|
34
|
+
const refresh = useCallback(
|
|
35
|
+
(params) => {
|
|
36
|
+
const margin = (1 + 3 * Math.random()) * 6e4;
|
|
37
|
+
const delay = Date.parse(params.expiresAt) - Date.now() - margin;
|
|
38
|
+
const timeout = setTimeout(retry, delay);
|
|
39
|
+
return () => clearTimeout(timeout);
|
|
40
|
+
},
|
|
41
|
+
[retry]
|
|
42
|
+
);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (state.status !== "success" || !state.result) {
|
|
45
|
+
return () => {
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
channel == null ? void 0 : channel.postMessage({
|
|
49
|
+
action: "COOKIE_REFRESH_SUCCESS",
|
|
50
|
+
payload: state.result
|
|
51
|
+
});
|
|
52
|
+
let cancel = refresh(state.result);
|
|
53
|
+
const listener = (event) => {
|
|
54
|
+
const { action, payload } = event.data;
|
|
55
|
+
if (action === "COOKIE_REFRESH_SUCCESS") {
|
|
56
|
+
cancel();
|
|
57
|
+
cancel = refresh(payload);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
channel == null ? void 0 : channel.addEventListener("message", listener);
|
|
61
|
+
return () => {
|
|
62
|
+
cancel();
|
|
63
|
+
channel == null ? void 0 : channel.removeEventListener("message", listener);
|
|
64
|
+
};
|
|
65
|
+
}, [state, refresh, channel]);
|
|
66
|
+
if (state.status === "not-executed") {
|
|
67
|
+
return { status: "loading" };
|
|
68
|
+
}
|
|
69
|
+
if (state.status === "loading" && !state.result) {
|
|
70
|
+
return { status: "loading" };
|
|
71
|
+
}
|
|
72
|
+
if (state.status === "loading" && state.error) {
|
|
73
|
+
return { status: "loading" };
|
|
74
|
+
}
|
|
75
|
+
if (state.status === "error" && state.error) {
|
|
76
|
+
return { status: "error", error: state.error, retry };
|
|
77
|
+
}
|
|
78
|
+
return { status: "success", data: state.result };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CookieAuthRefreshProvider(props) {
|
|
82
|
+
const { children, ...options } = props;
|
|
83
|
+
const app = useApp();
|
|
84
|
+
const { Progress } = app.getComponents();
|
|
85
|
+
const result = useCookieAuthRefresh(options);
|
|
86
|
+
if (result.status === "loading") {
|
|
87
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
88
|
+
}
|
|
89
|
+
if (result.status === "error") {
|
|
90
|
+
return /* @__PURE__ */ React.createElement(ErrorPanel, { error: result.error }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: result.retry }, "Retry"));
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { CookieAuthRefreshProvider, useCookieAuthRefresh };
|
|
96
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","../src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n // The path used for calling the refresh cookie endpoint, default to '/cookie'\n path?: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId, path = '/cookie' } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${path}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport { Button } from '@material-ui/core';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The path used for calling the refresh cookie endpoint, default to '/cookie'\n path?: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n"],"names":[],"mappings":";;;;;;;AA8BO,SAAS,qBAAqB,OAQkB,EAAA;AACrD,EAAA,MAAM,EAAE,QAAU,EAAA,IAAA,GAAO,SAAU,EAAA,GAAI,4BAAW,EAAC,CAAA;AACnD,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA,CAAA;AAE3C,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM;AAC5B,IAAA,OAAO,sBAAsB,MACzB,GAAA,IAAI,iBAAiB,CAAG,EAAA,QAAQ,yBAAyB,CACzD,GAAA,IAAA,CAAA;AAAA,GACN,EAAG,CAAC,QAAQ,CAAC,CAAA,CAAA;AAEb,EAAA,MAAM,CAAC,KAAA,EAAO,OAAO,CAAA,GAAI,SAAgC,YAAY;AACnE,IAAA,MAAM,SAAY,GAAA,MAAM,YAAa,CAAA,UAAA,CAAW,QAAQ,CAAA,CAAA;AACxD,IAAA,MAAM,UAAa,GAAA,CAAA,EAAG,SAAS,CAAA,EAAG,IAAI,CAAA,CAAA,CAAA;AACtC,IAAA,MAAM,WAAW,MAAM,QAAA,CAAS,KAA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
+
"backstage": {
|
|
6
|
+
"role": "web-library"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"main": "dist/index.esm.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/backstage/backstage",
|
|
16
|
+
"directory": "plugins/auth-react"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"main": "dist/index.esm.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "backstage-cli package build",
|
|
27
|
+
"clean": "backstage-cli package clean",
|
|
28
|
+
"lint": "backstage-cli package lint",
|
|
29
|
+
"prepack": "backstage-cli package prepack",
|
|
30
|
+
"postpack": "backstage-cli package postpack",
|
|
31
|
+
"start": "backstage-cli package start",
|
|
32
|
+
"test": "backstage-cli package test"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@backstage/core-components": "^0.0.0-nightly-20240321021124",
|
|
36
|
+
"@backstage/core-plugin-api": "^1.9.1",
|
|
37
|
+
"@backstage/errors": "^1.2.4",
|
|
38
|
+
"@material-ui/core": "^4.9.13",
|
|
39
|
+
"@react-hookz/web": "^24.0.0",
|
|
40
|
+
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@backstage/cli": "^0.0.0-nightly-20240321021124",
|
|
44
|
+
"@backstage/test-utils": "^0.0.0-nightly-20240321021124",
|
|
45
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
46
|
+
"@testing-library/react": "^14.0.0",
|
|
47
|
+
"@testing-library/user-event": "^14.0.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
|
51
|
+
},
|
|
52
|
+
"module": "./dist/index.esm.js"
|
|
53
|
+
}
|