2009-03-08 6 views
0

私は私のOpenIDのソリューションのためのDotnetopenidを使用しています内蔵のユーザーコントロールを使用した場合、すべてが正常であるが、私はprogrammaticalyそれを実装したい場合、下記のコードのように、DotNetOpenIDプログラムによるログイン

openid.Response.GetExtension<DotNetOpenId.Extensions.SimpleRegistration.ClaimsResponse>(); 

が常にありますヌル。

OpenIdRelyingParty openid = createRelyingParty(); 
    if (openid.Response != null) { 
     switch (openid.Response.Status) { 
      case AuthenticationStatus.Authenticated: 
       // This is where you would look for any OpenID extension responses included 
       // in the authentication assertion. 
       // var extension = openid.Response.GetExtension<SomeExtensionResponseType>(); 

       // Use FormsAuthentication to tell ASP.NET that the user is now logged in, 
       // with the OpenID Claimed Identifier as their username. 
       State.ProfileFields = openid.Response.GetExtension<DotNetOpenId.Extensions.SimpleRegistration.ClaimsResponse>(); 
       FormsAuthentication.RedirectFromLoginPage(openid.Response.ClaimedIdentifier, false); 
       break; 

答えて

3

私はプロバイダにリダイレクトする前に私の要求に拡張子を追加するために見逃しているAndrew

からの助けを得ます。これを行う (このステップは、サンプルファイルで符号化されていない)

は、リクエストオブジェクトを作成した後、このように行う:

Dim request As IAuthenticationRequest = openid.CreateRequest(openid_identifier.Text) 
     ' This is where you would add any OpenID extensions you wanted 
     ' to include in the authentication request. 
     ' request.AddExtension(someExtensionRequestInstance); 
     Dim myclaim As New ClaimsRequest 

     With myclaim 
      .BirthDate = DemandLevel.Request 
      .Country = DemandLevel.Request 
      .Email = DemandLevel.Request 
      .FullName = DemandLevel.Request 
      .Gender = DemandLevel.Request 
      .Language = DemandLevel.Request 
      .Nickname = DemandLevel.Request 
      .PostalCode = DemandLevel.Request 
      .TimeZone = DemandLevel.Request 

     End With 


     request.AddExtension(myclaim) 









     ' Send your visitor to their Provider for authentication. 
     request.RedirectToProvider() 

コードvb.netに

+0

MVCでDotNetOpenIdを実装する手順をいくつか説明してください。私はMVCとOpenIdの初心者です。 – Picflight

+0

@Picflightここで確認できますhttp://stackoverflow.com/questions/933884/request-for-tutorial-to-add-openid-support-to-nerddinner-asp-net-mvc-application – mohamadreza

0

で固定されるように留意し、次のリリースでより明確になりました。

関連する問題