本文整理汇总了C#中System.ServiceModel.Channels.RequestContext类的典型用法代码示例。如果您正苦于以下问题:C# RequestContext类的具体用法?C# RequestContext怎么用?C# RequestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestContext类属于System.ServiceModel.Channels命名空间,在下文中一共展示了RequestContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HttpMessageEncodingRequestContext
public HttpMessageEncodingRequestContext(RequestContext innerContext)
{
Debug.Assert(innerContext != null, "The 'innerContext' parameter should not be null.");
this.innerContext = innerContext;
this.isRequestConfigured = false;
this.requestConfigurationLock = new object();
}
示例2: ProcessRequest
public override void ProcessRequest(ref RequestContext requestContext)
{
if (!manager.AuthenticateRequest(requestContext.RequestMessage)) {
requestContext.Reply(manager.CreateInvalidAuthenticationRequest());
requestContext = null;
}
}
示例3: SecurityRequestContext
public SecurityRequestContext (SecurityReplyChannel channel, RequestContext source)
{
this.source = source;
this.channel = channel;
security = channel.Source.SecuritySupport;
}
示例4: IsValidUserKey
public bool IsValidUserKey(RequestContext requestContext)
{
if (requestContext != null && requestContext.RequestMessage != null)
{
var prop = (HttpRequestMessageProperty)requestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name];
var cookie = prop.Headers[HttpRequestHeader.Cookie];
if (string.IsNullOrEmpty(cookie)) return false;
var coockieName = CookiesManager.GetCookiesName();
foreach (string s in cookie.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
if (s.IndexOf('=') == -1) continue;
var key = s.Substring(0, s.IndexOf('=')).Trim();
if (key.Equals(coockieName, StringComparison.Ordinal))
{
try
{
var value = s.Substring(s.IndexOf('=') + 1).Trim();
if (SecurityContext.IsAuthenticated || SecurityContext.AuthenticateMe(value))
{
return true;
}
}
catch { }
break;
}
}
}
return false;
}
示例5: ProcessRequest
public override void ProcessRequest(ref RequestContext requestContext)
{
if (!IsValidUserKey(requestContext))
{
GenerateErrorResponse(ref requestContext, HttpStatusCode.Unauthorized, "Unauthorized");
}
}
示例6: MessageProcessingContext
public MessageProcessingContext (OperationContext opCtx)
{
operation_context = opCtx;
request_context = opCtx.RequestContext;
incoming_message = opCtx.IncomingMessage;
user_events_handler = new UserEventsHandler (this);
}
示例7: ProcessRequest
public override void ProcessRequest(ref RequestContext requestContext)
{
if (requestContext == null || requestContext.RequestMessage == null)
{
return;
}
Message request = requestContext.RequestMessage;
var requestProperty = (HttpRequestMessageProperty) request.Properties[HttpRequestMessageProperty.Name];
IOAuthContext context = new OAuthContextBuilder().FromUri(requestProperty.Method, request.Headers.To);
try
{
_provider.AccessProtectedResourceRequest(context);
AccessToken accessToken = _repository.GetToken(context.Token);
TokenPrincipal principal = CreatePrincipalFromToken(accessToken);
InitializeSecurityContext(request, principal);
}
catch (OAuthException authEx)
{
XElement response = GetHtmlFormattedErrorReport(authEx);
Message reply = Message.CreateMessage(MessageVersion.None, null, response);
var responseProperty = new HttpResponseMessageProperty {StatusCode = HttpStatusCode.Forbidden, StatusDescription = authEx.Report.ToString()};
responseProperty.Headers[HttpResponseHeader.ContentType] = "text/html";
reply.Properties[HttpResponseMessageProperty.Name] = responseProperty;
requestContext.Reply(reply);
requestContext = null;
}
}
示例8: ProcessRequest
public override void ProcessRequest(ref RequestContext requestContext)
{
if (requestContext == null || !authenticationManager.AuthenticateRequest(requestContext.RequestMessage))
{
requestContext = CreateAndSendInvalidAuthenticationRequest(requestContext);
}
}
示例9: NotifyInvokeReceived
public void NotifyInvokeReceived(RequestContext request)
{
using (ServiceModelActivity.BoundOperation(this.activity))
{
ChannelHandler.Register(this.handler, request);
}
this.DidInvokerEnsurePump = true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:MessageRpcInvokeNotification.cs
示例10: MessageProcessingContext
public MessageProcessingContext (OperationContext opCtx, IChannel replyOrInput)
{
operation_context = opCtx;
request_context = opCtx.RequestContext;
incoming_message = opCtx.IncomingMessage;
user_events_handler = new UserEventsHandler (this);
reply_or_input = replyOrInput;
}
示例11: CreateAndSendInvalidAuthenticationRequest
private RequestContext CreateAndSendInvalidAuthenticationRequest(RequestContext requestContext)
{
using (Message responseMessage = authenticationManager.CreateInvalidAuthenticationRequest(requestContext.RequestMessage))
{
requestContext.Reply(responseMessage);
requestContext = null;
return requestContext;
}
}
示例12: HttpCookieSessionRequestContext
public HttpCookieSessionRequestContext(
RequestContext innerRequestContext,
string sessionId,
bool isInitial)
{
this.sessionId = sessionId;
this.innerRequestContext = innerRequestContext;
this.isInitial = isInitial;
}
示例13: EndTryReceiveRequest
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context)
{
_innerChannel.EndTryReceiveRequest(result, out context);
var timeout = ((IDefaultCommunicationTimeouts)this.Manager).ReceiveTimeout;
context = ProcessContext(context, timeout);
return context != null;
}
示例14: SelfHostHttpRequestContext
public SelfHostHttpRequestContext(RequestContext requestContext, HttpConfiguration configuration,
HttpRequestMessage request)
{
Contract.Assert(requestContext != null);
Contract.Assert(configuration != null);
Contract.Assert(request != null);
_requestContext = requestContext;
_configuration = configuration;
_request = request;
}
示例15: EndTryReceiveRequest
public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context)
{
Task<RequestContext> task = (Task<RequestContext>) result;
task.Wait();
context = task.Result;
return context != null;
}