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


C# INonceStore类代码示例

本文整理汇总了C#中INonceStore的典型用法代码示例。如果您正苦于以下问题:C# INonceStore类的具体用法?C# INonceStore怎么用?C# INonceStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: OAuthChannel

		/// <summary>
		/// Initializes a new instance of the <see cref="OAuthChannel"/> class.
		/// </summary>
		/// <param name="signingBindingElement">The binding element to use for signing.</param>
		/// <param name="store">The web application store to use for nonces.</param>
		/// <param name="tokenManager">The token manager instance to use.</param>
		internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IServiceProviderTokenManager tokenManager)
			: this(
			signingBindingElement,
			store,
			tokenManager,
			new OAuthServiceProviderMessageFactory(tokenManager)) {
		}
开发者ID:jsmale,项目名称:dotnetopenid,代码行数:13,代码来源:OAuthChannel.cs

示例2: OAuthChannel

        /// <summary>
        /// Initializes a new instance of the <see cref="OAuthChannel"/> class.
        /// </summary>
        /// <param name="signingBindingElement">The binding element to use for signing.</param>
        /// <param name="store">The web application store to use for nonces.</param>
        /// <param name="tokenManager">The token manager instance to use.</param>
        /// <param name="isConsumer">A value indicating whether this channel is being constructed for a Consumer (as opposed to a Service Provider).</param>
        internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, bool isConsumer)
            : this(signingBindingElement,
			store,
			tokenManager,
			isConsumer ? (IMessageFactory)new OAuthConsumerMessageFactory() : new OAuthServiceProviderMessageFactory(tokenManager))
        {
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:14,代码来源:OAuthChannel.cs

示例3: RecordFeatureAndDependencyUse

		/// <summary>
		/// Records the feature and dependency use.
		/// </summary>
		/// <param name="value">The consumer or service provider.</param>
		/// <param name="service">The service.</param>
		/// <param name="tokenManager">The token manager.</param>
		/// <param name="nonceStore">The nonce store.</param>
		internal static void RecordFeatureAndDependencyUse(object value, ServiceProviderHostDescription service, ITokenManager tokenManager, INonceStore nonceStore) {
			Requires.NotNull(value, "value");
			Requires.NotNull(service, "service");
			Requires.NotNull(tokenManager, "tokenManager");

			// In release builds, just quietly return.
			if (value == null || service == null || tokenManager == null) {
				return;
			}

			if (Reporting.Enabled && Reporting.Configuration.IncludeFeatureUsage) {
				StringBuilder builder = new StringBuilder();
				builder.Append(value.GetType().Name);
				builder.Append(" ");
				builder.Append(tokenManager.GetType().Name);
				if (nonceStore != null) {
					builder.Append(" ");
					builder.Append(nonceStore.GetType().Name);
				}
				builder.Append(" ");
				builder.Append(service.UserAuthorizationEndpoint != null ? service.UserAuthorizationEndpoint.Location.AbsoluteUri : string.Empty);
				Reporting.ObservedFeatures.Add(builder.ToString());
				Reporting.Touch();
			}
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:32,代码来源:OAuthReporting.cs

示例4: StandardReplayProtectionBindingElement

        /// <summary>
        /// Initializes a new instance of the <see cref="StandardReplayProtectionBindingElement"/> class.
        /// </summary>
        /// <param name="nonceStore">The store where nonces will be persisted and checked.</param>
        /// <param name="allowEmptyNonces">A value indicating whether zero-length nonces will be allowed.</param>
        internal StandardReplayProtectionBindingElement(INonceStore nonceStore, bool allowEmptyNonces)
        {
            ErrorUtilities.VerifyArgumentNotNull(nonceStore, "nonceStore");

            this.nonceStore = nonceStore;
            this.AllowZeroLengthNonce = allowEmptyNonces;
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:12,代码来源:StandardReplayProtectionBindingElement.cs

示例5: Serialize

		/// <summary>
		/// Serializes this <see cref="Token"/> instance as a string that can be
		/// included as part of a return_to variable in a querystring. 
		/// This string is cryptographically signed to protect against tampering.
		/// </summary>
		public string Serialize(INonceStore store) {
			using (MemoryStream dataStream = new MemoryStream()) {
				if (!persistSignature(store)) {
					Debug.Assert(!persistNonce(Endpoint, store), "Without a signature, a nonce is meaningless.");
					dataStream.WriteByte(0); // there will be NO signature.
					StreamWriter writer = new StreamWriter(dataStream);
					Endpoint.Serialize(writer);
					writer.Flush();
					return Convert.ToBase64String(dataStream.ToArray());
				} else {
					using (HashAlgorithm shaHash = createHashAlgorithm(store))
					using (CryptoStream shaStream = new CryptoStream(dataStream, shaHash, CryptoStreamMode.Write)) {
						StreamWriter writer = new StreamWriter(shaStream);
						Endpoint.Serialize(writer);
						if (persistNonce(Endpoint, store))
							writer.WriteLine(Nonce.Code);
						
						writer.Flush();
						shaStream.Flush();
						shaStream.FlushFinalBlock();

						byte[] hash = shaHash.Hash;
						byte[] data = new byte[1 + hash.Length + dataStream.Length];
						data[0] = 1; // there is a signature
						Buffer.BlockCopy(hash, 0, data, 1, hash.Length);
						Buffer.BlockCopy(dataStream.ToArray(), 0, data, 1 + hash.Length, (int)dataStream.Length);

						return Convert.ToBase64String(data);
					}
				}
			}
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:37,代码来源:Token.cs

示例6: AuthorizationServerHost

 public AuthorizationServerHost(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, IClientRepository clientRepository, IUserRepository userRepository)
 {
     _cryptoKeyStore = cryptoKeyStore;
     _nonceStore = nonceStore;
     _clientRepository = clientRepository;
     _userRepository = userRepository;
 }
开发者ID:ptsurko,项目名称:basicoauth2server,代码行数:7,代码来源:AuthorizationServerHost.cs

示例7: RecordFeatureAndDependencyUse

		/// <summary>
		/// Records the feature and dependency use.
		/// </summary>
		/// <param name="value">The consumer or service provider.</param>
		/// <param name="service">The service.</param>
		/// <param name="tokenManager">The token manager.</param>
		/// <param name="nonceStore">The nonce store.</param>
		internal static void RecordFeatureAndDependencyUse(object value, ServiceProviderDescription service, ITokenManager tokenManager, INonceStore nonceStore) {
			Contract.Requires(value != null);
			Contract.Requires(service != null);
			Contract.Requires(tokenManager != null);

			// In release builds, just quietly return.
			if (value == null || service == null || tokenManager == null) {
				return;
			}

			if (Reporting.Enabled && Reporting.Configuration.IncludeFeatureUsage) {
				StringBuilder builder = new StringBuilder();
				builder.Append(value.GetType().Name);
				builder.Append(" ");
				builder.Append(tokenManager.GetType().Name);
				if (nonceStore != null) {
					builder.Append(" ");
					builder.Append(nonceStore.GetType().Name);
				}
				builder.Append(" ");
				builder.Append(service.Version);
				builder.Append(" ");
				builder.Append(service.UserAuthorizationEndpoint);
				Reporting.ObservedFeatures.Add(builder.ToString());
				Reporting.Touch();
			}
		}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:34,代码来源:OAuthReporting.cs

示例8: ReturnToNonceBindingElement

		/// <summary>
		/// Initializes a new instance of the <see cref="ReturnToNonceBindingElement"/> class.
		/// </summary>
		/// <param name="nonceStore">The nonce store to use.</param>
		/// <param name="securitySettings">The security settings of the RP.</param>
		internal ReturnToNonceBindingElement(INonceStore nonceStore, RelyingPartySecuritySettings securitySettings) {
			Contract.Requires<ArgumentNullException>(nonceStore != null);
			Contract.Requires<ArgumentNullException>(securitySettings != null);

			this.nonceStore = nonceStore;
			this.securitySettings = securitySettings;
		}
开发者ID:enslam,项目名称:dotnetopenid,代码行数:12,代码来源:ReturnToNonceBindingElement.cs

示例9: ReturnToNonceBindingElement

		/// <summary>
		/// Initializes a new instance of the <see cref="ReturnToNonceBindingElement"/> class.
		/// </summary>
		/// <param name="nonceStore">The nonce store to use.</param>
		/// <param name="securitySettings">The security settings of the RP.</param>
		internal ReturnToNonceBindingElement(INonceStore nonceStore, RelyingPartySecuritySettings securitySettings) {
			Requires.NotNull(nonceStore, "nonceStore");
			Requires.NotNull(securitySettings, "securitySettings");

			this.nonceStore = nonceStore;
			this.securitySettings = securitySettings;
		}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:12,代码来源:ReturnToNonceBindingElement.cs

示例10: WsseRequestInterceptor

 /// <summary>
 /// Initializes a new instance of the <see cref="WsseRequestInterceptor"/> class.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="realm">The realm.</param>
 /// <param name="timestampRangevalidator">The timestamp rangevalidator.</param>
 /// <param name="nonceStore">The nonce store.</param>
 public WsseRequestInterceptor(IPasswordProvider provider, string realm, ITimestampRangeValidator timestampRangevalidator, INonceStore nonceStore)
     : base(false)
 {
     TimestampRangeValidator = timestampRangevalidator;
     NonceStore = nonceStore;
     Provider = provider;
     Realm = realm;
 }
开发者ID:javicrespo,项目名称:WcfRestAuth,代码行数:15,代码来源:WsseRequestInterceptor.cs

示例11: OAuthChannel

        /// <summary>
        /// Initializes a new instance of the <see cref="OAuthChannel"/> class.
        /// </summary>
        /// <param name="signingBindingElement">The binding element to use for signing.</param>
        /// <param name="store">The web application store to use for nonces.</param>
        /// <param name="tokenManager">The ITokenManager instance to use.</param>
        /// <param name="messageTypeProvider">
        /// An injected message type provider instance.
        /// Except for mock testing, this should always be one of
        /// <see cref="OAuthConsumerMessageFactory"/> or <see cref="OAuthServiceProviderMessageFactory"/>.
        /// </param>
        internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, IMessageFactory messageTypeProvider)
            : base(messageTypeProvider, InitializeBindingElements(signingBindingElement, store, tokenManager))
        {
            ErrorUtilities.VerifyArgumentNotNull(tokenManager, "tokenManager");

            this.TokenManager = tokenManager;
            ErrorUtilities.VerifyArgumentNamed(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel);

            signingBindingElement.SignatureCallback = this.SignatureCallback;
        }
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:21,代码来源:OAuthChannel.cs

示例12: OAuthChannel

		protected OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings, IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements)
			: base(messageTypeProvider, bindingElements) {
			Requires.NotNull(tokenManager, "tokenManager");
			Requires.NotNull(securitySettings, "securitySettings");
			Requires.NotNull(signingBindingElement, "signingBindingElement");
			Requires.True(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel);
			Requires.NotNull(bindingElements, "bindingElements");

			this.TokenManager = tokenManager;
			signingBindingElement.SignatureCallback = this.SignatureCallback;
		}
开发者ID:rafek,项目名称:dotnetopenid,代码行数:11,代码来源:OAuthChannel.cs

示例13: OAuthConsumerChannel

		internal OAuthConsumerChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IConsumerTokenManager tokenManager, ConsumerSecuritySettings securitySettings, IMessageFactory messageFactory = null)
			: base(
			signingBindingElement,
			tokenManager,
			securitySettings,
			messageFactory ?? new OAuthConsumerMessageFactory(),
			InitializeBindingElements(signingBindingElement, store)) {
			Requires.NotNull(tokenManager, "tokenManager");
			Requires.NotNull(securitySettings, "securitySettings");
			Requires.NotNull(signingBindingElement, "signingBindingElement");
		}
开发者ID:brivas,项目名称:DotNetOpenAuth,代码行数:11,代码来源:OAuthConsumerChannel.cs

示例14: InitializeBindingElements

		/// <summary>
		/// Initializes the binding elements for the OAuth channel.
		/// </summary>
		/// <param name="signingBindingElement">The signing binding element.</param>
		/// <param name="store">The nonce store.</param>
		/// <param name="tokenManager">The token manager.</param>
		/// <param name="securitySettings">The security settings.</param>
		/// <returns>
		/// An array of binding elements used to initialize the channel.
		/// </returns>
		private static IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
			Requires.NotNull(securitySettings, "securitySettings");

			var bindingElements = OAuthChannel.InitializeBindingElements(signingBindingElement, store);

			var spTokenManager = tokenManager as IServiceProviderTokenManager;
			var serviceProviderSecuritySettings = securitySettings as ServiceProviderSecuritySettings;
			bindingElements.Insert(0, new TokenHandlingBindingElement(spTokenManager, serviceProviderSecuritySettings));

			return bindingElements.ToArray();
		}
开发者ID:substrate9,项目名称:DotNetOpenAuth,代码行数:21,代码来源:OAuthServiceProviderChannel.cs

示例15: ArgumentNullException

        IIdSiteSyncCallbackHandler IIdSiteSyncCallbackHandler.SetNonceStore(INonceStore nonceStore)
        {
            if (nonceStore == null)
            {
                throw new ArgumentNullException(nameof(nonceStore));
            }

            this.nonceStore = nonceStore;

            return this;
        }
开发者ID:ssankar1234,项目名称:stormpath-sdk-dotnet,代码行数:11,代码来源:DefaultIdSiteSyncCallbackHandler.cs


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