mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-96: Pull TOTP key from user attribute.
This commit is contained in:
@@ -22,6 +22,7 @@ package org.apache.guacamole.auth.totp;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
@@ -46,6 +47,11 @@ public class UserVerificationService {
|
||||
*/
|
||||
private final Logger logger = LoggerFactory.getLogger(UserVerificationService.class);
|
||||
|
||||
/**
|
||||
* The name of the user attribute which stores the TOTP key.
|
||||
*/
|
||||
private static final String TOTP_KEY_ATTRIBUTE_NAME = "guac-totp-key";
|
||||
|
||||
/**
|
||||
* The name of the HTTP parameter which will contain the TOTP code provided
|
||||
* by the user to verify their identity.
|
||||
@@ -84,10 +90,8 @@ public class UserVerificationService {
|
||||
* UserContext, or null if no TOTP key is associated with the user.
|
||||
*/
|
||||
public String getKey(UserContext context){
|
||||
|
||||
// FIXME: Hard-coded key
|
||||
return "JBSWY3DPEHPK3PXP";
|
||||
|
||||
Map<String, String> attributes = context.self().getAttributes();
|
||||
return attributes.get(TOTP_KEY_ATTRIBUTE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user