Silveright - 扩展 AuthenticationService 以提供自定义身份验证
我正在尝试添加到 Silverlight 4 业务模板中提供的身份验证系统,因为我的模型不完全适合模板中提供的模型。我有一个现有的 Web 服务,它执行我的身份验证并提供角色以及每个角色允许的操作。这是 AzMan/Authentication Manager 提供的模型。
但是,在身份验证之后,我不只是获取单个角色,而是向用户提供可用角色的列表,并允许用户选择其中一个角色,然后获取该所选角色的操作/动作列表。
我遇到的问题是,我无法弄清楚如何向身份验证服务添加新方法,以允许我获取当前用户和当前选择的角色的操作,以完成登录过程,例如
public SessionInfo GetOperations(string username, string selectedRole)
{
SessionInfo sessionInfo;
using (AzManServiceClient azClient = new AzManServiceClient("AnonymousAuthentication"))
{
sessionInfo = azClient.LoginUserByUsername("msldap://CN=LiveApps,CN=Program Data,DC=HLSUK,DC=local", "AIRS", selectedRole, null, username);
}
return sessionInfo;
}
上述方法不是使用 WebContextBase.Current.Authentication 从 LoginForm.xaml.cs 访问...只有诸如 Login 之类的方法是可见的,这更令人困惑,因为我在authenticationbase 中看不到这些方法。我完全糊涂了。如何向身份验证服务添加新方法,或者应该创建新的域服务,或者应该访问 azman 服务以直接从 silverlight 客户端获取操作。
I am trying to add to the authentication system provided in the Silverlight 4 business template as my model does not completely fit that provided in the template. I have an existing web service that performs my authentication and provides roles and also permitted operations for each role. This is the model provided by AzMan/Authentication Manager.
However, rather than just get a single role, following authentication I provide the user with a list of available roles and allow the user to select one of these roles and then get a list of operations/actions for that selected role.
The problem that I have is that I can't work out how to add new methods to the authenticationservice to allow me to get the operations for the current user, and currently selected role in order to complete the login process e.g.
public SessionInfo GetOperations(string username, string selectedRole)
{
SessionInfo sessionInfo;
using (AzManServiceClient azClient = new AzManServiceClient("AnonymousAuthentication"))
{
sessionInfo = azClient.LoginUserByUsername("msldap://CN=LiveApps,CN=Program Data,DC=HLSUK,DC=local", "AIRS", selectedRole, null, username);
}
return sessionInfo;
}
The above method is not accessible from the LoginForm.xaml.cs using WebContextBase.Current.Authentication... Only methods such as Login are visible which is even more baffling because I can't see these methods in authenticationbase. I'm completely confused. How do I add new methods to the authentication service, or should I create a new domainservice, or should I access the azman service to get the operations directly from the silverlight client.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过重写 AuthenticationBase 中的方法?
然后您可以使用您想要的任何逻辑来扩展您的身份验证服务。
还将
WebContext.Current.Authentication 设置为您在命名空间 System.ServiceModel.DomainServices.Client.ApplicationServices 中找到的身份验证服务
抱歉,愚蠢的 VB 代码。 :D
Have you tried to Override the methods in AuthenticationBase?
Then you can expand your authenticationservice with whatever logic you want.
Also set
WebContext.Current.Authentication To your authenticationservice as found in namespace System.ServiceModel.DomainServices.Client.ApplicationServices
Sorry for stupid VB code. :D