Make use of display name by default for TOTP
- use realm name just in case of display name is not available
This commit is contained in:
1 parent
1e3ec1983d
commit
7ec0dad88f
3 files changed
+4
-5
No files matched your search
@@ -97,8 +97,11 @@ public class OTPPolicy implements Serializable {
|
||||
|
||||
public String getKeyURI(RealmModel realm, UserModel user, String secret) {
|
||||
|
||||
String displayName = realm.getDisplayName();
|
||||
String uri = null;
|
||||
uri = "otpauth://" + type + "/" + realm.getName() + ":" + user.getUsername() + "?secret=" +
|
||||
|
||||
if (displayName == null || displayName.isEmpty()) { displayName = realm.getName(); }
|
||||
uri = "otpauth://" + type + "/" + displayName + ":" + user.getUsername() + "?secret=" +
|
||||
Base32.encode(secret.getBytes()) + "&digits=" + digits + "&algorithm=" + algToKeyUriAlg.get(algorithm);
|
||||
try {
|
||||
uri += "&issuer=" + URLEncoder.encode(realm.getName(), "UTF-8");
|
||||
|
||||
Reference in new issue
Block a user