DX Improvement: Auto-generate authProvider manifests from backend external login configuration #21424
Replies: 2 comments 1 reply
-
|
I definitely see the benefit of an improved DX in this case. The majority of the work happens on the server, and the client-side manifests are just annoying to add. I am a bit concerned about the Management API starting to know about “elements,” “api,” etc., which is really only something we use in the Backoffice UI. Would it be possible to do the We currently do the same for Health Checks. Most logic happens server-side, and then we turn it into a manifest client-side. If we want to go down the server generates manifests routes, I think we should start considering it a secondary product rather than the Management Api. Maybe it would be closer to what UI Builder could support 🤔 |
Beta Was this translation helpful? Give feedback.
-
|
The concern specifically for auth providers is mainly that in 90% of cases, you don’t need a custom element. You only need to tell the frontend what is there. It could have been a management API endpoint, honestly. But since you have the added ability to create a custom element, we went with a manifest instead. However, in those 90% of the cases where you don’t need a custom element, it only adds noise that you have to register it manually in a JSON file and have to remember to copy over the same values that you just wrote in C#. If you set up the backend to “skip local login”, you must remember to copy that to the umbraco-package.json file, too If you change the name of the provider on the backend, you must remember to change the “forProviderName” in the umbraco-package.json file, too |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
In V17, external login providers must be registered in two places:
AddBackOfficeExternalLogins()authProviderThis creates developer experience friction and potential for configuration mismatch. In V13 and earlier, only backend registration was needed - the frontend "just worked."
Proposed Solution
Auto-generate
authProviderextension manifests from backend configuration usingIPackageManifestReader.Benefits
Implementation Approach
Phase 1: Auto-Generation with Options Pattern (MVP)
Create
AuthProviderManifestReader : IPackageManifestReaderthat generates manifests from registered authentication schemes.Backend Options Extensions - Extend existing
BackOfficeExternalLoginProviderOptions:Manifest Generation - Implement
IPackageManifestReader:Generated Manifest Example:
{ "type": "authProvider", "alias": "Umbraco.AuthProvider.Google", "name": "Google", "forProviderName": "Google", "meta": { "label": "Sign in with Google", "defaultView": { "icon": "icon-google", "color": "positive", "look": "primary" }, "behavior": { "autoRedirect": false, "popupTarget": "umbracoAuthPopup", "popupFeatures": "width=600,height=600" }, "linking": { "allowManualLinking": true } }, "element": "/App_Plugins/MyCompany/google-login.js", "elementName": "my-company-google-login" }Usage Example:
Backend to Frontend Property Mapping
scheme.DisplayNamemeta.labelAutoRedirectmeta.behavior.autoRedirectAutoLinkOptions.AllowManualLinkingmeta.linking.allowManualLinkingDefaultView.Iconmeta.defaultView.iconDefaultView.Colormeta.defaultView.colorDefaultView.Lookmeta.defaultView.lookPopupBehavior.PopupTargetmeta.behavior.popupTargetPopupBehavior.PopupFeaturesmeta.behavior.popupFeaturesCustomView.ElementelementCustomView.ElementNameelementNameFrontend Type Reference
From
src/Umbraco.Web.UI.Client/src/packages/core/auth/auth-provider.extension.ts:Considerations
1. Opt-Out for Advanced Scenarios
options.AutoRegisterManifest = falseto disable auto-generation2. Custom Views Require Explicit Configuration
element(JS file path) and optionallyelementNameCustomView) uses framework's built-in button UI3. Element Loading
elementproperty references a JavaScript file, not a globally available elementelementpathelementNamespecifies the custom element tag to instantiate (optional if default export)4. Backward Compatibility
authProviderregistrations continue to work5. Default Values
Phase 2: Type Safety (Future Enhancement)
Create strongly-typed C# interfaces instead of
dynamicmanifest objects:Phase 3: Architectural Cleanup (Related Issue)
Consider moving login app into backoffice after cookie-based auth changes:
Related Work
IPackageManifestReaderinfrastructure already existsSuccess Criteria
AuthProviderManifestReader : IPackageManifestReaderBackOfficeExternalLoginProviderOptionswith new propertiesExternalLoginCustomView,ExternalLoginDefaultView,ExternalLoginPopupBehaviorclassesBeta Was this translation helpful? Give feedback.
All reactions