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 2 posts 22 karma points
    Sep 16, 2020 @ 05:06
    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!

  • AnandBhopale 53 posts 171 karma points
    May 18, 2021 @ 08:18
    AnandBhopale
    0

    Hi Kris,

    I am also having similar requirement and stuck in integrating two providers (front end and back-end) in single project.

    Have you successfully completed the integration ? any code sample do you have ?

  • Rob Nicolson 1 post 71 karma points
    19 days ago
    Rob Nicolson
    0

    Hi,

    I have just hit this having followed the 24days guide and implemented AADB2C, but keeping with Umb Cloud for back-office authentication. I'm finding they don't play well together either.

    Did you all get anywhere with this that you would be willing to kindly share?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft