请你看看这个问题:
您可以测试Yahoo sreg “https://test-id.org/OP/Sreg.aspx”
ID:“https://me.yahoo.com/” 用户名:goughev@yahoo.com 密码:偏执狂
现在问题
此代码适用于Google,但不适用于Yahoo sreg, 因为response.GetUntrustedExtension()alwase为Yahoo
的属性返回空值 var opUrl = LoginCore.GetProviderUrl(provider, openId);
var openIdRelyingParty = new OpenIdRelyingParty(null);
var response = openIdRelyingParty.GetResponse();
Identifier id;
if (response == null)
{
if (Identifier.TryParse(opUrl, out id))
{
try
{
var claim = new ClaimsRequest();
claim.Email = DemandLevel.Require;
claim.FullName = DemandLevel.Request;
claim.Gender = DemandLevel.Request;
claim.Nickname = DemandLevel.Require;
var request = openIdRelyingParty.CreateRequest(opUrl);
request.AddExtension(claim);
return request.RedirectingResponse.AsActionResult();
}
catch (Exception ex)
{
}
}
else
{
Model.Errors.Add(GeneralErrors.Unexpected());
return View("SignupUnTrustedOpenId");
}
}
else
{
switch (response.Status)
{
case AuthenticationStatus.Authenticated:
var claimsData = response.GetUntrustedExtension<ClaimsResponse>();
if (claimsData != null)
{
email = claimsData.Email;
我正在使用以下配置:
<dotNetOpenAuth>
<openid>
<relyingParty>
<security requireSsl="false" ignoreUnsignedExtensions="false" maximumHashBitLength="256" minimumHashBitLength="160" rejectDelegatingIdentifiers="true" rejectUnsolicitedAssertions="false" requireAssociation="false" requireDirectedIdentity="false" />
<behaviors>
<add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
</behaviors>
</relyingParty>
</openid>
<messaging>
<untrustedWebRequest>
<whitelistHosts>
<add name="localhost" />
</whitelistHosts>
</untrustedWebRequest>
</messaging>
</dotNetOpenAuth>
我使用的是最新版本3.2.0.9177
非常感谢您的帮助
维塔利彼得
答案 0 :(得分:0)
雅虎的SREG扩展支持目前仅处于测试阶段。雅虎只愿意将SREG支持暴露给列入白名单的RP。 See here.
我使用我自己的雅虎帐户进行了test-id.org测试,但它确实有效。您添加sreg扩展名的代码看起来很好。所以我怀疑唯一的问题是你还没有使用雅虎的白名单。