Ejemplo n.º 1
0
        protected void identifierBox_LoggedIn(object sender, OpenIdEventArgs e)
        {
            State.FetchResponse = e.Response.GetExtension <FetchResponse>();

            ServiceProviderDescription serviceDescription = new ServiceProviderDescription {
                AccessTokenEndpoint      = new MessageReceivingEndpoint(new Uri(e.Response.Provider.Uri, "/access_token.ashx"), HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest),
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
            };
            var consumer = new WebConsumerOpenIdRelyingParty(serviceDescription, Global.OwnSampleOPHybridTokenManager);

            AuthorizedTokenResponse accessToken = consumer.ProcessUserAuthorization(e.Response);

            if (accessToken != null)
            {
                this.MultiView1.SetActiveView(this.AuthorizationGiven);

                // At this point, the access token would be somehow associated with the user
                // account at the RP.
                ////Database.Associate(e.Response.ClaimedIdentifier, accessToken.AccessToken);
            }
            else
            {
                this.MultiView1.SetActiveView(this.AuthorizationDenied);
            }

            // Avoid the redirect
            e.Cancel = true;
        }
Ejemplo n.º 2
0
        private static WebConsumerOpenIdRelyingParty CreateConsumer()
        {
            var consumer = new WebConsumerOpenIdRelyingParty();

            consumer.ConsumerKey    = new Uri(HttpContext.Current.Request.Url, HttpContext.Current.Request.ApplicationPath).AbsoluteUri;
            consumer.ConsumerSecret = "some crazy secret";
            return(consumer);
        }
Ejemplo n.º 3
0
        protected void identifierBox_LoggingIn(object sender, OpenIdEventArgs e)
        {
            ServiceProviderDescription serviceDescription = new ServiceProviderDescription {
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
            };

            var consumer = new WebConsumerOpenIdRelyingParty(serviceDescription, Global.OwnSampleOPHybridTokenManager);

            consumer.AttachAuthorizationRequest(e.Request, "http://tempuri.org/IDataApi/GetName");
        }