0

私はopenidソリューションにDotnetopenidを使用しています。組み込みのユーザーコントロールを使用する場合はすべて問題ありませんが、以下のコードのようにプログラムで実装する場合は、

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

常にnullです。何か案が?

    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;
4

2 に答える 2

3

アンドリューから助けを得る

プロバイダーにリダイレクトする前に、リクエストに拡張機能を追加できませんでした。(このステップはサンプルファイルにコード化されていません)

これを行うには、リクエストオブジェクトを作成した後、次のようにします。

  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にあります

于 2009-03-08T18:13:08.330 に答える
0

次のリリースで修正され、より明確になることに注意してください。

于 2009-03-09T22:16:13.353 に答える