本文整理汇总了C#中IConsumer类的典型用法代码示例。如果您正苦于以下问题:C# IConsumer类的具体用法?C# IConsumer怎么用?C# IConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConsumer类属于命名空间,在下文中一共展示了IConsumer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetTokenAsync
public async Task<IToken> GetTokenAsync(IConsumer consumer, IUser user)
{
if (!HasStore)
return await GetTokenAsync(consumer);
var token = Store.Find(user.Name);
if (token == null)
{
token = await GetTokenAsync(consumer);
token.UserId = user.Name;
Store.Add(token);
return token;
}
if (!token.HasExpired)
return token;
var newToken = await RenewTokenAsync(token, consumer);
newToken.UserId = user.Name;
Store.Delete(token);
Store.Add(newToken);
return newToken;
}
开发者ID:yadyn,项目名称:Xero-Net,代码行数:28,代码来源:TokenStoreAuthenticator.cs
示例2: OAuthRequestToken
public OAuthRequestToken(
string token,
string secret,
IConsumer consumer,
TokenStatus status,
OAuthParameters associatedParameters,
IIdentity authenticatedUser,
string[] roles)
: this()
{
if (string.IsNullOrEmpty(token))
throw new ArgumentException("token must not be null or empty", "token");
if (secret == null)
throw new ArgumentNullException("secret", "secret must not be null");
if (consumer == null)
throw new ArgumentNullException("consumer", "consumer must not be null");
if (roles == null)
throw new ArgumentNullException("roles", "roles must not be null");
this.Token = token;
this.Secret = secret;
this.Status = status;
this.ConsumerKey = consumer.Key;
this.AssociatedParameters = associatedParameters;
this.AuthenticatedUser = authenticatedUser;
this.Roles = roles;
}
开发者ID:rpmcpp,项目名称:oauth-dot-net,代码行数:30,代码来源:OAuthRequestToken.cs
示例3: BuildFailure
private static ConsumedMessage.ConsumingResult BuildFailure(IConsumer consumer,
ConsumedMessageBase message,
Exception exception)
{
consumer.OnError(exception);
return new ConsumedMessage.Failure(message, consumer, exception);
}
开发者ID:pichierri,项目名称:Carrot,代码行数:7,代码来源:ConsumerExtensions.cs
示例4: OAuthToken
/// <summary>
/// Create a simple token received from a service provider.
/// </summary>
/// <param name="type">Token type</param>
/// <param name="token">Token</param>
/// <param name="secret">Secret</param>
/// <param name="consumer">Consumer</param>
public OAuthToken(TokenType type, string token, string secret, IConsumer consumer)
{
this.Type = type;
this.Token = token;
this.Secret = secret;
this.ConsumerKey = consumer.Key;
}
开发者ID:rpmcpp,项目名称:oauth-dot-net,代码行数:14,代码来源:OAuthToken.cs
示例5: OAuthAccessToken
public OAuthAccessToken(
string token,
string secret,
IConsumer consumer,
TokenStatus status,
IRequestToken requestToken)
: this()
{
if (string.IsNullOrEmpty(token))
throw new ArgumentException("token must not be null or empty", "token");
if (secret == null)
throw new ArgumentNullException("secret", "secret must not be null");
if (consumer == null)
throw new ArgumentNullException("consumer", "consumer must not be null");
if (requestToken == null)
throw new ArgumentNullException("requestToken", "requestToken must not be null");
this.Token = token;
this.Secret = secret;
this.Status = status;
this.ConsumerKey = consumer.Key;
this.RequestToken = requestToken;
}
开发者ID:rpmcpp,项目名称:oauth-dot-net,代码行数:26,代码来源:OAuthAccessToken.cs
示例6: GetToken
public IToken GetToken(IConsumer consumer, IUser user)
{
IToken token;
if (HasStore)
{
IToken sessionToken = Store.Find(user.Name);
if (sessionToken == null || sessionToken.HasExpired)
{
sessionToken = GetToken(consumer);
sessionToken.UserId = user.Name;
Store.Add(sessionToken);
}
token = sessionToken;
}
else
{
token = GetToken(consumer);
}
return token;
}
开发者ID:david-buzz,项目名称:Xero-Net,代码行数:25,代码来源:TokenStoreAuthenticator.cs
示例7: GetToken
public IToken GetToken(IConsumer consumer, IUser user)
{
if (!HasStore)
return GetToken(consumer);
var token = Store.Find(user.Name);
if (token == null)
{
token = GetToken(consumer);
token.UserId = user.Name;
Store.Add(token);
return token;
}
if (!token.HasExpired)
return token;
var newToken = RenewToken(token, consumer);
newToken.UserId = user.Name;
Store.Delete(token);
Store.Add(newToken);
return newToken;
}
开发者ID:philals,项目名称:Xero-Net,代码行数:28,代码来源:TokenStoreAuthenticator.cs
示例8: PublicMvcAuthenticator
public PublicMvcAuthenticator(string baseUri, string tokenUri, string callBackUrl,
ITokenStore store, IConsumer consumer, ITokenStore requestTokenStore)
: base(baseUri, tokenUri, callBackUrl, store)
{
_consumer = consumer;
_requestTokenStore = requestTokenStore;
}
开发者ID:johnnyoshika,项目名称:Xero-Net,代码行数:7,代码来源:PublicMvcAuthenticator.cs
示例9: can_run_consumer
public void can_run_consumer()
{
var lst = ServiceLocator.Current.GetAllInstances<IConsumer>();
_consumer = lst.Find(
s => s.GetType() == typeof (Subscriber<OrderChangeRequestReceivedMessage>));
((Subscriber<OrderChangeRequestReceivedMessage>)_consumer).Consume(buildMsg());
}
开发者ID:agglerithm,项目名称:EDIDocsProcessing,代码行数:7,代码来源:BusinessPartnerResolverTester.cs
示例10: SampleService
public SampleService(IConsumer messageCommandConsumer, IPublisher publisher, TopologyBootstrapper topologyBootstrapper)
{
_messageCommandConsumer = messageCommandConsumer;
_publisher = publisher;
_topologyBootstrapper = topologyBootstrapper;
_stopped = false;
}
开发者ID:RagtimeWilly,项目名称:WhiteRabbit,代码行数:7,代码来源:SampleService.cs
示例11: GetRedirectUri
public string GetRedirectUri(IConsumer consumer)
{
var redirectUri = RedirectUri;
if (redirectUri != null)
{
var consumerDomain = consumer.Domain.ToLowerInvariant();
var match = Regexs.HTTPUrl.Match(redirectUri);
if (!match.Success)
throw new OAuthException(ErrorCode.InvalidRequest, "The redirect_uri parameter must be an absolute uri");
var domain = match.Groups["domain"].Value.ToLowerInvariant();
var subdomain = match.Groups["subdomain"].Value.ToLowerInvariant();
string redirectDomain;
if (domain.Count(x => x == '.') == 1)
redirectDomain = subdomain + domain;
else
redirectDomain = domain.Trim(new[] { '.' });
if (redirectDomain != consumerDomain)
throw new OAuthException(ErrorCode.InvalidRequest, "The redirect_uri is not authorized");
}
else
redirectUri = consumer.RedirectUrl;
return redirectUri;
}
开发者ID:naasir,项目名称:OAuth2Provider,代码行数:27,代码来源:AuthorizationRequest.cs
示例12: Subscribe
public override bool Subscribe(IConsumer consumer, Hashtable parameterMap)
#endif
{
bool success = base.Subscribe(consumer, parameterMap);
if (success)
FireConsumerConnectionEvent(consumer, PipeConnectionEvent.CONSUMER_CONNECT_PULL, parameterMap);
return success;
}
开发者ID:Boreeas,项目名称:LoLNotes,代码行数:8,代码来源:InMemoryPullPullPipe.cs
示例13: RemoveConsumerFromQueue
protected override void RemoveConsumerFromQueue(IConsumer consumer)
{
var s = Dispatcher.GetSubscriber(consumer.Id);
if(s == null)
throw new Exception("Subscriber with Id=" + consumer.Id + " not found");
s.StopConsuming();
}
开发者ID:sportingsolutions,项目名称:SS.Integration.UnifiedDataAPIClient.DotNet,代码行数:8,代码来源:MockedStreamController.cs
示例14: StreamSubscriber
public StreamSubscriber(IModel model, IConsumer consumer, IDispatcher dispatcher)
: base(model)
{
Consumer = consumer;
ConsumerTag = consumer.Id;
Dispatcher = dispatcher;
_isDisposed = false;
}
开发者ID:sportingsolutions,项目名称:SS.Integration.UnifiedDataAPIClient.DotNet,代码行数:8,代码来源:StreamSubscriber.cs
示例15: PartnerMvcAuthenticator
public PartnerMvcAuthenticator(string baseUri, string authorizeUri, string callBackUri,
ITokenStore store, string signingCertificatePath, string certificatePath, string entrustPassword,
IConsumer consumer, ITokenStore requestTokenStore, string signingCertPassword)
: this(baseUri, authorizeUri, callBackUri, store, consumer, requestTokenStore)
{
_signingCertificate = new X509Certificate2(signingCertificatePath, signingCertPassword, X509KeyStorageFlags.MachineKeySet);
_certificate = new X509Certificate2(certificatePath, entrustPassword);
}
开发者ID:yadyn,项目名称:Xero-Net,代码行数:8,代码来源:PartnerMvcAuthenticator.cs
示例16: PartnerMvcAuthenticator
public PartnerMvcAuthenticator(string baseUri, string authorizeUri, string callBackUri,
ITokenStore store, string signingCertificatePath, string certificatePath, string password,
IConsumer consumer, ITokenStore requestTokenStore)
: this(baseUri, authorizeUri, callBackUri, store, consumer, requestTokenStore)
{
_signingCertificate = new X509Certificate2(signingCertificatePath);
_certificate = new X509Certificate2(certificatePath, password);
}
开发者ID:narvamallesh,项目名称:Xero-Net,代码行数:8,代码来源:PartnerMvcAuthenticator.cs
示例17: CreateAccessToken
/// <summary>
/// Create a new access token
/// </summary>
/// <param name="consumer">The consumer for whom the token is to be created</param>
/// <param name="requestToken">The request token being swapped for this access token</param>
/// <returns>An access token</returns>
public virtual IAccessToken CreateAccessToken(IConsumer consumer, IRequestToken requestToken)
{
return new OAuthAccessToken(
GuidHelper.CreateGuid().ToString("D"),
GuidHelper.CreateGuid().ToString("D"),
consumer,
TokenStatus.Unauthorized,
requestToken);
}
开发者ID:rpmcpp,项目名称:oauth-dot-net,代码行数:15,代码来源:GuidTokenGenerator.cs
示例18: RecordNonceAndCheckIsUnique
public bool RecordNonceAndCheckIsUnique(IConsumer consumer, string nonce)
{
List<string> list = GetNonceListForConsumer(consumer.ConsumerKey);
lock (list)
{
if (list.Contains(nonce)) return false;
list.Add(nonce);
return true;
}
}
开发者ID:patrickleet,项目名称:oauth-mvc.net,代码行数:10,代码来源:TestNonceStore.cs
示例19: Subscribe
public override bool Subscribe(IConsumer consumer, Hashtable parameterMap)
#endif
{
if (!(consumer is IPushableConsumer))
throw new FluorineException("Non-pushable consumer not supported by PushPushPipe");
bool success = base.Subscribe(consumer, parameterMap);
if (success)
FireConsumerConnectionEvent(consumer, PipeConnectionEvent.CONSUMER_CONNECT_PUSH, parameterMap);
return success;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:10,代码来源:InMemoryPushPushPipe.cs
示例20: CreateRequestToken
/// <summary>
/// Create a new request token
/// </summary>
/// <param name="consumer">The consumer for whom the token is to be created</param>
/// <param name="parameters">The parameters that were sent in the request that
/// created this token (both OAuth and additional parameters).</param>
/// <returns>A request token</returns>
public virtual IRequestToken CreateRequestToken(IConsumer consumer, OAuthParameters parameters)
{
return new OAuthRequestToken(
GuidHelper.CreateGuid().ToString("D"),
GuidHelper.CreateGuid().ToString("D"),
consumer,
TokenStatus.Unauthorized,
parameters,
null,
new string[] { });
}
开发者ID:rpmcpp,项目名称:oauth-dot-net,代码行数:18,代码来源:GuidTokenGenerator.cs
注:本文中的IConsumer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论