Web服务会话管理Web

由网友(夢的方向叫做闖i)分享简介:我使用将使用的Andr​​oid应用程序的WCF REST Web服务。这些都是像只登录用户可以按下电话的安全服务,从而获取此创建,当用户登录,并返回该用户的会话。现在的问题是,此令牌如何被传递到服务,Web服务可以验证用户会话? I am using wcf Restful web services that wi...

我使用将使用的Andr​​oid应用程序的WCF REST Web服务。这些都是像只登录用户可以按下电话的安全服务,从而获取此创建,当用户登录,并返回该用户的会话。现在的问题是,此令牌如何被传递到服务,Web服务可以验证用户会话?

I am using wcf Restful web services that will be used by android application. These are secure services like only login user can hit the calls, so to acquire this I create a session when a user login and return this to user. Now problem is that how this token is passed to services so web services can verify the user session?

推荐答案

我找到了答案,当用户获取会话令牌将其存储在客户端,并在接下来的请求,用户将它的请求头,这将是提取和验证发送在服务器

I found the answer, when User get the session token it store on client side and in next request user will send it in request Header which will be extract and verified at server

 HttpRequestMessageProperty messageProperty =
                    (HttpRequestMessageProperty)
                    OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name];
token = messageProperty.Headers[TokenName];

在完成所需的请求之前,如果会话验证的请求将全部完成。

before completing required request and if session authenticated request will be completed.

阅读全文

相关推荐

最新文章