Silverlight 4 - 针对自定义 WCF 服务的身份验证/授权
我在 AzMan 存储前面有一个 wcf 服务,它使用以下接口将角色和操作传递给客户端:
[OperationContract]
bool AuthenticateUser(string password, string appName);
[OperationContract]
string[] GetRoles(string storelocation, string appName);
[OperationContract]
string[] GetOperations(string storeLocation, string appName, string selectedRole);
客户端使用 Windows 身份验证连接到此服务(但用户必须发送密码以重新确认其身份)。最终,该服务提供了一系列操作,每个客户端都可以根据其选择的角色执行这些操作。
我打开了一个新的 Silverlight 业务应用程序,并尝试了解身份验证/授权在该模板中的工作原理,并在网络上查找示例以了解如何将我的 Web 服务挂接到模板中已创建的登录框,但我完全不知道该怎么做!
有人可以提供任何建议吗?
I have a wcf service in front of an AzMan store that passes roles and operations to clients using the following interface:
[OperationContract]
bool AuthenticateUser(string password, string appName);
[OperationContract]
string[] GetRoles(string storelocation, string appName);
[OperationContract]
string[] GetOperations(string storeLocation, string appName, string selectedRole);
Clients connect to this service using windows authentication (but users must send their password through to reaffirm their identity). Ultimately the service delivers an array of operations that each client can perform based on their selected role.
I've opened a new Silverlight Business Application and tried to understand how authentication/authorization works in this template, as well as scoured the web to find examples to how to hook my webservice to the login box already created in the template, but I am completely at a loss as how to do this!
Can anyone offer any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
业务应用程序模板有一个 AuthenticationService,它基于 User 对象和 AuthenticationBase 类。 AuthenticationBase 具有虚拟方法,您可以重写这些方法以使用您自己的安全机制。
例如,有一个基于用户名和密码的登录方法。此方法返回一个具有名称和角色的 IUser。
查看您的接口后,我将创建 IUser 的子接口以包含允许的操作列表,并更改生成的 User 类以实现此子接口。我将重写 AuthenticationService 中的 Login 和相关方法以使用现有的基于 Azman 的代码。
The Business application template has an AuthenticationService, that is based on the User object and the AuthenticationBase class. AuthenticationBase has virtual methods that you can override to use your own security mechanisms.
For example, there is a Login method, based on a username and a password. This method returns a IUser that has a name and roles.
After looking at your interface, I'd create a sub-interface of IUser to include the list of allowed operations and change the generated User class to implement this sub-interface. And I'd override the Login and related methods in AuthenticationService to use your existing Azman-based code.