在(3层)下的业务层中如何实现登录表单身份验证 [英] In Business layer under (3 tier) how implement login form authentication
本文介绍了在(3层)下的业务层中如何实现登录表单身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的代码项目团队,
在(三层体系结构)下的业务层"中,我如何实现具有表示层连接性的过程和登录表单身份验证登录.
请说明< b>我如何在业务层中使用登录身份验证</b>.并在业务层中使用Login.
请帮帮我.
谢谢
罗希特(Rohit kumar Singh)
9810353598
Dear Code project Team,
In Business Layer under (3 tier architecture) how i implement Procedure and login form authentication login with connectivity of presentation layer.
Please description<b> how i can use login authentication in business layer</b>. And Login use in business layer.
Please help me.
Thanks
Rohit kumar Singh
9810353598
推荐答案
表示层-获取凭据并将其传递给业务逻辑层
业务逻辑层-验证凭据(使用来自数据库的LDAP/自定义身份验证).验证之后,您可以决定将输出存储到会话中,该会话将在所有页面之间共享.
数据访问层-使用它从数据库中提取相应的凭据(如果使用自定义身份验证)
一个简单的解决方案.
网站项目
1. Login.aspx.cs
Presentation Layer - get and pass the credentials to the Business Logic Layer
Business Logic Layer - validate the credentials (using either LDAP/ custom authentications from DB). After validation, you may decide to store the output to a session, which will be shared among all the pages.
Data Access Layer - use it to pull the respective credentials from DB (if you use your custom authentication)
A simple solution.
Website Project
1. Login.aspx.cs
public void btnLogin_click()
{
//get both username & password and store it in string variables
LoginControlClass logClass = new LoginControlClass();
logClass.IsAuthenticatedUser(userName, password);
}
BLL(类库)
BLL (Class Library)
public class LoginControlClass
{
public bool IsAuthenticatedUser(string userName, string password)
{
//put in your logic to authenticate.
//If LDAP, get details from LDAP to validate uname/password
//If custom, then invoke data from DAL to validate username/ password.
LoginDal loginDal = new LoginDal();
User user = loginDal.RetrieveUserCredentials(userName, password);
//Check the variable inside user object to determine the authentication status.
}
}
DAL(类库)
DAL (Class Library)
public class LoginDal
{
public User RetrieveUserCredentials()
{
//Query from DB to prepare User object. This can be a DTO. Remember not to save the password in User object, instead you may think of set the validated authentication result in a variable.
}
}
干杯
-巴拉吉
Cheers
- Balaji
这篇关于在(3层)下的业务层中如何实现登录表单身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文