Log In User - myMLA SSO
Learn how to guide users to login into the myMLA SSO platform.
On each page, if the user is not authenticated, you should display a link similar the one shown below.
<a asp-controller="Account" asp-action="Login">Login</a>
This should have the corresponding end point shown below.
public class AccountController
: Controller
{
public async Task Login(string returnUrl = "/")
{
var authenticationProperties = new LoginAuthenticationPropertiesBuilder()
.WithRedirectUri(returnUrl)
.Build();
await HttpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme,
authenticationProperties);
}
}
The end point has a variable named returnUrl
. This allows users to return to the page they were trying to access when authentication was required. This returnUrl
should be stored as part of the authentication properties.
The above controller end point will redirect the user to a page with the form shown below. The users use this form to be authenticated.
There is also a link at the bottom of the form for users to create a myMLA SSO account if they do not already have one.
On successful authentication, the user will be redirected back to your site.