J'ai essayé d'intégrer l'authentification fédérée avec mon site Web Asp.Net 3.5 existant en utilisant le code de http://www.wiktorzychla.com/2012/09/forms-authentication-revisited.html. Le problème est fam.IsSignInResponse (request) donne false même après avoir reçu une réponse valide du STS (AD FS). GetClaims() est légèrement modifié, car il se trouve dans une bibliothèque de classes distincte. Le même code fonctionne dans une autre application de test. Je ne sais pas où ça va mal, aidez-moi s'il vous plaît. S'il vous plaît voir le code ci-dessous.Réponse STS WSFederationAuthenticationModule IsSignInResponse est toujours false
public List<ClaimEntity> GetClaims()
{
logger.Info("Started executing GetClaims()");
List<ClaimEntity> claims = new List<ClaimEntity>();
// sam is configured in web.config
var sam = FederatedAuthentication.SessionAuthenticationModule;
logger.Info("Declaring sam");
// fam is not
var fam = new WSFederationAuthenticationModule();
logger.Info("Declaring fam");
//fam.FederationConfiguration = FederatedAuthentication.FederationConfiguration;
fam.ServiceConfiguration = FederatedAuthentication.ServiceConfiguration;
logger.Info("Assigning ServiceConfiguration to fam");
var request = thisContext.Request;
// is this the response from the STS
if (!fam.IsSignInResponse(request))
{
// no
logger.Info("fam.IsSignInResponse => No");
// the STS
fam.Issuer = _IssuerSTSSpec.Issuer;
logger.Info("IssuerUrl= " + _IssuerSTSSpec.Issuer);
// the return address
fam.Realm = thisContext.Request.Url.AbsoluteUri;
logger.Info("Assigning fam.Realm= " + thisContext.Request.Url.AbsoluteUri);
logger.Info("Creating SignInRequest...");
var req = fam.CreateSignInRequest(string.Empty, null, false);
logger.Info("Redirecting to the issuer...");
logger.Info("Request to STS: "+ req.WriteQueryString().ToString());
// go to STS
thisContext.Response.Redirect(req.WriteQueryString());
}
else
{
// yes
-----------
-----------
}
logger.Info("Returning the claims");
return claims;
}