use of com.zimbra.cs.ephemeral.EphemeralKey in project zm-mailbox by Zimbra.
the class AuthTokenConverter method convert.
@Override
public EphemeralInput convert(String attrName, Object ldapValue) {
String ldapValueStr = (String) ldapValue;
String[] parts = ldapValueStr.split("\\|");
if (parts.length != 3) {
ZimbraLog.ephemeral.warn("LDAP auth token %s cannot be parsed", ldapValueStr);
return null;
}
String token = parts[0];
Long expirationMillis;
try {
expirationMillis = Long.parseLong(parts[1]);
} catch (NumberFormatException e) {
ZimbraLog.ephemeral.warn("LDAP auth token %s does not have a valid expiration value", ldapValueStr);
return null;
}
String serverVersion = parts[2];
EphemeralKey key = new EphemeralKey(attrName, token);
EphemeralInput input = new EphemeralInput(key, serverVersion);
Expiration expiration = new AbsoluteExpiration(expirationMillis);
input.setExpiration(expiration);
return input;
}
Aggregations