Update TotpBean.java
Add a `getUsername()` method to the `TotpBean` class so usernames can be used in the TOTP templates.
This commit is contained in:
parent
4f068fcdcc
commit
a64f6dcfc2
1 changed files with 6 additions and 0 deletions
|
@ -47,10 +47,12 @@ public class TotpBean {
|
||||||
private UriBuilder uriBuilder;
|
private UriBuilder uriBuilder;
|
||||||
private final List<CredentialModel> otpCredentials;
|
private final List<CredentialModel> otpCredentials;
|
||||||
private final List<String> supportedApplications;
|
private final List<String> supportedApplications;
|
||||||
|
private final UserModel user;
|
||||||
|
|
||||||
public TotpBean(KeycloakSession session, RealmModel realm, UserModel user, UriBuilder uriBuilder) {
|
public TotpBean(KeycloakSession session, RealmModel realm, UserModel user, UriBuilder uriBuilder) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.realm = realm;
|
this.realm = realm;
|
||||||
|
this.user = user;
|
||||||
this.uriBuilder = uriBuilder;
|
this.uriBuilder = uriBuilder;
|
||||||
this.enabled = user.credentialManager().isConfiguredFor(OTPCredentialModel.TYPE);
|
this.enabled = user.credentialManager().isConfiguredFor(OTPCredentialModel.TYPE);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
@ -107,4 +109,8 @@ public class TotpBean {
|
||||||
return otpCredentials;
|
return otpCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return user.getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue