@salesforce/ui-bundle-template-feature-vue-authentication 0.0.0-stage → 13.1.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/LICENSE.txt +82 -0
- package/README.md +106 -2
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +5423 -0
- package/dist/README.md +83 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/eslint.config.js +7 -0
- package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls +68 -0
- package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls +141 -0
- package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleChangePassword.cls +77 -0
- package/dist/force-app/main/default/classes/UIBundleChangePassword.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls +71 -0
- package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleLogin.cls +105 -0
- package/dist/force-app/main/default/classes/UIBundleLogin.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleRegistration.cls +162 -0
- package/dist/force-app/main/default/classes/UIBundleRegistration.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls +145 -0
- package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
- package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
- package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.forceignore +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.graphqlrc.yml +2 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierignore +9 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierrc +11 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/README.md +43 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/codegen.yml +95 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/components.json +19 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/e2e/app.spec.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/eslint.config.js +124 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/feature-vue-authentication.uibundle-meta.xml +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/index.html +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/package.json +74 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/playwright.config.ts +24 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/get-graphql-schema.mjs +71 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/rewrite-e2e-assets.mjs +23 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/App.vue +5 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/api/graphqlClient.ts +44 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/appLayout.vue +80 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/alerts/status-alert.vue +59 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/layouts/card-layout.vue +30 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/Alert.vue +21 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertAction.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertDescription.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertTitle.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/index.ts +25 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/Avatar.vue +23 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarFallback.vue +31 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarImage.vue +16 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/index.ts +3 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/Button.vue +33 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/index.ts +43 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/Card.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardAction.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardContent.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardDescription.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardFooter.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardHeader.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardTitle.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/index.ts +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/Checkbox.vue +43 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/Collapsible.vue +19 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleContent.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleTrigger.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/index.ts +3 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/Dialog.vue +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogClose.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogContent.vue +59 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogDescription.vue +31 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogFooter.vue +33 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogOverlay.vue +31 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogPortal.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTitle.vue +26 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTrigger.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/index.ts +10 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +51 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuContent.vue +47 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuItem.vue +44 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +30 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuPortal.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +52 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +26 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +19 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +37 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +38 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/index.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/Field.vue +27 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldContent.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldDescription.vue +24 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldError.vue +48 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldGroup.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLabel.vue +24 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLegend.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSeparator.vue +31 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSet.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldTitle.vue +22 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/index.ts +33 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/index.ts +115 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/Input.vue +30 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/Label.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/Pagination.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationContent.vue +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationEllipsis.vue +23 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationItem.vue +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationLink.vue +31 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationNext.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationPrevious.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/index.ts +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/Popover.vue +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverAnchor.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverContent.vue +44 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverDescription.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverHeader.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTitle.vue +14 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTrigger.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/index.ts +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/Select.vue +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectContent.vue +65 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectGroup.vue +26 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectItem.vue +41 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectLabel.vue +26 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollDownButton.vue +32 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollUpButton.vue +32 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectSeparator.vue +24 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectTrigger.vue +45 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectValue.vue +12 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/index.ts +10 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/Separator.vue +33 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/Skeleton.vue +15 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/Sonner.vue +29 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/index.ts +3 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/Spinner.vue +17 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/index.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/composables/useAsyncData.ts +69 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/api/userProfileApi.ts +107 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authHelpers.ts +78 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authenticationConfig.ts +66 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/components/SocialLogin.vue +150 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useCountdownTimer.ts +246 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useRetryWithBackoff.ts +112 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useSessionTimeout.ts +244 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/context/authContext.ts +115 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/footers/FooterLink.vue +47 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/AuthForm.vue +141 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/SubmitButton.vue +57 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/EmailField.vue +46 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/PasswordField.vue +48 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/TextField.vue +106 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/form.ts +90 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/formContexts.ts +61 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layout/CenteredPageLayout.vue +76 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/AuthAppLayout.vue +24 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/PrivateRouteLayout.vue +50 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/menu/AuthMenu.vue +143 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ChangePassword.vue +122 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ForgotPassword.vue +90 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Login.vue +106 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Profile.vue +180 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Register.vue +135 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ResetPassword.vue +114 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionExpiredAlert.vue +50 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionTimeoutValidator.vue +136 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionWarningModal.vue +151 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeService.ts +142 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts +82 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/helpers.ts +90 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/queryToSearchParams.ts +33 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/lib/utils.ts +6 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/main.ts +6 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/Home.vue +10 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/NotFound.vue +18 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router-utils.ts +32 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router.ts +90 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/styles/global.css +134 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/test/setup.ts +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.json +45 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.node.json +13 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.tsbuildinfo +1 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/ui-bundle.json +7 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite-env.d.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite.config.ts +106 -0
- package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vitest-env.d.ts +2 -0
- package/dist/jest.config.js +6 -0
- package/dist/package-lock.json +12554 -0
- package/dist/package.json +46 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/gitignore-templates.json +4 -0
- package/dist/scripts/graphql-search.sh +191 -0
- package/dist/scripts/network-senders.mjs +84 -0
- package/dist/scripts/org-setup-config-schema.mjs +132 -0
- package/dist/scripts/org-setup-dev.mjs +114 -0
- package/dist/scripts/org-setup-url.mjs +108 -0
- package/dist/scripts/org-setup-utils.mjs +569 -0
- package/dist/scripts/org-setup-xml.mjs +283 -0
- package/dist/scripts/org-setup.config.json +5 -0
- package/dist/scripts/org-setup.mjs +2545 -0
- package/dist/scripts/sf-project-setup.mjs +103 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/scripts/validate-org-setup-config.mjs +38 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +44 -4
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST endpoint for Web Applications for user self-registration.
|
|
3
|
+
*
|
|
4
|
+
* Endpoint: POST /services/apexrest/auth/register/
|
|
5
|
+
*
|
|
6
|
+
* Creates a new external user account, validates credentials against org password policy,
|
|
7
|
+
* and returns a login URL for automatic session creation.
|
|
8
|
+
*
|
|
9
|
+
* Security: Uses 'without sharing' to allow guest users to check for duplicate usernames.
|
|
10
|
+
*/
|
|
11
|
+
@RestResource(urlMapping='/auth/register')
|
|
12
|
+
global without sharing class UIBundleRegistration {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Registers a new external user and logs them in.
|
|
16
|
+
* @param request The registration request containing user details.
|
|
17
|
+
* @return SuccessResponse or ErrorResponse.
|
|
18
|
+
*/
|
|
19
|
+
@HttpPost
|
|
20
|
+
global static RegistrationResponse registerUser(RegistrationRequest request) {
|
|
21
|
+
Savepoint sp = Database.setSavepoint();
|
|
22
|
+
try {
|
|
23
|
+
request.validate();
|
|
24
|
+
|
|
25
|
+
User u = new User(
|
|
26
|
+
Username = request.email,
|
|
27
|
+
Email = request.email,
|
|
28
|
+
FirstName = request.firstName,
|
|
29
|
+
LastName = request.lastName,
|
|
30
|
+
// Generate unique nickname: first initial + up to 20 chars of last name + 4 random digits
|
|
31
|
+
CommunityNickname = request.firstName.left(1) + request.lastName.left(20) +
|
|
32
|
+
String.valueOf(Crypto.getRandomInteger()).left(4)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
validatePassword(u, request.password);
|
|
36
|
+
createUser(u, request.password);
|
|
37
|
+
|
|
38
|
+
String startUrl = UIBundleAuthUtils.getSanitizedStartUrl(request.startUrl, Site.getPathPrefix());
|
|
39
|
+
PageReference pageRef = Site.login(request.email, request.password, startUrl);
|
|
40
|
+
|
|
41
|
+
return new SuccessRegistrationResponse(pageRef?.getUrl());
|
|
42
|
+
} catch (UIBundleAuthUtils.AuthException ex) {
|
|
43
|
+
Database.rollback(sp);
|
|
44
|
+
RestContext.response.statusCode = ex.statusCode;
|
|
45
|
+
return new ErrorRegistrationResponse(ex.messages);
|
|
46
|
+
} catch (Exception ex) {
|
|
47
|
+
Database.rollback(sp);
|
|
48
|
+
RestContext.response.statusCode = 500;
|
|
49
|
+
return new ErrorRegistrationResponse(ex.getMessage());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Base response class for registration.
|
|
55
|
+
*/
|
|
56
|
+
global abstract class RegistrationResponse {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Success response with redirect URL.
|
|
61
|
+
*/
|
|
62
|
+
global class SuccessRegistrationResponse extends RegistrationResponse {
|
|
63
|
+
global Boolean success = true;
|
|
64
|
+
global String redirectUrl;
|
|
65
|
+
|
|
66
|
+
global SuccessRegistrationResponse(String redirectUrl) {
|
|
67
|
+
this.redirectUrl = redirectUrl;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Error response with error messages.
|
|
73
|
+
*/
|
|
74
|
+
global class ErrorRegistrationResponse extends RegistrationResponse {
|
|
75
|
+
global List<String> errors;
|
|
76
|
+
|
|
77
|
+
global ErrorRegistrationResponse(List<String> errors) {
|
|
78
|
+
this.errors = new List<String>(errors);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
global ErrorRegistrationResponse(String error) {
|
|
82
|
+
this.errors = new List<String>{ error };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Request payload for user registration.
|
|
88
|
+
*/
|
|
89
|
+
global class RegistrationRequest {
|
|
90
|
+
global String email;
|
|
91
|
+
global String firstName;
|
|
92
|
+
global String lastName;
|
|
93
|
+
global String password;
|
|
94
|
+
global String startUrl;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Trims fields and validates required fields and business rules.
|
|
98
|
+
* @throws UIBundleAuthUtils.AuthException if validation fails.
|
|
99
|
+
*/
|
|
100
|
+
public void validate() {
|
|
101
|
+
email = email?.trim()?.toLowerCase();
|
|
102
|
+
firstName = firstName?.trim();
|
|
103
|
+
lastName = lastName?.trim();
|
|
104
|
+
startUrl = startUrl?.trim();
|
|
105
|
+
|
|
106
|
+
List<String> errors = new List<String>();
|
|
107
|
+
if (String.isBlank(firstName)) { errors.add('First name is required.'); }
|
|
108
|
+
if (String.isBlank(lastName)) { errors.add('Last name is required.'); }
|
|
109
|
+
if (String.isBlank(password)) { errors.add('Password is required.'); }
|
|
110
|
+
if (!Site.isValidUserName(email)) { errors.add('Email is invalid.'); }
|
|
111
|
+
else if (!isUserUnique(email)) {
|
|
112
|
+
errors.add('A user with this email already exists.');
|
|
113
|
+
}
|
|
114
|
+
if (!errors.isEmpty()) {
|
|
115
|
+
throw new UIBundleAuthUtils.AuthException(400, errors);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Validates password against org password policy.
|
|
122
|
+
* @param user The user record.
|
|
123
|
+
* @param password The password to validate.
|
|
124
|
+
* @throws UIBundleAuthUtils.AuthException if password does not meet requirements.
|
|
125
|
+
*/
|
|
126
|
+
private static void validatePassword(User user, String password) {
|
|
127
|
+
try {
|
|
128
|
+
Site.validatePassword(user, password, password);
|
|
129
|
+
} catch (System.SecurityException ex) {
|
|
130
|
+
throw new UIBundleAuthUtils.AuthException(400, ex.getMessage());
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Creates the external user account.
|
|
136
|
+
* @param u The user record.
|
|
137
|
+
* @param password The password for the new user.
|
|
138
|
+
* @return The new user's ID.
|
|
139
|
+
* @throws UIBundleAuthUtils.AuthException if user creation fails.
|
|
140
|
+
*/
|
|
141
|
+
private static String createUser(User u, String password) {
|
|
142
|
+
String userId;
|
|
143
|
+
try {
|
|
144
|
+
userId = Site.createExternalUser(u, null, password);
|
|
145
|
+
} catch (Site.ExternalUserCreateException ex) {
|
|
146
|
+
throw new UIBundleAuthUtils.AuthException(500, ex.getDisplayMessages());
|
|
147
|
+
}
|
|
148
|
+
if (userId == null) {
|
|
149
|
+
throw new UIBundleAuthUtils.AuthException(500, 'Could not register new user.');
|
|
150
|
+
}
|
|
151
|
+
return userId;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Checks if a username is unique (not already taken).
|
|
156
|
+
* @param username The username to check.
|
|
157
|
+
* @return {@code true} if unique, {@code false} if already exists.
|
|
158
|
+
*/
|
|
159
|
+
private static Boolean isUserUnique(String username) {
|
|
160
|
+
return [SELECT Id FROM User WHERE Username = :username LIMIT 1].isEmpty();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST endpoint for Social Login configuration on React Experience Cloud sites.
|
|
3
|
+
*
|
|
4
|
+
* Endpoint: GET /services/apexrest/auth/social-login-config?startURL=/
|
|
5
|
+
*
|
|
6
|
+
* This replicates the behavior of the OOTB community_login/socialLogin LWC:
|
|
7
|
+
* - applauncher.SocialLoginController.getAuthProviders()
|
|
8
|
+
* - applauncher.SocialLoginController.getSamlProviders()
|
|
9
|
+
* - applauncher.SocialLoginController.getCommunityDomainSsoUrl()
|
|
10
|
+
* - applauncher.SocialLoginController.getSamlSsoUrl()
|
|
11
|
+
* - applauncher.SocialLoginController.handleIdp()
|
|
12
|
+
*
|
|
13
|
+
* The OOTB LWC does not render on React (Site Container) sites due to a platform
|
|
14
|
+
* restriction (isSiteContainer check in node-loginsettings.ftl).
|
|
15
|
+
* This endpoint enables a custom React component to achieve the same functionality.
|
|
16
|
+
*
|
|
17
|
+
* @see https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_AuthConfiguration.htm
|
|
18
|
+
*/
|
|
19
|
+
@RestResource(urlMapping='/auth/social-login-config')
|
|
20
|
+
global with sharing class UIBundleSocialLoginConfig {
|
|
21
|
+
|
|
22
|
+
@HttpGet
|
|
23
|
+
global static SocialLoginConfigResponse getConfig() {
|
|
24
|
+
try {
|
|
25
|
+
// Resolve the post-authentication redirect path, sanitized against
|
|
26
|
+
// open-redirect attacks (CWE-601). See resolveStartUrl.
|
|
27
|
+
String startUrl = resolveStartUrl();
|
|
28
|
+
|
|
29
|
+
String communityUrl = Site.getBaseUrl();
|
|
30
|
+
Auth.AuthConfiguration authConfig = new Auth.AuthConfiguration(communityUrl, startUrl);
|
|
31
|
+
|
|
32
|
+
List<AuthProviderInfo> authProviders = new List<AuthProviderInfo>();
|
|
33
|
+
List<SamlProviderInfo> samlProviders = new List<SamlProviderInfo>();
|
|
34
|
+
String autoRedirectUrl = null;
|
|
35
|
+
|
|
36
|
+
// Fetch OAuth Auth Providers (Google, Facebook, etc.)
|
|
37
|
+
List<AuthProvider> rawAuthProviders = authConfig.getAuthProviders();
|
|
38
|
+
for (AuthProvider ap : rawAuthProviders) {
|
|
39
|
+
String ssoUrl = Auth.AuthConfiguration.getAuthProviderSsoDomainUrl(
|
|
40
|
+
communityUrl, startUrl, ap.DeveloperName
|
|
41
|
+
);
|
|
42
|
+
authProviders.add(new AuthProviderInfo(
|
|
43
|
+
ap.DeveloperName,
|
|
44
|
+
ap.FriendlyName,
|
|
45
|
+
ap.IconUrl,
|
|
46
|
+
ssoUrl
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Fetch SAML SSO Providers
|
|
51
|
+
List<SamlSsoConfig> rawSamlProviders = authConfig.getSamlProviders();
|
|
52
|
+
for (SamlSsoConfig saml : rawSamlProviders) {
|
|
53
|
+
String ssoUrl = Auth.AuthConfiguration.getSamlSsoUrl(
|
|
54
|
+
communityUrl, startUrl, saml.Id
|
|
55
|
+
);
|
|
56
|
+
samlProviders.add(new SamlProviderInfo(
|
|
57
|
+
saml.Id,
|
|
58
|
+
saml.MasterLabel,
|
|
59
|
+
ssoUrl
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// handleIdp behavior: auto-redirect if exactly one IDP and no username/password login
|
|
64
|
+
Integer totalProviders = rawAuthProviders.size() + rawSamlProviders.size();
|
|
65
|
+
if (totalProviders == 1 && !authConfig.getUsernamePasswordEnabled()) {
|
|
66
|
+
if (!authProviders.isEmpty()) {
|
|
67
|
+
autoRedirectUrl = authProviders[0].ssoUrl;
|
|
68
|
+
} else if (!samlProviders.isEmpty()) {
|
|
69
|
+
autoRedirectUrl = samlProviders[0].ssoUrl;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return new SocialLoginConfigResponse(authProviders, samlProviders, autoRedirectUrl);
|
|
74
|
+
} catch (Exception ex) {
|
|
75
|
+
System.debug(LoggingLevel.ERROR, 'UIBundleSocialLoginConfig error: ' + ex.getMessage());
|
|
76
|
+
return new SocialLoginConfigResponse(
|
|
77
|
+
new List<AuthProviderInfo>(),
|
|
78
|
+
new List<SamlProviderInfo>(),
|
|
79
|
+
null
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Resolves the post-authentication redirect path from the request and
|
|
86
|
+
* sanitizes it to prevent open-redirect attacks (CWE-601).
|
|
87
|
+
*
|
|
88
|
+
* Delegates to the shared UIBundleAuthUtils.getSanitizedStartUrl — the same
|
|
89
|
+
* validation used by UIBundleLogin and UIBundleRegistration — which
|
|
90
|
+
* URL-decodes the value (catching encoded bypasses such as %2f%2f) and then
|
|
91
|
+
* rejects absolute, protocol-relative ("//"), backslash, "@", ":" and
|
|
92
|
+
* control-character inputs, falling back to the community path prefix. Only
|
|
93
|
+
* safe, community-relative paths survive, prefixed with Site.getPathPrefix()
|
|
94
|
+
* so the redirect lands on this community rather than the org default.
|
|
95
|
+
*/
|
|
96
|
+
@TestVisible
|
|
97
|
+
private static String resolveStartUrl() {
|
|
98
|
+
return UIBundleAuthUtils.getSanitizedStartUrl(
|
|
99
|
+
RestContext.request.params.get('startURL'),
|
|
100
|
+
Site.getPathPrefix()
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
global class SocialLoginConfigResponse {
|
|
105
|
+
global List<AuthProviderInfo> authProviders;
|
|
106
|
+
global List<SamlProviderInfo> samlProviders;
|
|
107
|
+
global String autoRedirectUrl;
|
|
108
|
+
|
|
109
|
+
global SocialLoginConfigResponse(
|
|
110
|
+
List<AuthProviderInfo> authProviders,
|
|
111
|
+
List<SamlProviderInfo> samlProviders,
|
|
112
|
+
String autoRedirectUrl
|
|
113
|
+
) {
|
|
114
|
+
this.authProviders = authProviders;
|
|
115
|
+
this.samlProviders = samlProviders;
|
|
116
|
+
this.autoRedirectUrl = autoRedirectUrl;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
global class AuthProviderInfo {
|
|
121
|
+
global String developerName;
|
|
122
|
+
global String friendlyName;
|
|
123
|
+
global String iconUrl;
|
|
124
|
+
global String ssoUrl;
|
|
125
|
+
|
|
126
|
+
global AuthProviderInfo(String developerName, String friendlyName, String iconUrl, String ssoUrl) {
|
|
127
|
+
this.developerName = developerName;
|
|
128
|
+
this.friendlyName = friendlyName;
|
|
129
|
+
this.iconUrl = iconUrl;
|
|
130
|
+
this.ssoUrl = ssoUrl;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
global class SamlProviderInfo {
|
|
135
|
+
global String id;
|
|
136
|
+
global String masterLabel;
|
|
137
|
+
global String ssoUrl;
|
|
138
|
+
|
|
139
|
+
global SamlProviderInfo(String id, String masterLabel, String ssoUrl) {
|
|
140
|
+
this.id = id;
|
|
141
|
+
this.masterLabel = masterLabel;
|
|
142
|
+
this.ssoUrl = ssoUrl;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test class for UIBundleSocialLoginConfig REST endpoint.
|
|
3
|
+
*
|
|
4
|
+
* Auth.AuthConfiguration requires a valid community URL so these tests
|
|
5
|
+
* exercise the error-handling path and verify the response wrapper structure.
|
|
6
|
+
* Integration-level testing of actual Auth Provider/SAML discovery happens
|
|
7
|
+
* in the target org via the React component E2E flow.
|
|
8
|
+
*/
|
|
9
|
+
@isTest
|
|
10
|
+
private class UIBundleSocialLoginConfig_Test {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Test that the endpoint returns an empty config when no community context
|
|
14
|
+
* is available (covers the catch block graceful fallback).
|
|
15
|
+
*/
|
|
16
|
+
@isTest
|
|
17
|
+
static void testGetConfigNoSiteContext() {
|
|
18
|
+
RestRequest req = new RestRequest();
|
|
19
|
+
req.requestURI = '/services/apexrest/auth/social-login-config';
|
|
20
|
+
req.httpMethod = 'GET';
|
|
21
|
+
req.params.put('startURL', '/');
|
|
22
|
+
RestContext.request = req;
|
|
23
|
+
RestContext.response = new RestResponse();
|
|
24
|
+
|
|
25
|
+
Test.startTest();
|
|
26
|
+
UIBundleSocialLoginConfig.SocialLoginConfigResponse result =
|
|
27
|
+
UIBundleSocialLoginConfig.getConfig();
|
|
28
|
+
Test.stopTest();
|
|
29
|
+
|
|
30
|
+
// Should return empty lists (graceful fallback), not null
|
|
31
|
+
System.assertNotEquals(null, result, 'Response should not be null');
|
|
32
|
+
System.assertNotEquals(null, result.authProviders, 'authProviders list should not be null');
|
|
33
|
+
System.assertNotEquals(null, result.samlProviders, 'samlProviders list should not be null');
|
|
34
|
+
System.assertEquals(0, result.authProviders.size(), 'authProviders should be empty without community context');
|
|
35
|
+
System.assertEquals(0, result.samlProviders.size(), 'samlProviders should be empty without community context');
|
|
36
|
+
System.assertEquals(null, result.autoRedirectUrl, 'autoRedirectUrl should be null without providers');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Test that the endpoint handles a missing startURL parameter gracefully
|
|
41
|
+
* (defaults to "/").
|
|
42
|
+
*/
|
|
43
|
+
@isTest
|
|
44
|
+
static void testGetConfigNoStartUrl() {
|
|
45
|
+
RestRequest req = new RestRequest();
|
|
46
|
+
req.requestURI = '/services/apexrest/auth/social-login-config';
|
|
47
|
+
req.httpMethod = 'GET';
|
|
48
|
+
// Intentionally not setting startURL param
|
|
49
|
+
RestContext.request = req;
|
|
50
|
+
RestContext.response = new RestResponse();
|
|
51
|
+
|
|
52
|
+
Test.startTest();
|
|
53
|
+
UIBundleSocialLoginConfig.SocialLoginConfigResponse result =
|
|
54
|
+
UIBundleSocialLoginConfig.getConfig();
|
|
55
|
+
Test.stopTest();
|
|
56
|
+
|
|
57
|
+
System.assertNotEquals(null, result, 'Response should not be null even without startURL');
|
|
58
|
+
System.assertNotEquals(null, result.authProviders, 'authProviders should not be null');
|
|
59
|
+
System.assertNotEquals(null, result.samlProviders, 'samlProviders should not be null');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Test the inner class constructors for code coverage.
|
|
64
|
+
*/
|
|
65
|
+
@isTest
|
|
66
|
+
static void testInnerClassConstructors() {
|
|
67
|
+
Test.startTest();
|
|
68
|
+
|
|
69
|
+
UIBundleSocialLoginConfig.AuthProviderInfo authInfo =
|
|
70
|
+
new UIBundleSocialLoginConfig.AuthProviderInfo(
|
|
71
|
+
'TestProvider', 'Test Provider', 'https://example.com/icon.png', 'https://example.com/sso'
|
|
72
|
+
);
|
|
73
|
+
System.assertEquals('TestProvider', authInfo.developerName);
|
|
74
|
+
System.assertEquals('Test Provider', authInfo.friendlyName);
|
|
75
|
+
System.assertEquals('https://example.com/icon.png', authInfo.iconUrl);
|
|
76
|
+
System.assertEquals('https://example.com/sso', authInfo.ssoUrl);
|
|
77
|
+
|
|
78
|
+
UIBundleSocialLoginConfig.SamlProviderInfo samlInfo =
|
|
79
|
+
new UIBundleSocialLoginConfig.SamlProviderInfo(
|
|
80
|
+
'001000000000001', 'Test SAML', 'https://example.com/saml/sso'
|
|
81
|
+
);
|
|
82
|
+
System.assertEquals('001000000000001', samlInfo.id);
|
|
83
|
+
System.assertEquals('Test SAML', samlInfo.masterLabel);
|
|
84
|
+
System.assertEquals('https://example.com/saml/sso', samlInfo.ssoUrl);
|
|
85
|
+
|
|
86
|
+
List<UIBundleSocialLoginConfig.AuthProviderInfo> authList =
|
|
87
|
+
new List<UIBundleSocialLoginConfig.AuthProviderInfo>{ authInfo };
|
|
88
|
+
List<UIBundleSocialLoginConfig.SamlProviderInfo> samlList =
|
|
89
|
+
new List<UIBundleSocialLoginConfig.SamlProviderInfo>{ samlInfo };
|
|
90
|
+
|
|
91
|
+
UIBundleSocialLoginConfig.SocialLoginConfigResponse resp =
|
|
92
|
+
new UIBundleSocialLoginConfig.SocialLoginConfigResponse(
|
|
93
|
+
authList, samlList, 'https://example.com/redirect'
|
|
94
|
+
);
|
|
95
|
+
System.assertEquals(1, resp.authProviders.size());
|
|
96
|
+
System.assertEquals(1, resp.samlProviders.size());
|
|
97
|
+
System.assertEquals('https://example.com/redirect', resp.autoRedirectUrl);
|
|
98
|
+
|
|
99
|
+
Test.stopTest();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ---- Open-redirect sanitization (CWE-601) -------------------------------
|
|
103
|
+
// resolveStartUrl() is the boundary where the endpoint sanitizes the
|
|
104
|
+
// caller-supplied startURL before it is embedded in the SSO redirect URL.
|
|
105
|
+
// These tests assert malicious values never survive that boundary and that
|
|
106
|
+
// legitimate relative paths do.
|
|
107
|
+
|
|
108
|
+
@isTest
|
|
109
|
+
static void resolveStartUrlRejectsAbsoluteUrl() {
|
|
110
|
+
assertNotReflected('https://evil-attacker.com');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@isTest
|
|
114
|
+
static void resolveStartUrlRejectsProtocolRelativeUrl() {
|
|
115
|
+
assertNotReflected('//evil-attacker.com');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@isTest
|
|
119
|
+
static void resolveStartUrlRejectsBackslashVariant() {
|
|
120
|
+
assertNotReflected('/\\evil-attacker.com');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@isTest
|
|
124
|
+
static void resolveStartUrlRejectsEncodedBypass() {
|
|
125
|
+
assertNotReflected('%2f%2fevil-attacker.com');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@isTest
|
|
129
|
+
static void resolveStartUrlAllowsRelativePath() {
|
|
130
|
+
setRequest('/dashboard');
|
|
131
|
+
String resolved = UIBundleSocialLoginConfig.resolveStartUrl();
|
|
132
|
+
System.assertNotEquals(null, resolved, 'A valid relative path should resolve to a non-null value');
|
|
133
|
+
System.assert(
|
|
134
|
+
resolved.endsWith('/dashboard'),
|
|
135
|
+
'A valid relative path must be preserved (optionally prefixed): ' + resolved
|
|
136
|
+
);
|
|
137
|
+
System.assert(!resolved.startsWith('http'), 'Result must not be absolute: ' + resolved);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@isTest
|
|
141
|
+
static void getConfigWithMaliciousStartUrlReturnsGracefulEmpty() {
|
|
142
|
+
// End-to-end: a malicious startURL must not crash the endpoint; without
|
|
143
|
+
// a real site context it returns the graceful empty response (unchanged).
|
|
144
|
+
setRequest('https://evil-attacker.com');
|
|
145
|
+
|
|
146
|
+
Test.startTest();
|
|
147
|
+
UIBundleSocialLoginConfig.SocialLoginConfigResponse result =
|
|
148
|
+
UIBundleSocialLoginConfig.getConfig();
|
|
149
|
+
Test.stopTest();
|
|
150
|
+
|
|
151
|
+
System.assertNotEquals(null, result, 'Response should not be null');
|
|
152
|
+
System.assertEquals(0, result.authProviders.size(), 'No providers without site context');
|
|
153
|
+
System.assertEquals(0, result.samlProviders.size(), 'No SAML providers without site context');
|
|
154
|
+
System.assertEquals(null, result.autoRedirectUrl, 'No auto-redirect without providers');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// ---- helpers ------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
/** Asserts a malicious startURL value is not reflected by resolveStartUrl(). */
|
|
160
|
+
private static void assertNotReflected(String maliciousStartUrl) {
|
|
161
|
+
setRequest(maliciousStartUrl);
|
|
162
|
+
String resolved = UIBundleSocialLoginConfig.resolveStartUrl();
|
|
163
|
+
String safe = resolved == null ? '' : resolved;
|
|
164
|
+
System.assert(!safe.contains('evil-attacker'), 'Malicious host must not be reflected: ' + safe);
|
|
165
|
+
System.assert(!safe.startsWith('http'), 'Result must not be an absolute URL: ' + safe);
|
|
166
|
+
System.assert(!safe.startsWith('//'), 'Result must not be protocol-relative: ' + safe);
|
|
167
|
+
System.assert(!safe.contains('\\'), 'Result must not contain a backslash: ' + safe);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Builds a GET RestContext with the given startURL param (null => param omitted). */
|
|
171
|
+
private static void setRequest(String startUrlValue) {
|
|
172
|
+
RestRequest req = new RestRequest();
|
|
173
|
+
req.requestURI = '/services/apexrest/auth/social-login-config';
|
|
174
|
+
req.httpMethod = 'GET';
|
|
175
|
+
if (startUrlValue != null) {
|
|
176
|
+
req.params.put('startURL', startUrlValue);
|
|
177
|
+
}
|
|
178
|
+
RestContext.request = req;
|
|
179
|
+
RestContext.response = new RestResponse();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
|
|
2
|
+
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
package.xml
|
|
6
|
+
|
|
7
|
+
# LWC configuration files
|
|
8
|
+
**/jsconfig.json
|
|
9
|
+
**/.eslintrc.json
|
|
10
|
+
|
|
11
|
+
# LWC Jest
|
|
12
|
+
**/__tests__/**
|
|
13
|
+
|
|
14
|
+
node_modules/
|
|
15
|
+
.DS_Store
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Base Vue App
|
|
2
|
+
|
|
3
|
+
Base Vue App is a template application that demonstrates how to build a Vue UI Bundle on the Salesforce platform with Vite, TypeScript, Tailwind, shadcn-vue, and the Salesforce UI Bundle SDK. It provides a minimal shell (home, 404), routing, and GraphQL codegen support so feature apps can extend it via the patches pipeline.
|
|
4
|
+
|
|
5
|
+
This UI Bundle lives inside an SFDX project. The project root is the directory that contains `force-app/` and `sfdx-project.json`. Run the commands in the sections below from the paths indicated.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
- [Run (development)](#run-development)
|
|
10
|
+
- [Build](#build)
|
|
11
|
+
- [Test](#test)
|
|
12
|
+
|
|
13
|
+
## Run (development)
|
|
14
|
+
|
|
15
|
+
From the UI Bundle directory (`force-app/main/default/uiBundles/base-vue-app`):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
npm run dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This starts the Vite dev server (e.g. http://localhost:5173). Use `npm run dev:design` to run in design mode.
|
|
23
|
+
|
|
24
|
+
## Build
|
|
25
|
+
|
|
26
|
+
From the UI Bundle directory:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The production build is written to `dist/` inside the UI Bundle folder.
|
|
34
|
+
|
|
35
|
+
## Test
|
|
36
|
+
|
|
37
|
+
From the UI Bundle directory:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm run test # unit tests (Vitest)
|
|
41
|
+
npm run build:e2e # build for end-to-end
|
|
42
|
+
npx playwright test # end-to-end tests (Playwright)
|
|
43
|
+
```
|