Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marco Graziotti 29 posts 144 karma points c-trib
    16 days ago
    Marco Graziotti
    0

    Identity Server 4 and backoffice external login in Umbraco 9

    Hi,

    I'm trying to retrieve some information about the possibility to implement Identity Server 4 for the backoffice login in Umbraco 9.

    I saw that in ConfigureServices() it's possible to use AddBackOfficeExternalLogins(). Is there any reference guide to implement a third party backoffice login service? Any suggestions?

    I also found this discussion that seems interesting.

    Thank you, Marco

  • Keith 13 posts 93 karma points
    1 week ago
    Keith
    0

    Hi Marco,

    This is the code I used on that other discussion you linked to. It worked for me using Azure AD B2C, but I would imagine the config is very similar for Identity Server 4.

    Its not fully tested and Im sure someone will post something better, but might be of use to you.

                services.AddUmbraco(_env, _config)
                .AddBackOffice()
                // new code
                .AddBackOfficeExternalLogins(builder =>
                    builder.AddBackOfficeLogin(
                        new BackOfficeExternalLoginProviderOptions(
                            "btn-primary", // button stype
                            "fa-windows", // icon
                            new ExternalSignInAutoLinkOptions(
                                true, // autolink
                                null, // default groups,
                                null, //default culture,
                                true), //allowManualLinking
                            true, // deny local login
                            false, // autoredirect local login to external login
                            null), // custom backoffice view
                        build =>
                            build.AddOpenIdConnect(
                                build.SchemeForBackOffice(OpenIdConnectDefaults.AuthenticationScheme),
                                "AD B2C",
                                options =>
                                {
                                    options.RemoteSignOutPath = "/oidc-signout";
                                    options.MetadataAddress = "path-to-my /.well-known";
                                    options.ClientId = "my-client-id";
                                    options.SignedOutRedirectUri = "https://myumbracosite.com/umbraco";
                                    options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                                    {
                                        NameClaimType = "name"
                                    };
                                }
                            )
                    )
                )
                // end of new code
                .AddWebsite()
                .AddComposers()
                .Build();
    

    "autolink" is what is used to automatically create an umbraco user when someone signs in with your external provider. Without this, you need to create each umbraco user first, ask them to log in and manually perform a link to their external identity.

Please Sign in or register to post replies

Write your reply to:

Draft