Beispiel #1
0
        private bool SqlAuthenticateAndLogin(string username, string password)
        {
            var user = sessionFactory().QueryOver <User>()
                       .Where(u => u.Username == username && u.Password == SqlFunnelWebMembership.HashPassword(password))
                       .SingleOrDefault();

            if (user != null)
            {
                FormsAuthentication.SetAuthCookie(username, true);
                return(true);
            }

            return(false);
        }
 public SqlAuthenticationController(
     Func<ISession> sessionFactory,
     SqlFunnelWebMembership sqlMembership, 
     ISettingsProvider settingsProvider,
     SqlRoleProvider sqlRoleProvider, 
     FormsAuthenticator formsAuthenticator, 
     SqlAuthenticator sqlAuthenticator)
 {
     this.sessionFactory = sessionFactory;
     this.sqlMembership = sqlMembership;
     this.settingsProvider = settingsProvider;
     this.sqlRoleProvider = sqlRoleProvider;
     this.formsAuthenticator = formsAuthenticator;
     this.sqlAuthenticator = sqlAuthenticator;
     sqlAuthSettings = this.settingsProvider.GetSettings<SqlAuthSettings>();
 }
Beispiel #3
0
        private bool SqlAuthenticateAndLogin(string username, string password)
        {
            var user = sessionFactory()
                       .QueryOver <User>()
                       .Where(u => u.Username == username && u.Password == SqlFunnelWebMembership.HashPassword(password))
                       .SingleOrDefault();

            if (user == null)
            {
                return(false);
            }

            federatedAuthenticationService.Login(user);

            return(true);
        }