Search in sources :

Example 11 with EphemeralKey

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;
}
Also used : EphemeralInput(com.zimbra.cs.ephemeral.EphemeralInput) AbsoluteExpiration(com.zimbra.cs.ephemeral.EphemeralInput.AbsoluteExpiration) Expiration(com.zimbra.cs.ephemeral.EphemeralInput.Expiration) AbsoluteExpiration(com.zimbra.cs.ephemeral.EphemeralInput.AbsoluteExpiration) EphemeralKey(com.zimbra.cs.ephemeral.EphemeralKey)

Aggregations

EphemeralKey (com.zimbra.cs.ephemeral.EphemeralKey)11 EphemeralLocation (com.zimbra.cs.ephemeral.EphemeralLocation)6 LdapEntryLocation (com.zimbra.cs.ephemeral.LdapEntryLocation)6 EphemeralStore (com.zimbra.cs.ephemeral.EphemeralStore)5 LdapEphemeralStore (com.zimbra.cs.ephemeral.LdapEphemeralStore)4 EphemeralInput (com.zimbra.cs.ephemeral.EphemeralInput)3 AbsoluteExpiration (com.zimbra.cs.ephemeral.EphemeralInput.AbsoluteExpiration)3 Expiration (com.zimbra.cs.ephemeral.EphemeralInput.Expiration)3 EphemeralResult (com.zimbra.cs.ephemeral.EphemeralResult)2 EntrySource (com.zimbra.cs.ephemeral.migrate.AttributeMigration.EntrySource)1 MigrationCallback (com.zimbra.cs.ephemeral.migrate.AttributeMigration.MigrationCallback)1 Test (org.junit.Test)1