Copied to clipboard

Flag this post as spam?

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


  • bjarke pedersen 3 posts 73 karma points
    Sep 10, 2021 @ 10:14
    bjarke pedersen
    0

    Autolink - create backenduser not working in Umbraco9 RC3

    I am trying to get external login with identityserver4 to work. It almost works, however it does not auto create or link when a external user is loggin in. If i create a user in umbraco iam able to link the user manually.

    I have the following configured - but I must be missing something

    .AddBackOfficeExternalLogins(builder =>
                        builder.AddBackOfficeLogin(
                            build =>
    
                               build.AddOpenIdConnect(
                                       build.SchemeForBackOffice(OpenIdConnectDefaults.AuthenticationScheme),
                                       "External login",
                                       options =>
                                       {
                                           // use cookies
                                           options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                                           // pass configured options along
                                           // Use the authorization code flow
                                           options.AuthenticationMethod = OpenIdConnectRedirectBehavior.RedirectGet;
    
                                           options.RequireHttpsMetadata = false;
                                           options.Authority = "https://localhost:3930";
                                           options.MetadataAddress = "https://localhost:3930/.well-known/openid-configuration";
                                           options.ClientSecret = "**";
                                           options.ClientId = "***";
                                           options.GetClaimsFromUserInfoEndpoint = true;
                                           options.ResponseType = "code id_token";
                                           options.CallbackPath = new PathString("/");
                                           options.RemoteSignOutPath = "/oidc-signout";
                                           options.SignedOutRedirectUri = "**";
    
                                           options.Scope.Clear();
                                           options.Scope.Add("openid");
                                           options.Scope.Add("profile");
                                           options.Scope.Add("email");
                                           options.SaveTokens = true;
                                           options.UsePkce = true;
    
                                           options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                                           {
                                               NameClaimType = "name",
                                               RoleClaimType = "role",
    
                                           };
    
                                       }
                                   ),
                           options =>
                                   new BackOfficeExternalLoginProviderOptions(
    
                                       "btn-primary", // button stype
                                       "fa-windows", // icon
                                        new ExternalSignInAutoLinkOptions(autoLinkExternalAccount: true, defaultUserGroups: new[] { Constants.Security.EditorGroupAlias }, defaultCulture: "en-US", allowManualLinking: true)
                                        {
                                            OnAutoLinking = (user, loginInfo) =>
                                            {
                                                //
                                            },
                                            OnExternalLogin = (user, loginInfo) =>
                                            {
                                                return true;
    
                                            }
                                        }, 
    
                                       true, // deny local login
                                       false, // autoredirect local login to external login
                                       null) // custom backoffice view
                           )
                       )
    
  • bjarke pedersen 3 posts 73 karma points
    Sep 17, 2021 @ 06:53
    bjarke pedersen
    0

    fuck it. I just implemented it myself

  • ChuDatCN 12 posts 62 karma points
    Aug 16, 2022 @ 02:32
    ChuDatCN
    0

    Hi bjarke pedersen, I'm having the same problem auto linking Backoffice account with IS4. Can you teach me how to solve it . Thank you

Please Sign in or register to post replies

Write your reply to:

Draft