2017-10-18 20 views

Répondre

0

Oui, c'est possible.

Vous devez vous assurer de définir correctement le schéma d'authentification dans ConfigureServices.

services.AddAuthentication() 
     .AddCookie("MyCookieAuthenticationScheme", options => { 

     }) 
     .AddAnotherHandler("AnotherName", options => { }); 

Ensuite, pour chaque contrôleur/action, vous devrez spécifier les régimes éligibles

Exemple:

[Authorize(AuthenticationSchemes = "Scheme1")] 
public IActionResult Test1() { } 


[Authorize(AuthenticationSchemes = "Scheme2")] 
public IActionResult Test2() { } 


[Authorize(AuthenticationSchemes = "Scheme1,Scheme2")] 
public IActionResult Test3() { } 

Vous pouvez également créer votre propre gestionnaire d'authentification si nécessaire.

Bonne chance, Seb