@pega/react-sdk-components 8.8.21 → 8.23.11-debug
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/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts +10 -7
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts.map +1 -1
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +7 -0
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js.map +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.d.ts +1 -15
- package/lib/components/designSystemExtension/Banner/Banner.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts +9 -6
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +7 -3
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts +10 -4
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +8 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts +2 -6
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +3 -3
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts +2 -7
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +3 -3
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts +2 -7
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +3 -3
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.d.ts +7 -17
- package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.js +6 -1
- package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.d.ts +1 -5
- package/lib/components/designSystemExtension/Pulse/Pulse.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.js +6 -3
- package/lib/components/designSystemExtension/Pulse/Pulse.js.map +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts +1 -6
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts.map +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.d.ts +1 -15
- package/lib/components/field/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.js +15 -17
- package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.d.ts +2 -7
- package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.js +3 -3
- package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts +1 -19
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +8 -10
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts +1 -6
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +11 -11
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts.map +1 -1
- package/lib/components/field/Currency/currency-utils.js +1 -1
- package/lib/components/field/Currency/currency-utils.js.map +1 -1
- package/lib/components/field/Date/Date.d.ts +1 -5
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +6 -8
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts +1 -5
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +8 -14
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts +1 -8
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +9 -10
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts +1 -10
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +9 -12
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Email/Email.d.ts +1 -5
- package/lib/components/field/Email/Email.d.ts.map +1 -1
- package/lib/components/field/Email/Email.js +5 -7
- package/lib/components/field/Email/Email.js.map +1 -1
- package/lib/components/field/Integer/Integer.d.ts +1 -5
- package/lib/components/field/Integer/Integer.d.ts.map +1 -1
- package/lib/components/field/Integer/Integer.js +4 -6
- package/lib/components/field/Integer/Integer.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts +1 -5
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +4 -6
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/Phone/Phone.d.ts +1 -5
- package/lib/components/field/Phone/Phone.d.ts.map +1 -1
- package/lib/components/field/Phone/Phone.js +6 -8
- package/lib/components/field/Phone/Phone.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts +1 -7
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +12 -12
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.d.ts +9 -5
- package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +14 -10
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/TextArea/TextArea.d.ts +1 -6
- package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/field/TextArea/TextArea.js +3 -5
- package/lib/components/field/TextArea/TextArea.js.map +1 -1
- package/lib/components/field/TextContent/TextContent.d.ts +1 -7
- package/lib/components/field/TextContent/TextContent.d.ts.map +1 -1
- package/lib/components/field/TextContent/TextContent.js.map +1 -1
- package/lib/components/field/TextInput/TextInput.d.ts +1 -6
- package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
- package/lib/components/field/TextInput/TextInput.js +4 -6
- package/lib/components/field/TextInput/TextInput.js.map +1 -1
- package/lib/components/field/Time/Time.d.ts +1 -5
- package/lib/components/field/Time/Time.d.ts.map +1 -1
- package/lib/components/field/Time/Time.js +8 -10
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/URL/URL.d.ts +1 -5
- package/lib/components/field/URL/URL.d.ts.map +1 -1
- package/lib/components/field/URL/URL.js +4 -6
- package/lib/components/field/URL/URL.js.map +1 -1
- package/lib/components/field/UserReference/UserReference.d.ts +40 -19
- package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
- package/lib/components/field/UserReference/UserReference.js +45 -16
- package/lib/components/field/UserReference/UserReference.js.map +1 -1
- package/lib/components/helpers/attachmentHelpers.d.ts +3 -3
- package/lib/components/helpers/attachmentHelpers.d.ts.map +1 -1
- package/lib/components/helpers/attachmentHelpers.js.map +1 -1
- package/lib/components/helpers/auth.d.ts +6 -8
- package/lib/components/helpers/auth.d.ts.map +1 -1
- package/lib/components/helpers/auth.js +335 -642
- package/lib/components/helpers/auth.js.map +1 -1
- package/lib/components/helpers/authManager.d.ts +17 -20
- package/lib/components/helpers/authManager.d.ts.map +1 -1
- package/lib/components/helpers/authManager.js +439 -711
- package/lib/components/helpers/authManager.js.map +1 -1
- package/lib/components/helpers/case-utils.d.ts.map +1 -1
- package/lib/components/helpers/case-utils.js +4 -5
- package/lib/components/helpers/case-utils.js.map +1 -1
- package/lib/components/helpers/common-utils.d.ts +1 -1
- package/lib/components/helpers/common-utils.js.map +1 -1
- package/lib/components/helpers/config_access.d.ts.map +1 -1
- package/lib/components/helpers/config_access.js +63 -0
- package/lib/components/helpers/config_access.js.map +1 -1
- package/lib/components/helpers/date-format-utils.d.ts +6 -1
- package/lib/components/helpers/date-format-utils.d.ts.map +1 -1
- package/lib/components/helpers/date-format-utils.js.map +1 -1
- package/lib/components/helpers/event-utils.d.ts +1 -1
- package/lib/components/helpers/event-utils.d.ts.map +1 -1
- package/lib/components/helpers/event-utils.js.map +1 -1
- package/lib/components/helpers/formatters/Currency.d.ts +6 -6
- package/lib/components/helpers/formatters/Currency.js +2 -2
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.d.ts +320 -69
- package/lib/components/helpers/formatters/CurrencyMap.d.ts.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.js.map +1 -1
- package/lib/components/helpers/formatters/Date.d.ts +4 -4
- package/lib/components/helpers/formatters/Date.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts +1 -1
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts +11 -11
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts +1 -3
- package/lib/components/helpers/simpleTableHelpers.d.ts.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.js +3 -5
- package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
- package/lib/components/helpers/state-utils.d.ts.map +1 -1
- package/lib/components/helpers/state-utils.js.map +1 -1
- package/lib/components/helpers/template-utils.d.ts +3 -7
- package/lib/components/helpers/template-utils.d.ts.map +1 -1
- package/lib/components/helpers/template-utils.js +0 -1
- package/lib/components/helpers/template-utils.js.map +1 -1
- package/lib/components/helpers/versionHelpers.d.ts +0 -6
- package/lib/components/helpers/versionHelpers.d.ts.map +1 -1
- package/lib/components/helpers/versionHelpers.js +0 -6
- package/lib/components/helpers/versionHelpers.js.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.d.ts +13 -6
- package/lib/components/infra/ActionButtons/ActionButtons.d.ts.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.js +13 -1
- package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
- package/lib/components/infra/Assignment/Assignment.d.ts +15 -9
- package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +21 -8
- package/lib/components/infra/Assignment/Assignment.js.map +1 -1
- package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts +14 -8
- package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts.map +1 -1
- package/lib/components/infra/AssignmentCard/AssignmentCard.js +16 -3
- package/lib/components/infra/AssignmentCard/AssignmentCard.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts +21 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +48 -41
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts +17 -8
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +17 -6
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts +22 -9
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +20 -3
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts +19 -9
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.js +16 -2
- package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts +14 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.js +15 -13
- package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts +12 -5
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +12 -2
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.d.ts +17 -11
- package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.js +18 -4
- package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts +16 -8
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +16 -3
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/Reference/Reference.d.ts +17 -8
- package/lib/components/infra/Reference/Reference.d.ts.map +1 -1
- package/lib/components/infra/Reference/Reference.js +15 -1
- package/lib/components/infra/Reference/Reference.js.map +1 -1
- package/lib/components/infra/Region/Region.d.ts +7 -4
- package/lib/components/infra/Region/Region.d.ts.map +1 -1
- package/lib/components/infra/Region/Region.js +4 -0
- package/lib/components/infra/Region/Region.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts +21 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +21 -4
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/infra/Stages/Stages.d.ts +8 -5
- package/lib/components/infra/Stages/Stages.d.ts.map +1 -1
- package/lib/components/infra/Stages/Stages.js +6 -1
- package/lib/components/infra/Stages/Stages.js.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.d.ts.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js.map +1 -1
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts +10 -4
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts.map +1 -1
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js +9 -4
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js.map +1 -1
- package/lib/components/infra/View/View.d.ts +16 -13
- package/lib/components/infra/View/View.d.ts.map +1 -1
- package/lib/components/infra/View/View.js +20 -2
- package/lib/components/infra/View/View.js.map +1 -1
- package/lib/components/template/AppShell/AppShell.d.ts +15 -20
- package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +22 -10
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/BannerPage/BannerPage.d.ts +23 -11
- package/lib/components/template/BannerPage/BannerPage.d.ts.map +1 -1
- package/lib/components/template/BannerPage/BannerPage.js +22 -4
- package/lib/components/template/BannerPage/BannerPage.js.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.d.ts +7 -5
- package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js +6 -6
- package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts +22 -10
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +21 -8
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts +15 -8
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts.map +1 -1
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +12 -0
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.d.ts +16 -10
- package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.js +23 -12
- package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/template/DataReference/DataReference.d.ts +31 -1
- package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
- package/lib/components/template/DataReference/DataReference.js +48 -41
- package/lib/components/template/DataReference/DataReference.js.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.d.ts +11 -1
- package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.js +10 -9
- package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
- package/lib/components/template/Details/Details/Details.d.ts +16 -1
- package/lib/components/template/Details/Details/Details.d.ts.map +1 -1
- package/lib/components/template/Details/Details/Details.js +15 -10
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts +15 -7
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js +13 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts +16 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +16 -14
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts +16 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +16 -14
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts +19 -12
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +21 -7
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.d.ts +7 -7
- package/lib/components/template/InlineDashboard/InlineDashboard.d.ts.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.js +5 -0
- package/lib/components/template/InlineDashboard/InlineDashboard.js.map +1 -1
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts +15 -8
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts.map +1 -1
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js +14 -5
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js.map +1 -1
- package/lib/components/template/ListPage/ListPage.d.ts +13 -5
- package/lib/components/template/ListPage/ListPage.d.ts.map +1 -1
- package/lib/components/template/ListPage/ListPage.js +10 -6
- package/lib/components/template/ListPage/ListPage.js.map +1 -1
- package/lib/components/template/ListView/ListView.d.ts +9 -1
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +123 -127
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/utils.d.ts +0 -44
- package/lib/components/template/ListView/utils.d.ts.map +1 -1
- package/lib/components/template/ListView/utils.js +1 -142
- package/lib/components/template/ListView/utils.js.map +1 -1
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts +13 -9
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts.map +1 -1
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js +13 -2
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts +1 -10
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts +16 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +16 -14
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts +1 -5
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts +14 -7
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js +13 -4
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts +7 -4
- package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js +5 -0
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts +8 -4
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js +6 -3
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts +7 -4
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js +5 -0
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts +15 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js +11 -15
- package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +5 -57
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +1 -18
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +2 -2
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts +29 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +28 -22
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts +26 -14
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts.map +1 -1
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js +26 -5
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js.map +1 -1
- package/lib/components/template/SubTabs/SubTabs.d.ts +10 -4
- package/lib/components/template/SubTabs/SubTabs.d.ts.map +1 -1
- package/lib/components/template/SubTabs/SubTabs.js +8 -1
- package/lib/components/template/SubTabs/SubTabs.js.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.d.ts.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts +11 -5
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +12 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts +8 -4
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js +6 -3
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts +11 -5
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +9 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts +1 -10
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts +16 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +23 -31
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts +1 -5
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts +14 -7
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js +14 -4
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.d.ts +1 -17
- package/lib/components/template/WssNavBar/WssNavBar.d.ts.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts +17 -8
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js +19 -4
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +16 -24
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.d.ts +7 -4
- package/lib/components/widget/CaseHistory/CaseHistory.d.ts.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.js +8 -4
- package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts +1 -8
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts +1 -5
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +21 -31
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
- package/lib/components/widget/Followers/Followers.d.ts +5 -4
- package/lib/components/widget/Followers/Followers.d.ts.map +1 -1
- package/lib/components/widget/Followers/Followers.js +10 -3
- package/lib/components/widget/Followers/Followers.js.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js +2 -10
- package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.d.ts +1 -7
- package/lib/components/widget/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/widget/SummaryList/SummaryList.d.ts +1 -7
- package/lib/components/widget/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/widget/SummaryList/SummaryList.js +2 -5
- package/lib/components/widget/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/widget/ToDo/ToDo.d.ts +27 -13
- package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
- package/lib/components/widget/ToDo/ToDo.js +64 -28
- package/lib/components/widget/ToDo/ToDo.js.map +1 -1
- package/lib/doc/KeyReleaseUpdates.md +0 -21
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/sdk-pega-component-map.d.ts +1 -15
- package/lib/sdk-pega-component-map.js +1 -15
- package/lib/sdk-pega-component-map.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts +0 -19
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +0 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +0 -77
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +0 -1
- package/lib/components/designSystemExtension/RichTextEditor/index.d.ts +0 -2
- package/lib/components/designSystemExtension/RichTextEditor/index.d.ts.map +0 -1
- package/lib/components/designSystemExtension/RichTextEditor/index.js +0 -2
- package/lib/components/designSystemExtension/RichTextEditor/index.js.map +0 -1
- package/lib/components/field/RichText/RichText.d.ts +0 -7
- package/lib/components/field/RichText/RichText.d.ts.map +0 -1
- package/lib/components/field/RichText/RichText.js +0 -51
- package/lib/components/field/RichText/RichText.js.map +0 -1
- package/lib/components/field/RichText/index.d.ts +0 -2
- package/lib/components/field/RichText/index.d.ts.map +0 -1
- package/lib/components/field/RichText/index.js +0 -2
- package/lib/components/field/RichText/index.js.map +0 -1
- package/lib/components/field/ScalarList/ScalarList.d.ts +0 -13
- package/lib/components/field/ScalarList/ScalarList.d.ts.map +0 -1
- package/lib/components/field/ScalarList/ScalarList.js +0 -34
- package/lib/components/field/ScalarList/ScalarList.js.map +0 -1
- package/lib/components/field/ScalarList/index.d.ts +0 -2
- package/lib/components/field/ScalarList/index.d.ts.map +0 -1
- package/lib/components/field/ScalarList/index.js +0 -2
- package/lib/components/field/ScalarList/index.js.map +0 -1
- package/lib/hooks/index.d.ts +0 -4
- package/lib/hooks/index.d.ts.map +0 -1
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useAfterInitialEffect.d.ts +0 -9
- package/lib/hooks/useAfterInitialEffect.d.ts.map +0 -1
- package/lib/hooks/useAfterInitialEffect.js +0 -16
- package/lib/hooks/useAfterInitialEffect.js.map +0 -1
- package/lib/hooks/useConsolidatedRef.d.ts +0 -9
- package/lib/hooks/useConsolidatedRef.d.ts.map +0 -1
- package/lib/hooks/useConsolidatedRef.js +0 -30
- package/lib/hooks/useConsolidatedRef.js.map +0 -1
- package/lib/hooks/useUID.d.ts +0 -8
- package/lib/hooks/useUID.d.ts.map +0 -1
- package/lib/hooks/useUID.js +0 -14
- package/lib/hooks/useUID.js.map +0 -1
- package/lib/types/PConnProps.d.ts +0 -42
|
@@ -3,64 +3,225 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _PegaAuth_instances, _PegaAuth_config, _PegaAuth_dynState, _PegaAuth_reloadSS, _PegaAuth_reloadConfig, _PegaAuth_updateConfig, _PegaAuth_importSingleLib, _PegaAuth_importNodeLibs, _PegaAuth_buildAuthorizeUrl, _PegaAuth_authCodeStart, _PegaAuth_updateSessionIndex, _PegaAuth_sha256Hash, _PegaAuth_encode64, _PegaAuth_base64UrlSafeEncode, _PegaAuth_getRandomString, _PegaAuth_getCodeChallenge, _PegaAuth_getAgent;
|
|
6
|
+
var _PegaAuth_instances, _PegaAuth_updateConfig, _PegaAuth_buildAuthorizeUrl, _PegaAuth_sha256Hash, _PegaAuth_encode64, _PegaAuth_base64UrlSafeEncode, _PegaAuth_getCodeChallenge;
|
|
13
7
|
class PegaAuth {
|
|
14
|
-
|
|
15
|
-
// codeVerifier, state, sessionIndex, sessionIndexAttempts, acRedirectUri
|
|
16
|
-
constructor(ssKeyConfig, ssKeyDynState) {
|
|
8
|
+
constructor(ssKeyConfig) {
|
|
17
9
|
_PegaAuth_instances.add(this);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// For isNode path the below attributes are initialized on first method invocation
|
|
37
|
-
if (!this.isNode) {
|
|
38
|
-
this.crypto = window.crypto;
|
|
39
|
-
this.subtle = window.crypto.subtle;
|
|
40
|
-
}
|
|
41
|
-
if (Object.keys(__classPrivateFieldGet(this, _PegaAuth_config, "f")).length > 0) {
|
|
42
|
-
if (!__classPrivateFieldGet(this, _PegaAuth_config, "f").serverType) {
|
|
43
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").serverType = 'infinity';
|
|
10
|
+
this.ssKeyConfig = ssKeyConfig;
|
|
11
|
+
this.bEncodeSI = false;
|
|
12
|
+
this.reloadConfig();
|
|
13
|
+
}
|
|
14
|
+
reloadConfig() {
|
|
15
|
+
const peConfig = window.sessionStorage.getItem(this.ssKeyConfig);
|
|
16
|
+
let obj = {};
|
|
17
|
+
if (peConfig) {
|
|
18
|
+
try {
|
|
19
|
+
obj = JSON.parse(peConfig);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
try {
|
|
23
|
+
obj = JSON.parse(window.atob(peConfig));
|
|
24
|
+
}
|
|
25
|
+
catch (e2) {
|
|
26
|
+
obj = {};
|
|
27
|
+
}
|
|
44
28
|
}
|
|
45
29
|
}
|
|
46
|
-
|
|
47
|
-
throw new Error('invalid config settings');
|
|
48
|
-
}
|
|
30
|
+
this.config = peConfig ? obj : null;
|
|
49
31
|
}
|
|
50
32
|
async login() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
const fnGetRedirectUriOrigin = () => {
|
|
34
|
+
const redirectUri = this.config.redirectUri;
|
|
35
|
+
const nRootOffset = redirectUri.indexOf("//");
|
|
36
|
+
const nFirstPathOffset = nRootOffset !== -1 ? redirectUri.indexOf("/", nRootOffset + 2) : -1;
|
|
37
|
+
return nFirstPathOffset !== -1 ? redirectUri.substring(0, nFirstPathOffset) : redirectUri;
|
|
38
|
+
};
|
|
39
|
+
const redirectOrigin = fnGetRedirectUriOrigin();
|
|
40
|
+
// eslint-disable-next-line no-restricted-globals
|
|
41
|
+
const state = window.btoa(location.origin);
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
|
|
44
|
+
let myWindow = null; // popup or iframe
|
|
45
|
+
let elIframe = null;
|
|
46
|
+
let elCloseBtn = null;
|
|
47
|
+
const iframeTimeout = this.config.silentTimeout !== undefined ? this.config.silentTimeout : 5000;
|
|
48
|
+
let bWinIframe = iframeTimeout > 0 && ((!!this.config.userIdentifier && !!this.config.password) || this.config.iframeLoginUI || this.config.authService !== "pega");
|
|
49
|
+
let tmrAuthComplete = null;
|
|
50
|
+
let checkWindowClosed = null;
|
|
51
|
+
const myWinOnLoad = () => {
|
|
52
|
+
try {
|
|
53
|
+
if (bWinIframe) {
|
|
54
|
+
elIframe.contentWindow.postMessage({ type: "PegaAuth" }, redirectOrigin);
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log("authjs(login): loaded a page in iFrame");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
myWindow.postMessage({ type: "PegaAuth" }, redirectOrigin);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
console.log("authjs(login): Exception trying to postMessage on load");
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const fnOpenPopup = () => {
|
|
68
|
+
myWindow = window.open(url, '_blank', 'width=700,height=500,left=200,top=100');
|
|
69
|
+
if (!myWindow) {
|
|
70
|
+
// Blocked by popup-blocker
|
|
71
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
72
|
+
return reject("blocked");
|
|
73
|
+
}
|
|
74
|
+
checkWindowClosed = setInterval(() => {
|
|
75
|
+
if (myWindow.closed) {
|
|
76
|
+
clearInterval(checkWindowClosed);
|
|
77
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
78
|
+
reject("closed");
|
|
79
|
+
}
|
|
80
|
+
}, 500);
|
|
81
|
+
try {
|
|
82
|
+
myWindow.addEventListener("load", myWinOnLoad, true);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
// eslint-disable-next-line no-console
|
|
86
|
+
console.log("authjs(login): Exception trying to add onload handler to opened window;");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const fnCloseIframe = () => {
|
|
90
|
+
elIframe.parentNode.removeChild(elIframe);
|
|
91
|
+
elCloseBtn.parentNode.removeChild(elCloseBtn);
|
|
92
|
+
// eslint-disable-next-line no-multi-assign
|
|
93
|
+
elIframe = elCloseBtn = null;
|
|
94
|
+
bWinIframe = false;
|
|
95
|
+
};
|
|
96
|
+
const fnCloseAndReject = () => {
|
|
97
|
+
fnCloseIframe();
|
|
98
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
99
|
+
reject("closed");
|
|
100
|
+
};
|
|
101
|
+
// If there is a userIdentifier and password specified or an external SSO auth service,
|
|
102
|
+
// we can try to use this silently in an iFrame first
|
|
103
|
+
if (bWinIframe) {
|
|
104
|
+
const nFrameZLevel = 99999;
|
|
105
|
+
elIframe = document.createElement('iframe');
|
|
106
|
+
// eslint-disable-next-line prefer-template
|
|
107
|
+
elIframe.id = 'pe' + this.config.clientId;
|
|
108
|
+
const loginBoxWidth = 500;
|
|
109
|
+
const loginBoxHeight = 700;
|
|
110
|
+
const oStyle = elIframe.style;
|
|
111
|
+
oStyle.position = 'absolute';
|
|
112
|
+
oStyle.display = 'none';
|
|
113
|
+
oStyle.zIndex = nFrameZLevel;
|
|
114
|
+
oStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2)}px`;
|
|
115
|
+
oStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2)}px`;
|
|
116
|
+
oStyle.width = '500px';
|
|
117
|
+
oStyle.height = '700px';
|
|
118
|
+
// Add Iframe to top of document DOM to have it load
|
|
119
|
+
document.body.insertBefore(elIframe, document.body.firstChild);
|
|
120
|
+
// Add Iframe to DOM to have it load
|
|
121
|
+
document.getElementsByTagName('body')[0].appendChild(elIframe);
|
|
122
|
+
elIframe.addEventListener("load", myWinOnLoad, true);
|
|
123
|
+
// Disallow iframe content attempts to navigate main window
|
|
124
|
+
elIframe.setAttribute("sandbox", "allow-scripts allow-forms allow-same-origin");
|
|
125
|
+
elIframe.setAttribute('src', url);
|
|
126
|
+
const svgCloseBtn = `<?xml version="1.0" encoding="UTF-8"?>
|
|
127
|
+
<svg width="34px" height="34px" viewBox="0 0 34 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
128
|
+
<title>Dismiss - Black</title>
|
|
129
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
130
|
+
<g transform="translate(1.000000, 1.000000)">
|
|
131
|
+
<circle fill="#252C32" cx="16" cy="16" r="16"></circle>
|
|
132
|
+
<g transform="translate(9.109375, 9.214844)" fill="#FFFFFF" fill-rule="nonzero">
|
|
133
|
+
<path d="M12.7265625,0 L0,12.6210938 L1.0546875,13.5703125 L13.78125,1.0546875 L12.7265625,0 Z M13.7460938,12.5507812 L1.01953125,0 L0,1.01953125 L12.7617188,13.6054688 L13.7460938,12.5507812 Z"></path>
|
|
134
|
+
</g>
|
|
135
|
+
</g>
|
|
136
|
+
</g>
|
|
137
|
+
</svg>`;
|
|
138
|
+
const bCloseWithinFrame = false;
|
|
139
|
+
elCloseBtn = document.createElement('img');
|
|
140
|
+
elCloseBtn.onclick = fnCloseAndReject;
|
|
141
|
+
// eslint-disable-next-line prefer-template
|
|
142
|
+
elCloseBtn.src = 'data:image/svg+xml;base64,' + window.btoa(svgCloseBtn);
|
|
143
|
+
const oBtnStyle = elCloseBtn.style;
|
|
144
|
+
oBtnStyle.cursor = 'pointer';
|
|
145
|
+
// If svg doesn't set width and height might want to set oBtStyle width and height to something like '2em'
|
|
146
|
+
oBtnStyle.position = 'absolute';
|
|
147
|
+
oBtnStyle.display = 'none';
|
|
148
|
+
oBtnStyle.zIndex = nFrameZLevel + 1;
|
|
149
|
+
const nTopOffset = bCloseWithinFrame ? 5 : -10;
|
|
150
|
+
const nRightOffset = bCloseWithinFrame ? -34 : -20;
|
|
151
|
+
oBtnStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2) + nTopOffset}px`;
|
|
152
|
+
oBtnStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2) + loginBoxWidth + nRightOffset}px`;
|
|
153
|
+
document.body.insertBefore(elCloseBtn, document.body.firstChild);
|
|
154
|
+
// If the password was wrong, then the login screen will be in the iframe
|
|
155
|
+
// ..and with Pega without realization of US-372314 it may replace the top (main portal) window
|
|
156
|
+
// For now set a timer and if the timer expires, remove the iFrame and use same url within
|
|
157
|
+
// visible window
|
|
158
|
+
tmrAuthComplete = setTimeout(() => {
|
|
159
|
+
clearTimeout(tmrAuthComplete);
|
|
160
|
+
// remove password from config
|
|
161
|
+
if (this.config.password) {
|
|
162
|
+
delete this.config.password;
|
|
163
|
+
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
164
|
+
}
|
|
165
|
+
if (this.config.iframeLoginUI) {
|
|
166
|
+
elIframe.style.display = "block";
|
|
167
|
+
elCloseBtn.style.display = "block";
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
fnCloseIframe();
|
|
171
|
+
fnOpenPopup();
|
|
172
|
+
}
|
|
173
|
+
}, iframeTimeout);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
fnOpenPopup();
|
|
177
|
+
}
|
|
178
|
+
let authMessageReceiver = null;
|
|
179
|
+
/* Retrieve token(s) and close login window */
|
|
180
|
+
const fnGetTokenAndFinish = (code) => {
|
|
181
|
+
window.removeEventListener("message", authMessageReceiver, false);
|
|
182
|
+
this.getToken(code).then(token => {
|
|
183
|
+
if (bWinIframe) {
|
|
184
|
+
clearTimeout(tmrAuthComplete);
|
|
185
|
+
fnCloseIframe();
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
clearInterval(checkWindowClosed);
|
|
189
|
+
try {
|
|
190
|
+
myWindow.close();
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
// eslint-disable-next-line no-console
|
|
194
|
+
console.warn(`attempt to close opened window failed`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
resolve(token);
|
|
198
|
+
})
|
|
199
|
+
.catch(e => {
|
|
200
|
+
reject(e);
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
/* Handler to receive the auth code */
|
|
204
|
+
authMessageReceiver = (event) => {
|
|
205
|
+
// Check origin to make sure it is the redirect origin
|
|
206
|
+
if (event.origin !== redirectOrigin) {
|
|
207
|
+
// eslint-disable-next-line no-console
|
|
208
|
+
console.info(`Received event from unexpected origin: ${event.origin} (was expecting: ${redirectOrigin})`);
|
|
209
|
+
}
|
|
210
|
+
if (!event.data || !event.data.type || event.data.type !== "PegaAuth")
|
|
211
|
+
return;
|
|
212
|
+
// eslint-disable-next-line no-console
|
|
213
|
+
console.log("authjs(login): postMessage received with code");
|
|
214
|
+
const code = event.data.code.toString();
|
|
215
|
+
fnGetTokenAndFinish(code);
|
|
216
|
+
};
|
|
217
|
+
window.addEventListener("message", authMessageReceiver, false);
|
|
218
|
+
window.authCodeCallback = (code) => {
|
|
219
|
+
// eslint-disable-next-line no-console
|
|
220
|
+
console.log("authjs(login): authCodeCallback used with code");
|
|
221
|
+
fnGetTokenAndFinish(code);
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
});
|
|
64
225
|
}
|
|
65
226
|
// Login redirect
|
|
66
227
|
loginRedirect() {
|
|
@@ -71,131 +232,71 @@ class PegaAuth {
|
|
|
71
232
|
location.href = url;
|
|
72
233
|
});
|
|
73
234
|
}
|
|
74
|
-
// check state
|
|
75
|
-
checkStateMatch(state) {
|
|
76
|
-
return state === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
|
|
77
|
-
}
|
|
78
235
|
// For PKCE token endpoint includes code_verifier
|
|
79
236
|
getToken(authCode) {
|
|
80
237
|
// Reload config to pick up the previously stored codeVerifier
|
|
81
|
-
|
|
82
|
-
const {
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const urlParams = new URLSearchParams(queryString);
|
|
88
|
-
authCode = urlParams.get('code');
|
|
89
|
-
}
|
|
238
|
+
this.reloadConfig();
|
|
239
|
+
const { clientId, clientSecret, redirectUri, tokenUri, codeVerifier } = this.config;
|
|
240
|
+
// eslint-disable-next-line no-restricted-globals
|
|
241
|
+
const queryString = location.search;
|
|
242
|
+
const urlParams = new URLSearchParams(queryString);
|
|
243
|
+
const code = authCode || urlParams.get("code");
|
|
90
244
|
const formData = new URLSearchParams();
|
|
91
|
-
formData.append(
|
|
245
|
+
formData.append("client_id", clientId);
|
|
92
246
|
if (clientSecret) {
|
|
93
|
-
formData.append(
|
|
94
|
-
}
|
|
95
|
-
/* eslint-disable camelcase */
|
|
96
|
-
const fullGTName = {
|
|
97
|
-
authCode: 'authorization_code',
|
|
98
|
-
clientCreds: 'client_credentials',
|
|
99
|
-
customBearer: 'custom-bearer',
|
|
100
|
-
passwordCreds: 'password'
|
|
101
|
-
}[grantType];
|
|
102
|
-
const grant_type = fullGTName || grantType || 'authorization_code';
|
|
103
|
-
formData.append('grant_type', grant_type);
|
|
104
|
-
if (serverType === 'launchpad' && grantType !== 'authCode') {
|
|
105
|
-
formData.append('isolation_ids', isolationId);
|
|
106
|
-
}
|
|
107
|
-
if (bAuthCode) {
|
|
108
|
-
formData.append('code', authCode);
|
|
109
|
-
formData.append('redirect_uri', acRedirectUri);
|
|
110
|
-
if (!noPKCE) {
|
|
111
|
-
formData.append('code_verifier', codeVerifier);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (sessionIndex) {
|
|
115
|
-
formData.append('session_index', sessionIndex);
|
|
116
|
-
}
|
|
117
|
-
/* eslint-enable camelcase */
|
|
118
|
-
if (grantType === 'customBearer' && customTokenParams) {
|
|
119
|
-
Object.keys(customTokenParams).forEach((param) => {
|
|
120
|
-
formData.append(param, customTokenParams[param]);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
if (grantType !== 'authCode') {
|
|
124
|
-
formData.append('enable_psyncId', 'true');
|
|
125
|
-
}
|
|
126
|
-
if (grantType === 'passwordCreds') {
|
|
127
|
-
formData.append('username', userIdentifier);
|
|
128
|
-
formData.append('password', atob(password));
|
|
247
|
+
formData.append("client_secret", clientSecret);
|
|
129
248
|
}
|
|
249
|
+
formData.append("grant_type", "authorization_code");
|
|
250
|
+
formData.append("code", code);
|
|
251
|
+
formData.append("redirect_uri", redirectUri);
|
|
252
|
+
formData.append("code_verifier", codeVerifier);
|
|
130
253
|
return fetch(tokenUri, {
|
|
131
|
-
|
|
132
|
-
method: 'POST',
|
|
254
|
+
method: "POST",
|
|
133
255
|
headers: new Headers({
|
|
134
|
-
|
|
256
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
135
257
|
}),
|
|
136
|
-
body: formData.toString()
|
|
258
|
+
body: formData.toString(),
|
|
137
259
|
})
|
|
138
260
|
.then((response) => response.json())
|
|
139
|
-
.then(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
261
|
+
.then(token => {
|
|
262
|
+
// .expires_in contains the # of seconds before access token expires
|
|
263
|
+
// add property to keep track of current time when the token expires
|
|
264
|
+
token.eA = Date.now() + (token.expires_in * 1000);
|
|
265
|
+
if (this.config.codeVerifier) {
|
|
266
|
+
delete this.config.codeVerifier;
|
|
143
267
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
token.eA = Date.now() + token.expires_in * 1000;
|
|
148
|
-
// Clear authCode related config state: state, codeVerifier, acRedirectUri
|
|
149
|
-
if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").state) {
|
|
150
|
-
delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
|
|
151
|
-
}
|
|
152
|
-
if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier) {
|
|
153
|
-
delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier;
|
|
154
|
-
}
|
|
155
|
-
if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri) {
|
|
156
|
-
delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri;
|
|
157
|
-
}
|
|
158
|
-
// If there is a session_index then move this to the peConfig structure (as used on authorize)
|
|
159
|
-
if (token.session_index) {
|
|
160
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex = token.session_index;
|
|
161
|
-
}
|
|
162
|
-
// If we got a token and have a session index, then reset the sessionIndexAttempts
|
|
163
|
-
if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex) {
|
|
164
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts = 0;
|
|
165
|
-
}
|
|
166
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
268
|
+
// If there is a session_index then move this to the peConfig structure (as used on authorize)
|
|
269
|
+
if (token.session_index) {
|
|
270
|
+
this.config.sessionIndex = token.session_index;
|
|
167
271
|
}
|
|
272
|
+
// If we got a token and have a session index, then reset the sessionIndexAttempts
|
|
273
|
+
if (this.config.sessionIndex) {
|
|
274
|
+
this.config.sessionIndexAttempts = 0;
|
|
275
|
+
}
|
|
276
|
+
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
168
277
|
return token;
|
|
169
278
|
})
|
|
170
|
-
.catch(
|
|
279
|
+
.catch(e => {
|
|
171
280
|
// eslint-disable-next-line no-console
|
|
172
|
-
console.
|
|
281
|
+
console.log(e);
|
|
173
282
|
});
|
|
174
283
|
}
|
|
175
284
|
/* eslint-disable camelcase */
|
|
176
285
|
async refreshToken(refresh_token) {
|
|
177
|
-
const { clientId, clientSecret, tokenUri } =
|
|
178
|
-
if (this.isNode && !this.crypto) {
|
|
179
|
-
// Deferring dynamic loading of node libraries til this first method to avoid doing this in constructor
|
|
180
|
-
await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importNodeLibs).call(this);
|
|
181
|
-
}
|
|
182
|
-
if (!refresh_token) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
286
|
+
const { clientId, clientSecret, tokenUri } = this.config;
|
|
185
287
|
const formData = new URLSearchParams();
|
|
186
|
-
formData.append(
|
|
288
|
+
formData.append("client_id", clientId);
|
|
187
289
|
if (clientSecret) {
|
|
188
|
-
formData.append(
|
|
290
|
+
formData.append("client_secret", clientSecret);
|
|
189
291
|
}
|
|
190
|
-
formData.append(
|
|
191
|
-
formData.append(
|
|
292
|
+
formData.append("grant_type", "refresh_token");
|
|
293
|
+
formData.append("refresh_token", refresh_token);
|
|
192
294
|
return fetch(tokenUri, {
|
|
193
|
-
|
|
194
|
-
method: 'POST',
|
|
295
|
+
method: "POST",
|
|
195
296
|
headers: new Headers({
|
|
196
|
-
|
|
297
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
197
298
|
}),
|
|
198
|
-
body: formData.toString()
|
|
299
|
+
body: formData.toString(),
|
|
199
300
|
})
|
|
200
301
|
.then((response) => {
|
|
201
302
|
if (!response.ok && response.status === 401) {
|
|
@@ -203,550 +304,142 @@ class PegaAuth {
|
|
|
203
304
|
}
|
|
204
305
|
return response.json();
|
|
205
306
|
})
|
|
206
|
-
.then(
|
|
307
|
+
.then(token => {
|
|
207
308
|
if (token) {
|
|
208
309
|
// .expires_in contains the # of seconds before access token expires
|
|
209
310
|
// add property to keep track of current time when the token expires
|
|
210
|
-
token.eA = Date.now() + token.expires_in * 1000;
|
|
311
|
+
token.eA = Date.now() + (token.expires_in * 1000);
|
|
211
312
|
}
|
|
212
313
|
return token;
|
|
213
314
|
})
|
|
214
|
-
.catch(
|
|
315
|
+
.catch(e => {
|
|
215
316
|
// eslint-disable-next-line no-console
|
|
216
|
-
console.
|
|
217
|
-
return null;
|
|
317
|
+
console.log(e);
|
|
218
318
|
});
|
|
219
319
|
}
|
|
220
320
|
async revokeTokens(access_token, refresh_token = null) {
|
|
221
|
-
if (
|
|
222
|
-
// Must have a config structure to proceed
|
|
321
|
+
if (!this.config || !this.config.revokeUri) {
|
|
322
|
+
// Must have a config structure and revokeUri to proceed
|
|
223
323
|
return;
|
|
224
324
|
}
|
|
225
|
-
const { clientId, clientSecret, revokeUri } =
|
|
226
|
-
|
|
227
|
-
// Deferring dynamic loading of node libraries til this first method to avoid doing this in constructor
|
|
228
|
-
await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importNodeLibs).call(this);
|
|
229
|
-
}
|
|
230
|
-
const hdrs = { 'content-type': this.urlencoded };
|
|
325
|
+
const { clientId, clientSecret, revokeUri } = this.config;
|
|
326
|
+
const hdrs = { "content-type": "application/x-www-form-urlencoded" };
|
|
231
327
|
if (clientSecret) {
|
|
232
|
-
const
|
|
233
|
-
hdrs.authorization = `Basic ${
|
|
328
|
+
const creds = `${clientId}:${clientSecret}`;
|
|
329
|
+
hdrs.authorization = `Basic ${window.btoa(creds)}`;
|
|
234
330
|
}
|
|
235
|
-
const aTknProps = [
|
|
331
|
+
const aTknProps = ["access_token"];
|
|
236
332
|
if (refresh_token) {
|
|
237
|
-
aTknProps.push(
|
|
333
|
+
aTknProps.push("refresh_token");
|
|
238
334
|
}
|
|
239
335
|
aTknProps.forEach((prop) => {
|
|
240
336
|
const formData = new URLSearchParams();
|
|
241
337
|
if (!clientSecret) {
|
|
242
|
-
formData.append(
|
|
338
|
+
formData.append("client_id", clientId);
|
|
243
339
|
}
|
|
244
|
-
formData.append(
|
|
245
|
-
formData.append(
|
|
340
|
+
formData.append("token", prop === "access_token" ? access_token : refresh_token);
|
|
341
|
+
formData.append("token_type_hint", prop);
|
|
246
342
|
fetch(revokeUri, {
|
|
247
|
-
|
|
248
|
-
method: 'POST',
|
|
343
|
+
method: "POST",
|
|
249
344
|
headers: new Headers(hdrs),
|
|
250
|
-
body: formData.toString()
|
|
345
|
+
body: formData.toString(),
|
|
251
346
|
})
|
|
252
347
|
.then((response) => {
|
|
253
348
|
if (!response.ok) {
|
|
254
349
|
// eslint-disable-next-line no-console
|
|
255
|
-
console.
|
|
350
|
+
console.log(`Error revoking ${prop}:${response.status}`);
|
|
256
351
|
}
|
|
257
352
|
})
|
|
258
|
-
.catch(
|
|
353
|
+
.catch(e => {
|
|
259
354
|
// eslint-disable-next-line no-console
|
|
260
|
-
console.
|
|
355
|
+
console.log(e);
|
|
261
356
|
});
|
|
262
357
|
});
|
|
263
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed = false;
|
|
264
358
|
// Also clobber any sessionIndex
|
|
265
|
-
|
|
359
|
+
if (this.config.sessionIndex) {
|
|
360
|
+
delete this.config.sessionIndex;
|
|
361
|
+
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
362
|
+
}
|
|
266
363
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
obj = JSON.parse(sItem);
|
|
364
|
+
// For userinfo endpoint to return meaningful data, endpoint must include appAlias (if specified) and authorize must
|
|
365
|
+
// specify profile and optionally email scope to get such info returned
|
|
366
|
+
async getUserinfo(access_token) {
|
|
367
|
+
if (!this.config || !this.config.userinfoUri) {
|
|
368
|
+
// Must have a config structure and userInfo to proceed
|
|
369
|
+
return {};
|
|
274
370
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
371
|
+
const hdrs = { 'authorization': `bearer ${access_token}`, 'content-type': 'application/json;charset=UTF-8' };
|
|
372
|
+
return fetch(this.config.userinfoUri, {
|
|
373
|
+
method: "GET",
|
|
374
|
+
headers: new Headers(hdrs)
|
|
375
|
+
})
|
|
376
|
+
.then(response => {
|
|
377
|
+
if (response.ok) {
|
|
378
|
+
return response.json();
|
|
278
379
|
}
|
|
279
|
-
|
|
280
|
-
|
|
380
|
+
else {
|
|
381
|
+
// eslint-disable-next-line no-console
|
|
382
|
+
console.log(`Error invoking userinfo: ${response.status}`);
|
|
281
383
|
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}, _PegaAuth_reloadConfig = function _PegaAuth_reloadConfig() {
|
|
291
|
-
if (this.ssKeyConfig) {
|
|
292
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadSS).call(this, this.ssKeyConfig);
|
|
293
|
-
}
|
|
294
|
-
if (this.ssKeyDynState) {
|
|
295
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadSS).call(this, this.ssKeyDynState);
|
|
296
|
-
}
|
|
297
|
-
}, _PegaAuth_updateConfig = function _PegaAuth_updateConfig() {
|
|
298
|
-
// transform must occur unless it is explicitly disabled
|
|
299
|
-
const transform = __classPrivateFieldGet(this, _PegaAuth_config, "f").transform !== false;
|
|
300
|
-
// May not need to write out Config info all the time, but there is a scenario where a
|
|
301
|
-
// non obfuscated value is passed in and then it needs to be obfuscated
|
|
302
|
-
if (this.ssKeyConfig) {
|
|
303
|
-
const sConfig = JSON.stringify(__classPrivateFieldGet(this, _PegaAuth_config, "f"));
|
|
304
|
-
window.sessionStorage.setItem(this.ssKeyConfig, transform ? btoa(sConfig) : sConfig);
|
|
305
|
-
}
|
|
306
|
-
if (this.ssKeyDynState) {
|
|
307
|
-
const sDynState = JSON.stringify(__classPrivateFieldGet(this, _PegaAuth_dynState, "f"));
|
|
308
|
-
window.sessionStorage.setItem(this.ssKeyDynState, transform ? btoa(sDynState) : sDynState);
|
|
309
|
-
}
|
|
310
|
-
if (__classPrivateFieldGet(this, _PegaAuth_config, "f").fnDynStateChangedCB) {
|
|
311
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").fnDynStateChangedCB();
|
|
312
|
-
}
|
|
313
|
-
}, _PegaAuth_importSingleLib = async function _PegaAuth_importSingleLib(libName, libProp, bLoadAlways = false) {
|
|
314
|
-
// eslint-disable-next-line no-undef
|
|
315
|
-
if (!bLoadAlways && typeof (this.isNode ? global : window)[libProp] !== 'undefined') {
|
|
316
|
-
// eslint-disable-next-line no-undef
|
|
317
|
-
this[libProp] = (this.isNode ? global : window)[libProp];
|
|
318
|
-
return this[libProp];
|
|
384
|
+
})
|
|
385
|
+
.then(data => {
|
|
386
|
+
return data;
|
|
387
|
+
})
|
|
388
|
+
.catch(e => {
|
|
389
|
+
// eslint-disable-next-line no-console
|
|
390
|
+
console.log(e);
|
|
391
|
+
});
|
|
319
392
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
this[libProp] = mod.default;
|
|
325
|
-
})
|
|
326
|
-
.catch((e) => {
|
|
327
|
-
// eslint-disable-next-line no-console
|
|
328
|
-
console.error(`Library ${libName} failed to load. ${e}`);
|
|
329
|
-
throw e;
|
|
330
|
-
});
|
|
331
|
-
}, _PegaAuth_importNodeLibs = async function _PegaAuth_importNodeLibs() {
|
|
332
|
-
// Also current assumption is using Node 18 or better
|
|
333
|
-
// With 18.3 there is now a native fetch (but may want to force use of node-fetch)
|
|
334
|
-
const useNodeFetch = !!__classPrivateFieldGet(this, _PegaAuth_config, "f").useNodeFetch;
|
|
335
|
-
return Promise.all([
|
|
336
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node-fetch', 'fetch', useNodeFetch),
|
|
337
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'open', 'open'),
|
|
338
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:crypto', 'crypto', true),
|
|
339
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:https', 'https'),
|
|
340
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:http', 'http'),
|
|
341
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:fs', 'fs')
|
|
342
|
-
]).then(() => {
|
|
343
|
-
this.subtle = this.crypto?.subtle || this.crypto.webcrypto.subtle;
|
|
344
|
-
if ((typeof fetch === 'undefined' || useNodeFetch) && this.fetch) {
|
|
345
|
-
/* eslint-disable-next-line no-global-assign */
|
|
346
|
-
fetch = this.fetch;
|
|
347
|
-
}
|
|
348
|
-
});
|
|
393
|
+
}
|
|
394
|
+
_PegaAuth_instances = new WeakSet(), _PegaAuth_updateConfig = function _PegaAuth_updateConfig() {
|
|
395
|
+
const sSI = JSON.stringify(this.config);
|
|
396
|
+
window.sessionStorage.setItem(this.ssKeyConfig, this.bEncodeSI ? window.btoa(sSI) : sSI);
|
|
349
397
|
}, _PegaAuth_buildAuthorizeUrl =
|
|
350
398
|
// For PKCE the authorize includes a code_challenge & code_challenge_method as well
|
|
351
399
|
async function _PegaAuth_buildAuthorizeUrl(state) {
|
|
352
|
-
const {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const buf = new Uint8Array(64);
|
|
358
|
-
this.crypto.getRandomValues(buf);
|
|
359
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
|
|
360
|
-
}
|
|
400
|
+
const { clientId, redirectUri, authorizeUri, authService, sessionIndex, appAlias, useLocking, userIdentifier, password } = this.config;
|
|
401
|
+
// Generate random string of 64 chars for verifier. RFC 7636 says from 43-128 chars
|
|
402
|
+
let buf = new Uint8Array(64);
|
|
403
|
+
window.crypto.getRandomValues(buf);
|
|
404
|
+
this.config.codeVerifier = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
|
|
361
405
|
// If sessionIndex exists then increment attempts count (we will stop sending session_index after two failures)
|
|
362
|
-
// With Infinity '24 we can now properly detect a invalid_session_index error, but can't for earlier versions
|
|
363
406
|
if (sessionIndex) {
|
|
364
|
-
|
|
407
|
+
this.config.sessionIndexAttempts += 1;
|
|
365
408
|
}
|
|
366
|
-
// We use state to verify that the received code is for the right authorize transaction
|
|
367
|
-
// eslint-disable-next-line no-unneeded-ternary
|
|
368
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").state = `${state ? state : ''}.${__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getRandomString).call(this, 32)}`;
|
|
369
|
-
// The same redirectUri needs to be provided to token endpoint, so save this away incase redirectUri is
|
|
370
|
-
// adjusted for next authorize
|
|
371
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri = redirectUri;
|
|
372
409
|
// Persist codeVerifier in session storage so it survives the redirects that are to follow
|
|
373
410
|
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
411
|
+
if (!state) {
|
|
412
|
+
// Calc random state variable
|
|
413
|
+
buf = new Uint8Array(32);
|
|
414
|
+
window.crypto.getRandomValues(buf);
|
|
415
|
+
state = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
|
|
416
|
+
}
|
|
374
417
|
// Trim alias to include just the real alias piece
|
|
375
|
-
const addtlScope = appAlias ? `+app.alias.${appAlias.replace(/^app\//, '')}` :
|
|
376
|
-
const scope = bInfinity ? `openid${addtlScope}` : 'user_info';
|
|
418
|
+
const addtlScope = appAlias ? `+app.alias.${appAlias.replace(/^app\//, '')}` : "";
|
|
377
419
|
// Add explicit creds if specified to try to avoid login popup
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (!noPKCE) {
|
|
387
|
-
const cc = await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getCodeChallenge).call(this, __classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier);
|
|
388
|
-
pkceArgs = `&code_challenge=${cc}&code_challenge_method=S256`;
|
|
389
|
-
}
|
|
390
|
-
return `${authorizeUri}?client_id=${clientId}&response_type=code&redirect_uri=${redirectUri}&scope=${scope}&state=${__classPrivateFieldGet(this, _PegaAuth_dynState, "f").state}${pkceArgs}${moreAuthArgs}`;
|
|
391
|
-
}, _PegaAuth_authCodeStart =
|
|
392
|
-
// authCode login issues the authorize endpoint transaction and deals with redirects
|
|
393
|
-
async function _PegaAuth_authCodeStart() {
|
|
394
|
-
const fnGetRedirectUriOrigin = () => {
|
|
395
|
-
const redirectUri = __classPrivateFieldGet(this, _PegaAuth_config, "f").redirectUri;
|
|
396
|
-
const nRootOffset = redirectUri.indexOf('//');
|
|
397
|
-
const nFirstPathOffset = nRootOffset !== -1 ? redirectUri.indexOf('/', nRootOffset + 2) : -1;
|
|
398
|
-
return nFirstPathOffset !== -1 ? redirectUri.substring(0, nFirstPathOffset) : redirectUri;
|
|
399
|
-
};
|
|
400
|
-
const redirectOrigin = fnGetRedirectUriOrigin();
|
|
401
|
-
const state = this.isNode ? '' : btoa(window.location.origin);
|
|
402
|
-
return new Promise((resolve, reject) => {
|
|
403
|
-
let theUrl = null; // holds the crafted authorize url
|
|
404
|
-
let myWindow = null; // popup or iframe
|
|
405
|
-
let elIframe = null;
|
|
406
|
-
let elCloseBtn = null;
|
|
407
|
-
const iframeTimeout = __classPrivateFieldGet(this, _PegaAuth_config, "f").silentTimeout !== undefined ? __classPrivateFieldGet(this, _PegaAuth_config, "f").silentTimeout : 5000;
|
|
408
|
-
let bWinIframe = true;
|
|
409
|
-
let tmrAuthComplete = null;
|
|
410
|
-
let checkWindowClosed = null;
|
|
411
|
-
let bDisablePromptNone = false;
|
|
412
|
-
const myWinOnLoad = () => {
|
|
413
|
-
try {
|
|
414
|
-
if (bWinIframe) {
|
|
415
|
-
elIframe.contentWindow.postMessage({ type: 'PegaAuth' }, redirectOrigin);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
myWindow.postMessage({ type: 'PegaAuth' }, redirectOrigin);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
catch (e) {
|
|
422
|
-
// Exception trying to postMessage on load (perhaps should console.warn)
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
const fnSetSilentAuthFailed = (bSet) => {
|
|
426
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed = bSet;
|
|
427
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
428
|
-
};
|
|
429
|
-
/* eslint-disable prefer-promise-reject-errors */
|
|
430
|
-
const fnOpenPopup = () => {
|
|
431
|
-
if (__classPrivateFieldGet(this, _PegaAuth_config, "f").noPopups) {
|
|
432
|
-
return reject('no-popups');
|
|
433
|
-
}
|
|
434
|
-
// Since displaying a visible window, clear the silent auth failed flag
|
|
435
|
-
fnSetSilentAuthFailed(false);
|
|
436
|
-
myWindow = (this.isNode ? this.open : window.open)(theUrl, '_blank', 'width=700,height=500,left=200,top=100');
|
|
437
|
-
if (!myWindow) {
|
|
438
|
-
// Blocked by popup-blocker
|
|
439
|
-
return reject('blocked');
|
|
440
|
-
}
|
|
441
|
-
checkWindowClosed = setInterval(() => {
|
|
442
|
-
if (myWindow.closed) {
|
|
443
|
-
clearInterval(checkWindowClosed);
|
|
444
|
-
reject('closed');
|
|
445
|
-
}
|
|
446
|
-
}, 500);
|
|
447
|
-
if (!this.isNode) {
|
|
448
|
-
try {
|
|
449
|
-
myWindow.addEventListener('load', myWinOnLoad, true);
|
|
450
|
-
}
|
|
451
|
-
catch (e) {
|
|
452
|
-
// Exception trying to add onload handler to opened window
|
|
453
|
-
// eslint-disable-next-line no-console
|
|
454
|
-
console.error(`Error adding event listener on popup window: ${e}`);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
/* eslint-enable prefer-promise-reject-errors */
|
|
459
|
-
const fnCloseIframe = () => {
|
|
460
|
-
elIframe.parentNode.removeChild(elIframe);
|
|
461
|
-
elCloseBtn.parentNode.removeChild(elCloseBtn);
|
|
462
|
-
elIframe = null;
|
|
463
|
-
elCloseBtn = null;
|
|
464
|
-
bWinIframe = false;
|
|
465
|
-
};
|
|
466
|
-
const fnCloseAndReject = () => {
|
|
467
|
-
fnCloseIframe();
|
|
468
|
-
/* eslint-disable-next-line prefer-promise-reject-errors */
|
|
469
|
-
reject('closed');
|
|
470
|
-
};
|
|
471
|
-
const fnAuthMessageReceiver = (event) => {
|
|
472
|
-
// Check origin to make sure it is the redirect origin
|
|
473
|
-
if (event.origin !== redirectOrigin)
|
|
474
|
-
return;
|
|
475
|
-
if (!event.data || !event.data.type || event.data.type !== 'PegaAuth')
|
|
476
|
-
return;
|
|
477
|
-
const aArgs = ['code', 'state', 'error', 'errorDesc'];
|
|
478
|
-
const aValues = [];
|
|
479
|
-
for (let i = 0; i < aArgs.length; i += 1) {
|
|
480
|
-
const arg = aArgs[i];
|
|
481
|
-
aValues[arg] = event.data[arg] ? event.data[arg].toString() : null;
|
|
482
|
-
}
|
|
483
|
-
if (aValues.error || (aValues.code && aValues.state === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
|
|
484
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
485
|
-
fnGetTokenAndFinish(aValues.code, aValues.error, aValues.errorDesc);
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
const fnEnableMessageReceiver = (bEnable) => {
|
|
489
|
-
if (bEnable) {
|
|
490
|
-
window.addEventListener('message', fnAuthMessageReceiver, false);
|
|
491
|
-
window.authCodeCallback = (code, state1, error, errorDesc) => {
|
|
492
|
-
if (error || (code && state1 === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
|
|
493
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
494
|
-
fnGetTokenAndFinish(code, error, errorDesc);
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
499
|
-
window.removeEventListener('message', fnAuthMessageReceiver, false);
|
|
500
|
-
delete window.authCodeCallback;
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
const doAuthorize = () => {
|
|
504
|
-
// If there is a userIdentifier and password specified or an external SSO auth service,
|
|
505
|
-
// we can try to use this silently in an iFrame first
|
|
506
|
-
bWinIframe =
|
|
507
|
-
!this.isNode &&
|
|
508
|
-
!__classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed &&
|
|
509
|
-
iframeTimeout > 0 &&
|
|
510
|
-
((!!__classPrivateFieldGet(this, _PegaAuth_config, "f").userIdentifier && !!__classPrivateFieldGet(this, _PegaAuth_config, "f").password) ||
|
|
511
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").iframeLoginUI ||
|
|
512
|
-
__classPrivateFieldGet(this, _PegaAuth_config, "f").authService !== 'pega');
|
|
513
|
-
// Enable message receiver
|
|
514
|
-
if (!this.isNode) {
|
|
515
|
-
fnEnableMessageReceiver(true);
|
|
516
|
-
}
|
|
517
|
-
if (bWinIframe) {
|
|
518
|
-
const nFrameZLevel = 99999;
|
|
519
|
-
elIframe = document.createElement('iframe');
|
|
520
|
-
elIframe.id = `pe${__classPrivateFieldGet(this, _PegaAuth_config, "f").clientId}`;
|
|
521
|
-
const loginBoxWidth = 500;
|
|
522
|
-
const loginBoxHeight = 700;
|
|
523
|
-
const oStyle = elIframe.style;
|
|
524
|
-
oStyle.position = 'absolute';
|
|
525
|
-
oStyle.display = 'none';
|
|
526
|
-
oStyle.zIndex = nFrameZLevel;
|
|
527
|
-
oStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2)}px`;
|
|
528
|
-
oStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2)}px`;
|
|
529
|
-
oStyle.width = '500px';
|
|
530
|
-
oStyle.height = '700px';
|
|
531
|
-
// Add Iframe to top of document DOM to have it load
|
|
532
|
-
document.body.insertBefore(elIframe, document.body.firstChild);
|
|
533
|
-
// document.getElementsByTagName('body')[0].appendChild(elIframe);
|
|
534
|
-
elIframe.addEventListener('load', myWinOnLoad, true);
|
|
535
|
-
// Disallow iframe content attempts to navigate main window
|
|
536
|
-
elIframe.setAttribute('sandbox', 'allow-scripts allow-forms allow-same-origin');
|
|
537
|
-
// Adding prompt=none as this is standard OIDC way to communicate no UI is expected (expecting Pega security to support this one day)
|
|
538
|
-
elIframe.setAttribute('src', bDisablePromptNone ? theUrl : `${theUrl}&prompt=none`);
|
|
539
|
-
const svgCloseBtn = `<?xml version="1.0" encoding="UTF-8"?>
|
|
540
|
-
<svg width="34px" height="34px" viewBox="0 0 34 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
541
|
-
<title>Dismiss - Black</title>
|
|
542
|
-
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
543
|
-
<g transform="translate(1.000000, 1.000000)">
|
|
544
|
-
<circle fill="#252C32" cx="16" cy="16" r="16"></circle>
|
|
545
|
-
<g transform="translate(9.109375, 9.214844)" fill="#FFFFFF" fill-rule="nonzero">
|
|
546
|
-
<path d="M12.7265625,0 L0,12.6210938 L1.0546875,13.5703125 L13.78125,1.0546875 L12.7265625,0 Z M13.7460938,12.5507812 L1.01953125,0 L0,1.01953125 L12.7617188,13.6054688 L13.7460938,12.5507812 Z"></path>
|
|
547
|
-
</g>
|
|
548
|
-
</g>
|
|
549
|
-
</g>
|
|
550
|
-
</svg>`;
|
|
551
|
-
const bCloseWithinFrame = false;
|
|
552
|
-
elCloseBtn = document.createElement('img');
|
|
553
|
-
elCloseBtn.onclick = fnCloseAndReject;
|
|
554
|
-
elCloseBtn.src = `data:image/svg+xml;base64,${btoa(svgCloseBtn)}`;
|
|
555
|
-
const oBtnStyle = elCloseBtn.style;
|
|
556
|
-
oBtnStyle.cursor = 'pointer';
|
|
557
|
-
// If svg doesn't set width and height might want to set oBtStyle width and height to something like '2em'
|
|
558
|
-
oBtnStyle.position = 'absolute';
|
|
559
|
-
oBtnStyle.display = 'none';
|
|
560
|
-
oBtnStyle.zIndex = nFrameZLevel + 1;
|
|
561
|
-
const nTopOffset = bCloseWithinFrame ? 5 : -10;
|
|
562
|
-
const nRightOffset = bCloseWithinFrame ? -34 : -20;
|
|
563
|
-
const nTop = Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2) + nTopOffset;
|
|
564
|
-
oBtnStyle.top = `${nTop}px`;
|
|
565
|
-
const nLeft = Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2) + loginBoxWidth + nRightOffset;
|
|
566
|
-
oBtnStyle.left = `${nLeft}px`;
|
|
567
|
-
document.body.insertBefore(elCloseBtn, document.body.firstChild);
|
|
568
|
-
// If the password was wrong, then the login screen will be in the iframe
|
|
569
|
-
// ..and with Pega without realization of US-372314 it may replace the top (main portal) window
|
|
570
|
-
// For now set a timer and if the timer expires, remove the iFrame and use same url within
|
|
571
|
-
// visible window
|
|
572
|
-
tmrAuthComplete = setTimeout(() => {
|
|
573
|
-
clearTimeout(tmrAuthComplete);
|
|
574
|
-
/*
|
|
575
|
-
// remove password from config
|
|
576
|
-
if (this.#config.password) {
|
|
577
|
-
delete this.#config.password;
|
|
578
|
-
this.#updateConfig();
|
|
579
|
-
}
|
|
580
|
-
*/
|
|
581
|
-
// Display the iframe where the redirects did not succeed (or invoke a popup window)
|
|
582
|
-
if (__classPrivateFieldGet(this, _PegaAuth_config, "f").iframeLoginUI) {
|
|
583
|
-
elIframe.style.display = 'block';
|
|
584
|
-
elCloseBtn.style.display = 'block';
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
fnCloseIframe();
|
|
588
|
-
fnOpenPopup();
|
|
589
|
-
}
|
|
590
|
-
}, iframeTimeout);
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
if (this.isNode) {
|
|
594
|
-
// Determine port to listen to by extracting it from redirect uri
|
|
595
|
-
const { redirectUri, cert, key } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
|
|
596
|
-
const isHttp = redirectUri.startsWith('http:');
|
|
597
|
-
const nLocalhost = redirectUri.indexOf('localhost:');
|
|
598
|
-
const nSlash = redirectUri.indexOf('/', nLocalhost + 10);
|
|
599
|
-
const nPort = parseInt(redirectUri.substring(nLocalhost + 10, nSlash), 10);
|
|
600
|
-
if (nLocalhost !== -1) {
|
|
601
|
-
const options = key && cert && !isHttp
|
|
602
|
-
? {
|
|
603
|
-
key: this.fs.readFileSync(key),
|
|
604
|
-
cert: this.fs.readFileSync(cert)
|
|
605
|
-
}
|
|
606
|
-
: {};
|
|
607
|
-
const server = (isHttp ? this.http : this.https).createServer(options, (req, res) => {
|
|
608
|
-
const { winTitle, winBodyHtml } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
|
|
609
|
-
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
610
|
-
// Auto closing window for now. Can always leave it up and allow authConfig props to set title and bodyHtml
|
|
611
|
-
res.end(`<html><head><title>${winTitle}</title><script>window.close();</script></head><body>${winBodyHtml}</body></html>`);
|
|
612
|
-
const queryString = req.url.split('?')[1];
|
|
613
|
-
const urlParams = new URLSearchParams(queryString);
|
|
614
|
-
const code = urlParams.get('code');
|
|
615
|
-
const state1 = urlParams.get('state');
|
|
616
|
-
const error = urlParams.get('error');
|
|
617
|
-
const errorDesc = urlParams.get('error_description');
|
|
618
|
-
if (error || (code && state1 === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
|
|
619
|
-
// Stop receiving connections and close when all are handled.
|
|
620
|
-
server.close();
|
|
621
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
622
|
-
fnGetTokenAndFinish(code, error, errorDesc);
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
/* eslint-enable no-undef */
|
|
626
|
-
server.listen(nPort);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
fnOpenPopup();
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
/* Retrieve token(s) and close login window */
|
|
633
|
-
const fnGetTokenAndFinish = (code, error, errorDesc) => {
|
|
634
|
-
// Can clear state in session info at this point
|
|
635
|
-
delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
|
|
636
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
637
|
-
if (!this.isNode) {
|
|
638
|
-
fnEnableMessageReceiver(false);
|
|
639
|
-
if (bWinIframe) {
|
|
640
|
-
clearTimeout(tmrAuthComplete);
|
|
641
|
-
fnCloseIframe();
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
clearInterval(checkWindowClosed);
|
|
645
|
-
myWindow.close();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
if (code) {
|
|
649
|
-
this.getToken(code)
|
|
650
|
-
.then((token) => {
|
|
651
|
-
resolve(token);
|
|
652
|
-
})
|
|
653
|
-
.catch((e) => {
|
|
654
|
-
reject(e);
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
else if (error) {
|
|
658
|
-
// Handle some errors in a special manner and pass others back to client
|
|
659
|
-
if (error === 'login_required') {
|
|
660
|
-
// eslint-disable-next-line no-console
|
|
661
|
-
console.warn('silent authentication failed...starting full authentication');
|
|
662
|
-
const bSpecialDebugPath = false;
|
|
663
|
-
if (bSpecialDebugPath) {
|
|
664
|
-
fnSetSilentAuthFailed(false);
|
|
665
|
-
bDisablePromptNone = true;
|
|
666
|
-
}
|
|
667
|
-
else {
|
|
668
|
-
fnSetSilentAuthFailed(true);
|
|
669
|
-
bDisablePromptNone = false;
|
|
670
|
-
}
|
|
671
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
|
|
672
|
-
theUrl = url;
|
|
673
|
-
doAuthorize();
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
else if (error === 'invalid_session_index') {
|
|
677
|
-
// eslint-disable-next-line no-console
|
|
678
|
-
console.warn('auth session no longer valid...starting new session');
|
|
679
|
-
// In these scenarios, not much user can do without just starting a new session, so do that
|
|
680
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateSessionIndex).call(this, null);
|
|
681
|
-
fnSetSilentAuthFailed(false);
|
|
682
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
|
|
683
|
-
theUrl = url;
|
|
684
|
-
doAuthorize();
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
// eslint-disable-next-line no-console
|
|
689
|
-
console.warn(`Authorize failed: ${error}. ${errorDesc}\nFailing authorize url: ${theUrl}`);
|
|
690
|
-
throw new Error(error, { cause: errorDesc });
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
|
|
695
|
-
theUrl = url;
|
|
696
|
-
doAuthorize();
|
|
697
|
-
});
|
|
420
|
+
const moreAuthArgs = (authService ? `&authentication_service=${encodeURIComponent(authService)}` : "") +
|
|
421
|
+
(sessionIndex && this.config.sessionIndexAttempts < 3 ? `&session_index=${sessionIndex}` : "") +
|
|
422
|
+
(useLocking ? `&enable_psyncId=true` : '') +
|
|
423
|
+
(userIdentifier ? `&UserIdentifier=${encodeURIComponent(userIdentifier)}` : '') +
|
|
424
|
+
(userIdentifier && password ? `&Password=${encodeURIComponent(window.atob(password))}` : '');
|
|
425
|
+
return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getCodeChallenge).call(this, this.config.codeVerifier).then(cc => {
|
|
426
|
+
// Now includes new enable_psyncId=true and session_index params
|
|
427
|
+
return `${authorizeUri}?client_id=${clientId}&response_type=code&redirect_uri=${redirectUri}&scope=openid+email+profile${addtlScope}&state=${state}&code_challenge=${cc}&code_challenge_method=S256${moreAuthArgs}`;
|
|
698
428
|
});
|
|
699
|
-
}, _PegaAuth_updateSessionIndex = function _PegaAuth_updateSessionIndex(sessionIndex) {
|
|
700
|
-
if (sessionIndex) {
|
|
701
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex = sessionIndex;
|
|
702
|
-
__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts = 0;
|
|
703
|
-
}
|
|
704
|
-
else if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex) {
|
|
705
|
-
delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex;
|
|
706
|
-
}
|
|
707
|
-
__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
|
|
708
429
|
}, _PegaAuth_sha256Hash = function _PegaAuth_sha256Hash(str) {
|
|
709
|
-
|
|
710
|
-
// so using a different set of apis to get expected results.
|
|
711
|
-
if (this.isNode) {
|
|
712
|
-
return new Promise((resolve) => {
|
|
713
|
-
resolve(this.crypto.createHash('sha256').update(str).digest());
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
return this.subtle.digest('SHA-256', new TextEncoder().encode(str));
|
|
430
|
+
return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(str));
|
|
717
431
|
}, _PegaAuth_encode64 = function _PegaAuth_encode64(buff) {
|
|
718
|
-
return btoa(new Uint8Array(buff).reduce((s, b) => s + String.fromCharCode(b), ''));
|
|
432
|
+
return window.btoa(new Uint8Array(buff).reduce((s, b) => s + String.fromCharCode(b), ''));
|
|
719
433
|
}, _PegaAuth_base64UrlSafeEncode = function _PegaAuth_base64UrlSafeEncode(buf) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
this.
|
|
724
|
-
return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
|
|
725
|
-
}, _PegaAuth_getCodeChallenge =
|
|
726
|
-
/* Calc code verifier if necessary
|
|
727
|
-
*/
|
|
728
|
-
/* eslint-disable camelcase */
|
|
729
|
-
async function _PegaAuth_getCodeChallenge(code_verifier) {
|
|
730
|
-
return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_sha256Hash).call(this, code_verifier)
|
|
731
|
-
.then((hashed) => {
|
|
434
|
+
const s = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_encode64).call(this, buf).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
435
|
+
return s;
|
|
436
|
+
}, _PegaAuth_getCodeChallenge = function _PegaAuth_getCodeChallenge(code_verifier) {
|
|
437
|
+
return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_sha256Hash).call(this, code_verifier).then((hashed) => {
|
|
732
438
|
return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, hashed);
|
|
733
|
-
})
|
|
734
|
-
.catch((error) => {
|
|
439
|
+
}).catch((error) => {
|
|
735
440
|
// eslint-disable-next-line no-console
|
|
736
|
-
console.
|
|
737
|
-
})
|
|
738
|
-
.finally(() => {
|
|
739
|
-
return null;
|
|
740
|
-
});
|
|
741
|
-
}, _PegaAuth_getAgent = function _PegaAuth_getAgent() {
|
|
742
|
-
if (this.isNode && __classPrivateFieldGet(this, _PegaAuth_config, "f").ignoreInvalidCerts) {
|
|
743
|
-
const options = { rejectUnauthorized: false };
|
|
744
|
-
if (__classPrivateFieldGet(this, _PegaAuth_config, "f").legacyTLS) {
|
|
745
|
-
options.secureOptions = this.crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT;
|
|
746
|
-
}
|
|
747
|
-
return new this.https.Agent(options);
|
|
748
|
-
}
|
|
749
|
-
return undefined;
|
|
441
|
+
console.log(error);
|
|
442
|
+
}).finally(() => { return null; });
|
|
750
443
|
};
|
|
751
444
|
export default PegaAuth;
|
|
752
445
|
//# sourceMappingURL=auth.js.map
|