当前位置: 首页>>代码示例>>C#>>正文


C# IAuthenticationRequest.AddExtension方法代码示例

本文整理汇总了C#中IAuthenticationRequest.AddExtension方法的典型用法代码示例。如果您正苦于以下问题:C# IAuthenticationRequest.AddExtension方法的具体用法?C# IAuthenticationRequest.AddExtension怎么用?C# IAuthenticationRequest.AddExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAuthenticationRequest的用法示例。


在下文中一共展示了IAuthenticationRequest.AddExtension方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnBeforeSendingAuthenticationRequest

 protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request)
 {
     FetchRequest extension = new FetchRequest();
     extension.Attributes.AddRequired("http://axschema.org/contact/email");
     extension.Attributes.AddRequired("http://axschema.org/namePerson");
     request.AddExtension(extension);
 }
开发者ID:mikalai-silivonik,项目名称:bnh,代码行数:7,代码来源:Yahoo.cs

示例2: prepareRequest

		private void prepareRequest(IAuthenticationRequest request) {
			// Collect the PAPE policies requested by the user.
			List<string> policies = new List<string>();
			foreach (ListItem item in this.papePolicies.Items) {
				if (item.Selected) {
					policies.Add(item.Value);
				}
			}

			// Add the PAPE extension if any policy was requested.
			var pape = new PolicyRequest();
			if (policies.Count > 0) {
				foreach (string policy in policies) {
					pape.PreferredPolicies.Add(policy);
				}
			}

			if (this.maxAuthTimeBox.Text.Length > 0) {
				pape.MaximumAuthenticationAge = TimeSpan.FromSeconds(double.Parse(this.maxAuthTimeBox.Text));
			}

			if (pape.PreferredPolicies.Count > 0 || pape.MaximumAuthenticationAge.HasValue) {
				request.AddExtension(pape);
			}
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:25,代码来源:login.aspx.cs

示例3: OnBeforeSendingAuthenticationRequest

		/// <summary>
		/// Called just before the authentication request is sent to service provider.
		/// </summary>
		/// <param name="request">
		/// The request. 
		/// </param>
		protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) {
			// Attribute Exchange extensions
			var fetchRequest = new FetchRequest();
			fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, isRequired: true));
			fetchRequest.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.FullName, isRequired: false));

			request.AddExtension(fetchRequest);
		}
开发者ID:vonbv,项目名称:dotnetopenid,代码行数:14,代码来源:YahooOpenIdClient.cs

示例4: OnBeforeSendingAuthenticationRequest

		/// <summary>
		/// Called just before the authentication request is sent to service provider.
		/// </summary>
		/// <param name="request">
		/// The request. 
		/// </param>
		protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request) {
			// Attribute Exchange extensions
			var fetchRequest = new FetchRequest();
			fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
			fetchRequest.Attributes.AddOptional(WellKnownAttributes.Name.FullName);

			request.AddExtension(fetchRequest);
		}
开发者ID:Adilson,项目名称:dotnetopenid,代码行数:14,代码来源:YahooOpenIdClient.cs

示例5: OnBeforeSendingAuthenticationRequest

 protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request)
 {
     var fetchRequest = new FetchRequest();
     fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
     fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
     fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
     request.AddExtension(fetchRequest);
 }
开发者ID:bishops,项目名称:valentines,代码行数:8,代码来源:BishopsOpenID.cs

示例6: AttachAuthorizationRequest

		/// <summary>
		/// Attaches an OAuth authorization request to an outgoing OpenID authentication request.
		/// </summary>
		/// <param name="openIdAuthenticationRequest">The OpenID authentication request.</param>
		/// <param name="scope">The scope of access that is requested of the service provider.</param>
		public void AttachAuthorizationRequest(IAuthenticationRequest openIdAuthenticationRequest, string scope) {
			Requires.NotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest");

			var authorizationRequest = new AuthorizationRequest {
				Consumer = this.ConsumerKey,
				Scope = scope,
			};

			openIdAuthenticationRequest.AddExtension(authorizationRequest);
		}
开发者ID:Adilson,项目名称:dotnetopenid,代码行数:15,代码来源:WebConsumerOpenIdRelyingParty.cs

