本文整理汇总了C#中IOAuthContext类的典型用法代码示例。如果您正苦于以下问题:C# IOAuthContext类的具体用法?C# IOAuthContext怎么用?C# IOAuthContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOAuthContext类属于命名空间,在下文中一共展示了IOAuthContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertContextDoesNotIncludeToken
void AssertContextDoesNotIncludeToken(IOAuthContext context)
{
if (context.Token != null)
{
throw Error.RequestForTokenMustNotIncludeTokenInContext(context);
}
}
示例2: ConsumerRequest
public ConsumerRequest(IOAuthSession oauthSession, IOAuthContext context, IOAuthConsumerContext consumerContext, ICertificateFactory clientSslCertificateFactory)
{
_oauthSession = oauthSession;
_context = context;
_consumerContext = consumerContext;
_clientSslCertificateFactory = clientSslCertificateFactory;
}
示例3: InspectRequest
protected virtual void InspectRequest(IOAuthContext context)
{
foreach (IContextInspector inspector in _inspectors)
{
inspector.InspectContext(context);
}
}
示例4: SignContextWithToken
public void SignContextWithToken(IOAuthContext context, IToken token)
{
context.Token = token.Token;
context.TokenSecret = token.TokenSecret;
SignContext(context);
}
示例5: InspectContext
public void InspectContext(ProviderPhase phase, IOAuthContext context)
{
if (phase != ProviderPhase.CreateAccessToken) {
return;
}
var authMode = context.XAuthMode;
if (string.IsNullOrEmpty(authMode)) {
throw Error.EmptyXAuthMode(context);
}
if (!_validateModeFunc(authMode)) {
throw Error.InvalidXAuthMode(context);
}
var username = context.XAuthUsername;
if (string.IsNullOrEmpty(username)) {
throw Error.EmptyXAuthUsername(context);
}
var password = context.XAuthPassword;
if (string.IsNullOrEmpty(password)) {
throw Error.EmptyXAuthPassword(context);
}
if (!_authenticateFunc(username, password)) {
throw Error.FailedXAuthAuthentication(context);
}
}
示例6: InspectContext
public void InspectContext(ProviderPhase phase, IOAuthContext context)
{
if (!_nonceStore.RecordNonceAndCheckIsUnique(context, context.Nonce))
{
throw Error.NonceHasAlreadyBeenUsed(context);
}
}
示例7: CreateConsumerRequest
public IConsumerRequest CreateConsumerRequest(IOAuthContext context, IOAuthConsumerContext consumerContext, IToken token)
{
if (context == null) throw new ArgumentNullException("context");
if (consumerContext == null) throw new ArgumentNullException("consumerContext");
return new ConsumerRequest(context, consumerContext, token);
}
示例8: GetStatusOfRequestForAccess
public RequestForAccessStatus GetStatusOfRequestForAccess(IOAuthContext requestContext)
{
if (requestContext.ConsumerKey == "key" && requestContext.Token == "requestkey")
return RequestForAccessStatus.Granted;
return RequestForAccessStatus.Unknown;
}
示例9: ValidateCallbackUrlIsPartOfRequest
static void ValidateCallbackUrlIsPartOfRequest(IOAuthContext context)
{
if (string.IsNullOrEmpty(context.CallbackUrl))
{
throw Error.MissingRequiredOAuthParameter(context, Parameters.OAuth_Callback);
}
}
示例10: InspectContext
public void InspectContext(IOAuthContext context)
{
if (!_consumerStore.IsConsumer(context))
{
throw Error.UnknownConsumerKey(context);
}
}
示例11: ConsumerRequest
public ConsumerRequest(IOAuthContext context, IOAuthConsumerContext consumerContext, IToken token, ICertificateFactory clientSslCertificateFactory)
{
_context = context;
_consumerContext = consumerContext;
_token = token;
_clientSslCertificateFactory = clientSslCertificateFactory;
}
示例12: AuthenticateClient
public bool AuthenticateClient(IOAuthContext context)
{
Client actual = ClientRepo.FindClient(context.Client.ClientId);
if (actual == null) return false;
return actual.ClientSecret == context.Client.ClientSecret;
}
示例13: OAuthException
public OAuthException(IConsumerResponse consumerResponse, IOAuthContext requestContext, OAuthProblemReport problemReport)
: base(problemReport.ProblemAdvice)
{
ConsumerResponse = consumerResponse;
Report = problemReport;
Context = requestContext;
}
示例14: ConsumerRequest
public ConsumerRequest(IOAuthContext context, IOAuthConsumerContext consumerContext, IToken token)
{
if (context == null) throw new ArgumentNullException("context");
if (consumerContext == null) throw new ArgumentNullException("consumerContext");
_context = context;
_consumerContext = consumerContext;
_token = token;
}
示例15: ConsumeRequestToken
public void ConsumeRequestToken(IOAuthContext requestContext)
{
EnsureTestConsumer(requestContext);
if (requestContext.Token != "requestkey")
throw new OAuthException(requestContext, OAuthProblems.TokenRejected,
"The supplied request token is unknown to the provider.");
}