http://www.wiktorzychla.com/2012/09/forms-authentication-revisited.htmlのコードを使用して、既存のAsp.Net 3.5 Webサイトと連合認証を統合しようとしました。問題はfam.IsSignInResponse(request)がSTS(AD FS)からの有効な応答を取得した後でもfalseを返しています。 GetClaims()は、別のクラスライブラリにあるので、わずかに変更されています。同じコードが別のテストアプリケーションで動作しています。私はそれが間違っているのか分からない、助けてください。 下記のコードをご覧ください。STSの応答WSFederationAuthenticationModule IsSignInResponseは常に偽です
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;
}