示例7: AttachAuthorizationRequest

        /// <summary>
        /// Attaches an OAuth authorization request to an outgoing OpenID authentication request.
        /// </summary>
        /// <param name="openIdAuthenticationRequest">The OpenID authentication request.</param>
        /// <param name="scope">The scope of access that is requested of the service provider.</param>
        public void AttachAuthorizationRequest(IAuthenticationRequest openIdAuthenticationRequest, string scope)
        {
            Contract.Requires(openIdAuthenticationRequest != null);
            ErrorUtilities.VerifyArgumentNotNull(openIdAuthenticationRequest, "openIdAuthenticationRequest");

            var authorizationRequest = new AuthorizationRequest {
                Consumer = this.ConsumerKey,
                Scope = scope,
            };

            openIdAuthenticationRequest.AddExtension(authorizationRequest);
        }
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:17,代码来源:WebConsumer.cs

示例8: prepareRequest

        private void prepareRequest(IAuthenticationRequest request)
        {
            // Collect the PAPE policies requested by the user.
            List<string> policies = new List<string>();
            foreach (ListItem item in this.papePolicies.Items) {
                if (item.Selected) {
                    policies.Add(item.Value);
                }
            }

            // Add the PAPE extension if any policy was requested.
            if (policies.Count > 0) {
                var pape = new PolicyRequest();
                foreach (string policy in policies) {
                    pape.PreferredPolicies.Add(policy);
                }

                request.AddExtension(pape);
            }
        }
开发者ID:trayburn,项目名称:Presentation-FiveLibs,代码行数:20,代码来源:login.aspx.cs

示例9: prepareRequest

	private void prepareRequest(IAuthenticationRequest request) {
		// Setup is the default for the login control.  But the user may have checked the box to override that.
		request.Mode = immediateCheckBox.Checked ? AuthenticationRequestMode.Immediate : AuthenticationRequestMode.Setup;

		// Collect the PAPE policies requested by the user.
		List<string> policies = new List<string>();
		foreach (ListItem item in papePolicies.Items) {
			if (item.Selected) {
				policies.Add(item.Value);
			}
		}

		// Add the PAPE extension if any policy was requested.
		if (policies.Count > 0) {
			var pape = new PolicyRequest();
			foreach (string policy in policies) {
				pape.PreferredPolicies.Add(policy);
			}

			request.AddExtension(pape);
		}
	}
开发者ID:Belxjander,项目名称:Asuna,代码行数:22,代码来源:login.aspx.cs

示例10: AddAttributeExchangeExtensions

        private void AddAttributeExchangeExtensions(IAuthenticationRequest auth)
        {
            // Try to use OpenId 2.0's attribute exchange
            var fetch = new FetchRequest();
            //Technically, http://axschema.org/... are "standard", but we'll still find these in the wild
            fetch.Attributes.Add(new AttributeRequest("http://schema.openid.net/namePerson", false));
            fetch.Attributes.Add(new AttributeRequest("http://schema.openid.net/contact/email", false));

            fetch.Attributes.AddRequired("http://axschema.org/contact/country/home");
            fetch.Attributes.AddRequired("http://axschema.org/namePerson/first");
            fetch.Attributes.AddRequired("http://axschema.org/namePerson/last");
            fetch.Attributes.AddRequired("http://axschema.org/pref/language");
            fetch.Attributes.AddRequired("http://schemas.openid.net/ax/api/user_id");

            //Standard compliant AX schema
            fetch.Attributes.Add(new AttributeRequest(WellKnownAttributes.Name.FullName, false));

            //For... no good reason, really, google OpenId requires you "require" an e-mail address to get it
            bool requireEmail = auth.Provider.Uri.AbsoluteUri.Contains(".google.com");
            fetch.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, requireEmail));

            auth.AddExtension(fetch);
        }
开发者ID:robertgreen,项目名称:ServiceStack,代码行数:23,代码来源:OpenIdOAuthProvider.cs

