Commit 8d9b2d64 authored by ls1947's avatar ls1947
Browse files

add expiry for sshkey twofa

parent 936b28ec
......@@ -72,9 +72,18 @@ public class SshLoginServiceImpl implements SshLoginService {
if (loginInfo != null && loginInfo.getLoginStatus().equals(UserLoginInfoStatus.SUCCESS)) {
// check expiry for twofa
Long expiry = 60L * 60L * 1000L;
if (service.getServiceProps().containsKey("twofa_expiry")) {
expiry = Long.parseLong(service.getServiceProps().get("twofa_expiry"));
}
List<SshPubKeyRegistryEntity> regKeyList = sshPubKeyRegistryDao.findByRegistryForInteractiveLogin(registry.getId());
return buildKeyList(regKeyList, user);
if ((System.currentTimeMillis() - loginInfo.getLoginDate().getTime()) < expiry) {
List<SshPubKeyRegistryEntity> regKeyList = sshPubKeyRegistryDao.findByRegistryForInteractiveLogin(registry.getId());
return buildKeyList(regKeyList, user);
}
else {
return "";
}
}
else {
return "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment