Copied to clipboard

Flag this post as spam?

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


  • kris-guy 1 post 21 karma points
    1 week ago
    kris-guy
    0

    Azure Active Directory for backoffice + Azure Active Directory B2C for members

    Hey folks, looking for some guidance on how to get AAD for backoffice and AADB2C for members running.

    Thanks to the excellent posts from Shannon: https://shazwazza.com/post/configuring-azure-active-directory-login-with-umbraco/

    and Davy: https://24days.in/umbraco-cms/2019/aad-and-headless/umbraco8-aadb2c/

    I have been able to use AAD for backoffice and AADB2C for members, but only separately - not both together.

    Cobbling the 2 together i was surprised when it compiled and booted and not so surprised when the signins failed (example stacktrace excerpt below) after the auth completes and user is redirected back to the site.

        System.InvalidOperationException: Sequence contains more than one element   
      at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)   
      at Microsoft.Owin.Security.AuthenticationManager.<AuthenticateAsync>d__20.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---   
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   
      at Umbraco.Web.Security.AuthenticationManagerExtensions.<GetExternalLoginInfoAsync>d__2.MoveNext() 
      in d:\\a\\1\\s\\src\\Umbraco.Web\\Security\\AuthenticationManagerExtensions.cs:line 83
      --- End of stack trace from previous location where exception was thrown ---   
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   
      at Umbraco.Web.Editors.BackOfficeController.<RenderDefaultOrProcessExternalLoginAsync>d__24.MoveNext() 
      in d:\\a\\1\\s\\src\\Umbraco.Web\\Editors\\BackOfficeController.cs:line 363
    

    I'm pretty weak in OWIN knowledge, but assume that the issue relates to adding 2 authentication configurations into the middleware that have conflicting scope.

    Anyone have an example of getting these 2 to work together, or how to separate the responsibility for backoffice and members in the middleware? (if that is the issue here)

    Thanks in advance!

Please Sign in or register to post replies

Write your reply to:

Draft