Copied to clipboard

Flag this post as spam?

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


  • Tony Cheetham 24 posts 134 karma points
    Nov 12, 2015 @ 17:09
    Tony Cheetham
    0

    OpenID-Connect error

    When trying to auto-link an account from an OpenID server to a built-in backend user Umbraco is throwing this error:

    WARN  Umbraco.Web.Editors.BackOfficeController - Could not find external authentication provider registered: https://localhost:44333/identity
    

    I'm not sure how it is even getting this provider or what it is matching against. This is my OWIN startup code:

            public void AutoLinkUp(BackOfficeIdentityUser curUser, ExternalLoginInfo loginDeets)
        {
            curUser.AccessFailedCount = 0;
        }
    
        public override void Configuration(IAppBuilder app)
        {
            //ensure the default options are configured
            base.Configuration(app);
    
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie
            });
    
            var adOptions = new OpenIdConnectAuthenticationOptions
            { 
                Authority = "https://localhost:44333/identity",
                ClientId = "FYCU",
                RedirectUri = "https://localhost:44302",
                ResponseType = "id_token",
                Scope = "openid profile roles email",
                Caption = "Login now with CUID",
    
                SignInAsAuthenticationType = Umbraco.Core.Constants.Security.BackOfficeExternalAuthenticationType
            };
    
            adOptions.SetExternalSignInAutoLinkOptions(new ExternalSignInAutoLinkOptions(true, "CreditUnion")
            {
                OnAutoLinking = AutoLinkUp
            });
    
            adOptions.ForUmbracoBackOffice("btn-microsoft", "fa-windows");
            app.UseOpenIdConnectAuthentication(adOptions);      
        }
    
  • Tony Cheetham 24 posts 134 karma points
    Nov 13, 2015 @ 15:24
    Tony Cheetham
    100

    Actually hunted this down... In the source of Umbraco.Web.Editors.BackOfficeController this happens

    var authType = OwinContext.Authentication.GetExternalAuthenticationTypes().FirstOrDefault(x => x.AuthenticationType == loginInfo.Login.LoginProvider);

    Alas, the LoginProvider is not the Authentication type, it is the "Authority" as set in your "OpenIdConnectAuthenticationOptions", for example:

                var adOptions = new OpenIdConnectAuthenticationOptions
                {
                    Authority = "https://localhost:44333/identity",
                    SignInAsAuthenticationType = Umbraco.Core.Constants.Security.BackOfficeExternalAuthenticationType
                };

    Auth type can be set in your OWIN, but this seems like a dirty hack to get it working....

    adOptions.AuthenticationType = "https://localhost:44333/identity";
  • blackhawk 313 posts 1368 karma points
    Apr 25, 2017 @ 15:48
    blackhawk
    0

    Tony, Sorry for invading the post, but would you happen to have any recommendations on how to integrate OpenID Connect into Umbraco (just a basic guideline to go by). Something I can read up on.

    Thanks

  • Tony Cheetham 24 posts 134 karma points
    Apr 25, 2017 @ 15:56
    Tony Cheetham
    0

    Hi BlackHawk, Happy to help if I can...I know there's been some work in the latest version of Umbraco on making it work a little better, but I could share up my code. Do you have your own openID server?

  • blackhawk 313 posts 1368 karma points
    Apr 25, 2017 @ 23:31
    blackhawk
    0

    yes. what would be some of your initial recommendations.

Please Sign in or register to post replies

Write your reply to:

Draft