[英]Is it possible to login from a winforms application to a website which uses spring security?
I want to call a web service from my winforms application. 我想从Winforms应用程序中调用Web服务。 My application is written on c# and the webservice is secured using spring security. 我的应用程序是用c#编写的,并且使用spring安全性来保护Web服务。
Is it possible to login to the website and call that web service?. 是否可以登录网站并调用该Web服务?
If it is possible how to do that? 如果有可能怎么做?
Authentication can be setup in many ways with Spring Security. 可以使用Spring Security以多种方式设置身份验证。 For example: 例如:
<http pattern="/webservice/**" create-session="stateless" realm="TestRealm">
<http-basic/>
<intercept-url pattern="/**" access="ROLE_USER"/>
</http>
Then it is as simple as this to authenticate from C#: 然后,从C#进行身份验证就这么简单:
var request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = new NetworkCredential(username, pwd);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.