Hi,现在我们暂时不谈Passport,Hi,现在我们暂时不谈Passport
【 tulaoshi.com - ASP.NET 】
Hi, 现在我们暂时不谈Passport PassportClient:
 PassportClient:  另外还有下面这些实现核心功能的存储过程: sp_registerUser sp_setUserInfo sp_setUserPassword sp_setUserStatus sp_purgeUser sp_setUserHomeService sp_validateUser sp_registerService sp_setServiceInfo sp_setServicePassword sp_setServiceStatus sp_purgeService sp_validateService 应用实现: 根据上面的数据结构实现了两个Web Services,一个作为整体的Services的管理接口,一个是提供给最终用户使用的Client Services接口。看得出来最终提供给用户使用的只有7个函数,当然开始时你可以在调试Services WebServices时测试一下RegisterService函数,它将建立一个Services,记下services_name和 services_password ,在实现Client的WebService的Global.cs中有这样应用: protected void Application_Start(Object sender, EventArgs e){ DataManager.InitManager(); Passport ppSvc = new Passport(); AppTicket = ppSvc.AuthenticateService("Passport","passport"); ppSvc=null;} 整个实现中有个与Passport相似的安全机制-Ticket,当用户通过验证之后获得一个AuthenticationTicket并产生一个Token,我认为这里是最有趣和最棒的部分,简单有效。 Ticket Structure public class AuthenticationTicket{ public AuthenticationTicket() { } public int Token; public int OwnerID; public double ExpirationDate; public double IssueDate; public string NickName; public string FirstName; public string LastName; } Token Generation Routine static private int GenerateToken(int systemID, string nickName, int passwordHash, double issueDate, double expirationDate){ int rtn; // our return value string s_token; // string concatenation of the objects // concatenate all of our values together. // note the use of hashing the password and the id, this // *should* help reduce the probability of attack s_token=systemID.GetHashCode().ToString() + nickName + passwordHash.GetHashCode().ToString() + issueDate.ToString() + expirationDate.ToString(); // get the hash of the concatenation and return it rtn=s_token.GetHashCode(); return rtn;} 好了解决了主要问题,后面的实现的就迎刃而解了,下面分别是两个Web Services暴露的功能函数。 public AuthenticationTicket AuthenticateServicepublic AuthenticationTicket AuthenticateUserpublic AuthenticationTicket CreateAccountpublic int Dis
 另外还有下面这些实现核心功能的存储过程: sp_registerUser sp_setUserInfo sp_setUserPassword sp_setUserStatus sp_purgeUser sp_setUserHomeService sp_validateUser sp_registerService sp_setServiceInfo sp_setServicePassword sp_setServiceStatus sp_purgeService sp_validateService 应用实现: 根据上面的数据结构实现了两个Web Services,一个作为整体的Services的管理接口,一个是提供给最终用户使用的Client Services接口。看得出来最终提供给用户使用的只有7个函数,当然开始时你可以在调试Services WebServices时测试一下RegisterService函数,它将建立一个Services,记下services_name和 services_password ,在实现Client的WebService的Global.cs中有这样应用: protected void Application_Start(Object sender, EventArgs e){ DataManager.InitManager(); Passport ppSvc = new Passport(); AppTicket = ppSvc.AuthenticateService("Passport","passport"); ppSvc=null;} 整个实现中有个与Passport相似的安全机制-Ticket,当用户通过验证之后获得一个AuthenticationTicket并产生一个Token,我认为这里是最有趣和最棒的部分,简单有效。 Ticket Structure public class AuthenticationTicket{ public AuthenticationTicket() { } public int Token; public int OwnerID; public double ExpirationDate; public double IssueDate; public string NickName; public string FirstName; public string LastName; } Token Generation Routine static private int GenerateToken(int systemID, string nickName, int passwordHash, double issueDate, double expirationDate){ int rtn; // our return value string s_token; // string concatenation of the objects // concatenate all of our values together. // note the use of hashing the password and the id, this // *should* help reduce the probability of attack s_token=systemID.GetHashCode().ToString() + nickName + passwordHash.GetHashCode().ToString() + issueDate.ToString() + expirationDate.ToString(); // get the hash of the concatenation and return it rtn=s_token.GetHashCode(); return rtn;} 好了解决了主要问题,后面的实现的就迎刃而解了,下面分别是两个Web Services暴露的功能函数。 public AuthenticationTicket AuthenticateServicepublic AuthenticationTicket AuthenticateUserpublic AuthenticationTicket CreateAccountpublic int Dis
                        来源:http://www.tulaoshi.com/n/20160129/1488052.html
看过《Hi,现在我们暂时不谈Passport》的人还看了以下文章 更多>>