use of org.craftercms.commons.crypto.CryptoException in project profile by craftercms.
the class RememberMeManagerImpl method deserializeLogin.
protected PersistentLogin deserializeLogin(String serializedLogin) throws RememberMeException {
String decryptedLogin;
try {
decryptedLogin = encryptor.decrypt(serializedLogin);
} catch (CryptoException e) {
throw new RememberMeException("Unable to decrypt remember me cookie", e);
}
String[] splitSerializedLogin = StringUtils.split(decryptedLogin, SERIALIZED_LOGIN_SEPARATOR);
if (ArrayUtils.isNotEmpty(splitSerializedLogin) && splitSerializedLogin.length == 3) {
PersistentLogin login = new PersistentLogin();
login.setId(splitSerializedLogin[0]);
login.setProfileId(splitSerializedLogin[1]);
login.setToken(splitSerializedLogin[2]);
return login;
} else {
throw new InvalidCookieException("Invalid format of remember me cookie");
}
}
Aggregations