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


C# Channels.RequestContext类代码示例

本文整理汇总了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();
 }
开发者ID:AlexZeitler,项目名称:WcfHttpMvcFormsAuth,代码行数:7,代码来源:HttpMessageEncodingRequestContext.cs

示例2: ProcessRequest

 public override void ProcessRequest(ref RequestContext requestContext)
 {
     if (!manager.AuthenticateRequest(requestContext.RequestMessage)) {
         requestContext.Reply(manager.CreateInvalidAuthenticationRequest());
         requestContext = null;
     }
 }
开发者ID:barbarossia,项目名称:DIS,代码行数:7,代码来源:BasicAuthenticationInterceptor.cs

示例3: SecurityRequestContext

		public SecurityRequestContext (SecurityReplyChannel channel, RequestContext source)
		{
			this.source = source;
			this.channel = channel;

			security = channel.Source.SecuritySupport;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:SecurityRequestContext.cs

示例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;
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:31,代码来源:AuthorizationInterceptor.cs

示例5: ProcessRequest

		public override void ProcessRequest(ref RequestContext requestContext)
		{
			if (!IsValidUserKey(requestContext))
			{
				GenerateErrorResponse(ref requestContext, HttpStatusCode.Unauthorized, "Unauthorized");
			}
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:AuthorizationInterceptor.cs

示例6: MessageProcessingContext

		public MessageProcessingContext (OperationContext opCtx)
		{
			operation_context = opCtx;
			request_context = opCtx.RequestContext;
			incoming_message = opCtx.IncomingMessage;
			user_events_handler = new UserEventsHandler (this);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:MessageProcessingContext.cs

示例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;
      }
    }
开发者ID:yonglehou,项目名称:DevDefined.OAuth,代码行数:35,代码来源:OAuthInterceptor.cs

示例8: ProcessRequest

 public override void ProcessRequest(ref RequestContext requestContext)
 {
     if (requestContext == null || !authenticationManager.AuthenticateRequest(requestContext.RequestMessage))
      {
     requestContext = CreateAndSendInvalidAuthenticationRequest(requestContext);
      }
 }
开发者ID:kalkie,项目名称:DigestAuthenticationUsingWCF,代码行数:7,代码来源:DigestAuthenticationInterceptor.cs

示例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;
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:MessageProcessingContext.cs

示例11: CreateAndSendInvalidAuthenticationRequest

 private RequestContext CreateAndSendInvalidAuthenticationRequest(RequestContext requestContext)
 {
     using (Message responseMessage = authenticationManager.CreateInvalidAuthenticationRequest(requestContext.RequestMessage))
      {
     requestContext.Reply(responseMessage);
     requestContext = null;
     return requestContext;
      }
 }
开发者ID:kalkie,项目名称:DigestAuthenticationUsingWCF,代码行数:9,代码来源:DigestAuthenticationInterceptor.cs

示例12: HttpCookieSessionRequestContext

 public HttpCookieSessionRequestContext(
     RequestContext innerRequestContext, 
     string sessionId, 
     bool isInitial)
 {
     this.sessionId = sessionId;
     this.innerRequestContext = innerRequestContext;
     this.isInitial = isInitial;
 }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:9,代码来源:HttpCookieSessionRequestContext.cs

示例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;
        }
开发者ID:yonglehou,项目名称:ProtoBuf.Wcf,代码行数:10,代码来源:ProtoBufMetaDataReplyChannel.cs

示例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;
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:10,代码来源:SelfHostHttpRequestContext.cs

示例15: EndTryReceiveRequest

        public bool EndTryReceiveRequest(IAsyncResult result, out RequestContext context)
        {
            Task<RequestContext> task = (Task<RequestContext>) result;

            task.Wait();

            context = task.Result;

            return context != null;
        }
开发者ID:ronybot,项目名称:MessageBus,代码行数:10,代码来源:ZMQReplyChannel.cs


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