Copied to clipboard

Flag this post as spam?

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


  • Virginia Rochester 5 posts 95 karma points
    Nov 03, 2022 @ 15:22
    Virginia Rochester
    0

    Authorising Umbraco front-end using Open Id Connect with an external provider (OneLogin)

    We are trying to create an Umbraco site where the users will be asked to log in before they can view the content. Our identity provider is OneLogin, and we have built a vanilla .NET Core MVC sample site where authentication works fine. However, we put the same code in the Startup.cs class of our Umbraco solution and navigate to a method on a surface controller which has the [Authorize] attribute, and we find although we can login, we get 'stuck' at the callback stage as in the image belowenter image description here

    The code we have put in the Startup.cs class, ConfigureServices method is: enter image description here

    I've tried going through the information at https://www.scottbrady91.com/umbraco/frontend-members-sso-openid-connect which I got working but we didn't want to use the Members part of Umbraco, we just want to be able to authorise with our OneLogin identity provider. Can anyone help with this?

    We are using Umbraco 9.4.3

  • Virginia Rochester 5 posts 95 karma points
    Nov 04, 2022 @ 14:38
    Virginia Rochester
    100

    For anyone else trying to get this working I figured it out; I needed to be more explicit about the default authentication scheme. This was how I configured the Startup.cs class, and now I can put the [Authorize] attribute on my restricted surface controller methods, and the user is taken to OneLogin to log in if they are not already signed in. Don't forget the app.UseAuthentication(); line in the Configure method too. Here is how I configured the Startup.cs class, ConfigureServices method: enter image description here

  • yashasvi 27 posts 105 karma points
    Aug 23, 2023 @ 08:30
    yashasvi
    0

    Hi Virginia, Thank you for sharing above code. It's really helpful. can you please let me know one more thing. that how can we navigate to "Login" page when user is not authorize.

    How you call that surface controller from startup/Program page.

    Thanks in advance.

Please Sign in or register to post replies

Write your reply to:

Draft