Using custom authentication handler #217
-
Hello! I got it working with OpenIddict. It just used default AuthenticationHandler for Authenticate and Challenge. But I can't do it with IdentityServer. I reassigned DefaultScheme to my own, but it tries to SignIn for some reason. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found solution. I just used my handler as external. public class AccountController : Controller
{
[HttpGet]
public async Task<IActionResult> Login(string returnUrl)
{
var result = await HttpContext.AuthenticateAsync("MyScheme");
if (!result.Succeeded)
{
return Challenge("MyScheme");
}
var identityServerUser = new IdentityServerUser(result.Principal.FindFirstValue(ClaimTypes.NameIdentifier)!)
{
IdentityProvider = "LegacyProvider"
};
await HttpContext.SignInAsync(identityServerUser);
return Redirect(returnUrl);
}
} |
Beta Was this translation helpful? Give feedback.
I found solution. I just used my handler as external.