Esempio n. 1
0
void User::updatePassword(Wt::WString password)
{
	Wt::Auth::PasswordVerifier verifier;
	verifier.addHashFunction(new Wt::Auth::BCryptHashFunction(7));
	Wt::Auth::PasswordHash ph = verifier.hashPassword(password);
	(*authInfos.begin()).modify()->setPassword(ph.value(), ph.function(), ph.salt());
}
Esempio n. 2
0
void Session::configureAuth()
{
	myAuthService.setAuthTokensEnabled(true,"logincookie");
	myAuthService.setEmailVerificationEnabled(true);

	Wt::Auth::PasswordVerifier *verifier = new Wt::Auth::PasswordVerifier();
	verifier->addHashFunction(new Wt::Auth::BCryptHashFunction(7));
	myPasswordService.setVerifier(verifier);
	myPasswordService.setAttemptThrottlingEnabled(true);
	myPasswordService.setStrengthValidator
		(new Wt::Auth::PasswordStrengthValidator());

}
Esempio n. 3
0
Services::Services() : auth(), pword(auth)
{
    assert(!_instance); // There can be only one!
    _instance = this;
    auth.setAuthTokensEnabled(true, "logincookie");
     auth.setAuthTokensEnabled(true, "my-auth-token");
     auth.setEmailVerificationEnabled(false);
     auth.setIdentityPolicy(Wt::Auth::LoginNameIdentity);

     Wt::Auth::PasswordVerifier *verifier = new Wt::Auth::PasswordVerifier();
     verifier->addHashFunction(new Wt::Auth::BCryptHashFunction(7));
     pword.setVerifier(verifier);
     pword.setAttemptThrottlingEnabled(true);
     pword.setStrengthValidator(new Wt::Auth::PasswordStrengthValidator());
}
Esempio n. 4
0
void WServer::configureAuth()
{
	_authService.setAuthTokensEnabled(_configurations->getBool("EnableTokens", ModuleDatabase::Authentication, true), _configurations->getStr("LoginCookie", ModuleDatabase::Authentication, "logintoken"));
	_authService.setEmailVerificationEnabled(_configurations->getBool("EmailVerification", ModuleDatabase::Authentication, false));

	Wt::Auth::PasswordVerifier *verifier = new Wt::Auth::PasswordVerifier();
	verifier->addHashFunction(new Wt::Auth::BCryptHashFunction(7));
	_passwordService.setVerifier(verifier);
	_passwordService.setAttemptThrottlingEnabled(true);
	_passwordService.setStrengthValidator(new Wt::Auth::PasswordStrengthValidator());

	if(Wt::Auth::GoogleService::configured() && configurations()->getBool("GoogleOAuth", ModuleDatabase::Authentication, false))
		_oAuthServices.push_back(new Wt::Auth::GoogleService(_authService));
	if(Wt::Auth::FacebookService::configured() && configurations()->getBool("FacebookOAuth", ModuleDatabase::Authentication, false))
		_oAuthServices.push_back(new Wt::Auth::FacebookService(_authService));
}
Esempio n. 5
0
void Session::configureAuth()
{
    myAuthService.setAuthTokensEnabled(true, "logincookie");
    myAuthService.setEmailVerificationEnabled(true);
    myAuthService.setEmailVerificationRequired(true);
    Wt::Auth::PasswordVerifier *verifier = new Wt::Auth::PasswordVerifier();
    verifier->addHashFunction(new Wt::Auth::BCryptHashFunction(7));
    myPasswordService.setVerifier(verifier);
    myPasswordService.setAttemptThrottlingEnabled(true);
    myPasswordService.setStrengthValidator
    (new Wt::Auth::PasswordStrengthValidator());
    if (Wt::Auth::GoogleService::configured())
        myOAuthServices.push_back(new Wt::Auth::GoogleService(myAuthService));
    if (Wt::Auth::FacebookService::configured())
        myOAuthServices.push_back(new Wt::Auth::FacebookService(myAuthService));
    for (unsigned i = 0; i < myOAuthServices.size(); ++i)
        myOAuthServices[i]->generateRedirectEndpoint();
}