@ovh-ux/manager-core-sso 0.2.2 → 0.3.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/CHANGELOG.md +22 -0
- package/dist/constants.js +9 -0
- package/dist/index.js +34 -0
- package/dist/types/constants.d.ts +15 -0
- package/dist/types/index.d.ts +14 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.3.0](https://github.com/ovh/manager/compare/@ovh-ux/manager-core-sso@0.2.3...@ovh-ux/manager-core-sso@0.3.0) (2024-10-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* build and publish manager-react-components and its deps ([cbcd795](https://github.com/ovh/manager/commit/cbcd7959a217c191c003058455ba2c38fb7553f1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.2.3](https://github.com/ovh/manager/compare/@ovh-ux/manager-core-sso@0.2.2...@ovh-ux/manager-core-sso@0.2.3) (2024-10-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Reverts
|
|
21
|
+
|
|
22
|
+
* Revert "ci(core.sso): add prepare command to publish (#13756)" ([8e0577d](https://github.com/ovh/manager/commit/8e0577d5fd8dec5f39ee61cbb3540cc023c60684)), closes [#13756](https://github.com/ovh/manager/issues/13756)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.2.2](https://github.com/ovh/manager/compare/@ovh-ux/manager-core-sso@0.2.1...@ovh-ux/manager-core-sso@0.2.2) (2024-10-24)
|
|
7
29
|
|
|
8
30
|
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DEFAULT_SSO_AUTH_URL } from './constants';
|
|
2
|
+
const { loginUrl, logoutUrl, euLoginUrl, euLogoutUrl } = DEFAULT_SSO_AUTH_URL;
|
|
3
|
+
const buildRedirectUrl = (url, params) => {
|
|
4
|
+
return `${url}${url.indexOf('?') > -1 ? '&' : '?'}${params.join('&')}`;
|
|
5
|
+
};
|
|
6
|
+
const redirectTo = (url) => {
|
|
7
|
+
return window.location.assign(url);
|
|
8
|
+
};
|
|
9
|
+
const isOvhTelecom = () => window.location.host === 'www.ovhtelecom.fr';
|
|
10
|
+
export const redirectToLoginPage = (onsuccessUrl = '') => {
|
|
11
|
+
const params = [];
|
|
12
|
+
if (loginUrl.indexOf('onsuccess') === -1) {
|
|
13
|
+
params.push(`onsuccess=${encodeURIComponent(onsuccessUrl || window.location.href)}`);
|
|
14
|
+
}
|
|
15
|
+
// redirect to login url
|
|
16
|
+
redirectTo(buildRedirectUrl(isOvhTelecom() ? euLoginUrl : loginUrl, params));
|
|
17
|
+
};
|
|
18
|
+
export const redirectToLogoutPage = (onsuccessUrl = '') => {
|
|
19
|
+
const params = [];
|
|
20
|
+
if (logoutUrl.indexOf('onsuccess') === -1) {
|
|
21
|
+
params.push(`onsuccess=${encodeURIComponent(onsuccessUrl || window.location.href)}`);
|
|
22
|
+
}
|
|
23
|
+
if (logoutUrl.indexOf('from') === -1 && document.referrer) {
|
|
24
|
+
params.push(`from=${encodeURIComponent(document.referrer)}`);
|
|
25
|
+
}
|
|
26
|
+
// redirect to login url
|
|
27
|
+
redirectTo(buildRedirectUrl(isOvhTelecom() ? euLogoutUrl : logoutUrl, params));
|
|
28
|
+
};
|
|
29
|
+
export * from './constants';
|
|
30
|
+
export default {
|
|
31
|
+
DEFAULT_SSO_AUTH_URL,
|
|
32
|
+
redirectToLoginPage,
|
|
33
|
+
redirectToLogoutPage,
|
|
34
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DEFAULT_SSO_AUTH_URL: {
|
|
2
|
+
loginUrl: string;
|
|
3
|
+
logoutUrl: string;
|
|
4
|
+
euLoginUrl: string;
|
|
5
|
+
euLogoutUrl: string;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: {
|
|
8
|
+
DEFAULT_SSO_AUTH_URL: {
|
|
9
|
+
loginUrl: string;
|
|
10
|
+
logoutUrl: string;
|
|
11
|
+
euLoginUrl: string;
|
|
12
|
+
euLogoutUrl: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const redirectToLoginPage: (onsuccessUrl?: string) => void;
|
|
2
|
+
export declare const redirectToLogoutPage: (onsuccessUrl?: string) => void;
|
|
3
|
+
export * from './constants';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
DEFAULT_SSO_AUTH_URL: {
|
|
6
|
+
loginUrl: string;
|
|
7
|
+
logoutUrl: string;
|
|
8
|
+
euLoginUrl: string;
|
|
9
|
+
euLogoutUrl: string;
|
|
10
|
+
};
|
|
11
|
+
redirectToLoginPage: (onsuccessUrl?: string) => void;
|
|
12
|
+
redirectToLogoutPage: (onsuccessUrl?: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ovh-ux/manager-core-sso",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "OVH SAS",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"dev": "tsc",
|
|
17
|
+
"prepare": "tsc",
|
|
17
18
|
"start:watch": "tsc -w"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|