我正在开发WP7 Silverlight中的一个项目。 我的项目包括Clientapplication,用于与业务层通信的WCF服务和EF数据库。
我希望用户提供用户特定的用户名和密码来访问我的应用程序。 我怎样才能做到这一点? 有没有像我们在asp.net中那样使用会员提供商?
如果我可以实现不同的角色也是好的,比如用户是普通用户还是管理员等。
我有什么选择为我的WP7应用程序实现这种解决方案?
I am developing a project in WP7 Silverlight. My project includes a Clientapplication, a WCF-service for communication to my business layer and a EF database.
I want the users to provide a userspecific username and password to access my application. How can i do this? Is there anyway to use Membership provider like we do in asp.net?
It would be good if i could implement different roles aswell, like if the user is a normal user or administrator etcetera.
What are my options to implement this kind of solution for my WP7 Application?
最满意答案
要创建此行为,您需要在应用中创建一个表单,用于捕获用户凭据(用户名和密码),然后通过SSL连接传递它们(您永远不会通过未加密/不安全的连接以纯文本形式发送它们)我敢肯定)在WCF服务中创建一个适当的函数。 然后,您的服务将验证凭据并返回失败消息或成功消息以及用户具有哪个角色的详细信息。
管理角色等是您在后端配置的。
如果您在网站上创建表单并且WCF服务位于不同的域或服务器上,则与执行操作的方式相同。
WP7没有默认的登录控件。 你必须创建自己的,但因为这只是一些文本框,标签和[n appbar]按钮,这不应该导致你太多的工作。
To create this behaviour, you'd create a form in your app which captures the users credentials (username and password) you'd then pass them over an SSL connection (you'd never send them in plain text over an unencrypted/unsecured connection I'm sure) to a suitably created function in your WCF service. Your service will then validate the credentials and return either a failure message or a success message and details of which role the user has/is.
Managing roles, etc. is something that you'd configure on the back end.
It's the same way you'd do things if you were creating a log in form on a website and the WCF service was on a different domain or server.
There is no default login control for WP7. You'll have to create your own, but as this is just a couple of textboxes, labels and a[n appbar]button, that shouldn't cause you too much work.
更多推荐
发布评论