示例11: AddProfileArgs

		/// <summary>
		/// Adds extensions to a given authentication request to ask the Provider
		/// for user profile data.
		/// </summary>
		/// <param name="request">The authentication request to add the extensions to.</param>
		private void AddProfileArgs(IAuthenticationRequest request) {
			Requires.NotNull(request, "request");

			request.AddExtension(new ClaimsRequest() {
				Nickname = this.RequestNickname,
				Email = this.RequestEmail,
				FullName = this.RequestFullName,
				BirthDate = this.RequestBirthDate,
				Gender = this.RequestGender,
				PostalCode = this.RequestPostalCode,
				Country = this.RequestCountry,
				Language = this.RequestLanguage,
				TimeZone = this.RequestTimeZone,
				PolicyUrl = string.IsNullOrEmpty(this.PolicyUrl) ?
					null : new Uri(this.RelyingParty.Channel.GetRequestFromContext().UrlBeforeRewriting, this.Page.ResolveUrl(this.PolicyUrl)),
			});
		}
开发者ID:rafek,项目名称:dotnetopenid,代码行数:22,代码来源:OpenIdMobileTextBox.cs

示例12: AddProfileArgs

		/// <summary>
		/// Adds extensions to a given authentication request to ask the Provider
		/// for user profile data.
		/// </summary>
		/// <param name="request">The authentication request to add the extensions to.</param>
		private void AddProfileArgs(IAuthenticationRequest request) {
			ErrorUtilities.VerifyArgumentNotNull(request, "request");

			var sreg = new ClaimsRequest() {
				Nickname = this.RequestNickname,
				Email = this.RequestEmail,
				FullName = this.RequestFullName,
				BirthDate = this.RequestBirthDate,
				Gender = this.RequestGender,
				PostalCode = this.RequestPostalCode,
				Country = this.RequestCountry,
				Language = this.RequestLanguage,
				TimeZone = this.RequestTimeZone,
				PolicyUrl = string.IsNullOrEmpty(this.PolicyUrl) ?
					null : new Uri(this.RelyingParty.Channel.GetRequestFromContext().UrlBeforeRewriting, this.Page.ResolveUrl(this.PolicyUrl)),
			};

			// Only actually add the extension request if fields are actually being requested.
			if (!sreg.Equals(EmptyClaimsRequest)) {
				request.AddExtension(sreg);
			}
		}
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:27,代码来源:OpenIdTextBox.cs

示例13: addProfileArgs

 void addProfileArgs(IAuthenticationRequest request)
 {
     request.AddExtension(new ClaimsRequest() {
         Nickname = RequestNickname,
         Email = RequestEmail,
         FullName = RequestFullName,
         BirthDate = RequestBirthDate,
         Gender = RequestGender,
         PostalCode = RequestPostalCode,
         Country = RequestCountry,
         Language = RequestLanguage,
         TimeZone = RequestTimeZone,
         PolicyUrl = string.IsNullOrEmpty(PolicyUrl) ?
             null : new Uri(Util.GetRequestUrlFromContext(), Page.ResolveUrl(PolicyUrl)),
     });
 }
开发者ID:tt,项目名称:dotnetopenid,代码行数:16,代码来源:OpenIdMobileTextBox.cs

示例14: AddProfileArgs

		/// <summary>
		/// Adds extensions to a given authentication request to ask the Provider
		/// for user profile data.
		/// </summary>
		/// <param name="request">The authentication request to add the extensions to.</param>
		private void AddProfileArgs(IAuthenticationRequest request) {
			Requires.NotNull(request, "request");

			var sreg = new ClaimsRequest() {
				Nickname = this.RequestNickname,
				Email = this.RequestEmail,
				FullName = this.RequestFullName,
				BirthDate = this.RequestBirthDate,
				Gender = this.RequestGender,
				PostalCode = this.RequestPostalCode,
				Country = this.RequestCountry,
				Language = this.RequestLanguage,
				TimeZone = this.RequestTimeZone,
				PolicyUrl = string.IsNullOrEmpty(this.PolicyUrl) ?
					null : new Uri(new HttpRequestWrapper(this.Context.Request).GetPublicFacingUrl(), this.Page.ResolveUrl(this.PolicyUrl)),
			};

			// Only actually add the extension request if fields are actually being requested.
			if (!sreg.Equals(EmptyClaimsRequest)) {
				request.AddExtension(sreg);
			}
		}
开发者ID:ken8,项目名称:DotNetOpenAuth,代码行数:27,代码来源:OpenIdTextBox.cs


注:本文中的IAuthenticationRequest.AddExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。