ManifestAuthProvider
# help-with-umbraco
b
We have added an external openidconnect provider for the backoffice and it works. We are using a umbraco-package.json file. But we would like to convert it to javascript /manifest files instead. However the ManifestAuthProvider do not have an "allow public access" property so the login box is not shown on the login page. Is this a bug or should it be set up another way?
Json { "name": "Company Auth Package", "allowPublicAccess": true, "extensions": [ { "type": "authProvider", "alias": "Company.AuthProvider.OpenIdConnect", "name": "Company Auth Provider", "forProviderName": "Umbraco.OpenIdConnect", "meta": { "label": "Company login", "defaultView": { }, "linking": { "allowManualLinking": true } } } ] } Manifest import type { ManifestAuthProvider } from '@umbraco-cms/backoffice/extension-registry'; export const manifests: Array = [ { type: 'authProvider', alias: 'Company.AuthProvider.OpenIdConnect', name: 'Company Auth Provider', forProviderName:"Umbraco.OpenIdConnect", meta: { label:"Company login", linking: { allowManualLinking:true } } } ];
j
You still need something in the umbraco-package.json file to load your manifests file, for example an "appEntryPoint". The allowPublicAccess should also stay in your umbraco-package.json file as that tells the system to load up the extensions before the backoffice boots
// umbraco-package.json
Copy code
json
{
    "name": "Login extensions",
    "allowPublicAccess": true,
    "extensions": [
        {
            "type": "appEntryPoint",
            "name": "Login entry point",
            "alias": "my.login.entryPoint",
            "js": "/App_Plugins/MyLogin/MyLogin.js"
        }
    ]
}
// MyLogin.js
Copy code
js
export const onInit = (host, registry) => {
  console.log('public onInit', host);

  registry.register({
    type: 'authProvider',
    name: 'Company Auth Provider',
    alias: 'Company.AuthProvider.OpenIdConnect',
    forProviderName: 'Umbraco.OpenIdConnect',
    meta: {
      label: "Company login",
      defaultView: {
        icon: "icon-cloud"
      }
    }
  })
}
something like that
m
@Jacob Overgaard nice
@Jacob Overgaard we tried putting the manifest closer to the login-provider-code. Using the IComposer and IUmbracoBuilder that I must say is pretty nice to "hook" into the build of umbraco before startup. We did something like this - and the login button appears and works 🙂
Copy code
public class AuthManifestComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.Services.AddSingleton<IPackageManifestReader, AuthManifestReader>();
    }
}

internal class AuthManifestReader : IPackageManifestReader

{
    public Task<IEnumerable<PackageManifest>> ReadPackageManifestsAsync()
    {
        var authExtension = JsonObject.Parse("""
           {
            "name": "Test Auth Provider",
            "alias": "Test.AuthProvider.OpenIdConnect",
            "type": "authProvider",
            "forProviderName":"Umbraco.OpenIdConnect",
            "meta":{
                "label":"Test login",
                "linking": {
                    "allowManualLinking":true
                    }
                }
            }
           """);

        List<PackageManifest> manifest = [
          new PackageManifest
            {
                Name = "test-authpackage",
                AllowTelemetry = true,
                AllowPublicAccess = true,
                Version = "1.1",
                Extensions = [authExtension!]
            }];

            return Task.FromResult(manifest.AsEnumerable());
    }
}
j
Ah yes, setting your own IPackageManifestReader - nice touch. That's an overlooked (or under-documented?) feature for sure 🙂
22 Views