#1141 Fixes to TOTP implementation

- Revert back to SHA1 as HMAC hash function so that it works with Google authenticator
- Add message to user to tell him to run /2fa confirm to add a TOTP code
This commit is contained in:
ljacqu
2018-04-22 11:13:27 +02:00
parent de0e588cf3
commit 29ac3a7022
39 changed files with 510 additions and 149 deletions
@@ -1,11 +1,8 @@
package fr.xephi.authme.security.totp;
import com.warrenstrange.googleauth.GoogleAuthenticator;
import com.warrenstrange.googleauth.GoogleAuthenticatorConfig;
import com.warrenstrange.googleauth.GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder;
import com.warrenstrange.googleauth.GoogleAuthenticatorKey;
import com.warrenstrange.googleauth.GoogleAuthenticatorQRGenerator;
import com.warrenstrange.googleauth.HmacHashFunction;
import com.warrenstrange.googleauth.IGoogleAuthenticator;
import fr.xephi.authme.service.BukkitService;
import org.bukkit.entity.Player;
@@ -30,10 +27,7 @@ public class TotpAuthenticator {
* @return new Google Authenticator instance
*/
protected IGoogleAuthenticator createGoogleAuthenticator() {
GoogleAuthenticatorConfig config = new GoogleAuthenticatorConfigBuilder()
.setHmacHashFunction(HmacHashFunction.HmacSHA512)
.build();
return new GoogleAuthenticator(config);
return new GoogleAuthenticator();
}
/**