public string GetFullName(string username)
        {
            string fullName = string.Empty;

            if (connection != null)
            {
                IAccountService accountService = new LdapAccountService();
                accountService.SetAccountManager(connection);

                fullName = accountService.ReadUserFullName(username);
            }

            return(fullName);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var username = HttpContext.Current.User.Identity.Name;

            connection = (ILdapServerConnection)Session[Global.LdapConnection];

            if (connection == null)
            {
                SignOut();
            }
            else
            {
                IAccountService accountService = new LdapAccountService();
                accountService.SetAccountManager(connection);
            }
        }
Ejemplo n.º 3
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            ILdapSettingsService ldapSettings = new LdapSettingsService();

            SetLdapSettings(ldapSettings);

            ILdapServerConnection ldapServerConnection = new LdapServerConnection();
            IAccountService       accountService       = new LdapAccountService();

            ILoginService loginService = new LoginService(ldapServerConnection, accountService);
            var           response     = loginService.Login(ldapSettings);

            if (response.User == null)
            {
                lblError.Visible   = true;
                lblError.InnerText = response.ResponseMessage;
            }
            else
            {
                SignIn(response.User);
                SaveLdapConnection(ldapServerConnection);
                Response.Redirect(Global.DashboardPage);
            }
        }