Commit 3a60c816 authored by Matija Obreza's avatar Matija Obreza
Browse files

New verification tokens live for 48 hours

parent 378cd077
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
package org.genesys2.server.service.impl; package org.genesys2.server.service.impl;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -24,21 +27,17 @@ import org.genesys2.server.persistence.domain.VerificationTokenRepository; ...@@ -24,21 +27,17 @@ import org.genesys2.server.persistence.domain.VerificationTokenRepository;
import org.genesys2.server.service.JPATokenStoreCleanup; import org.genesys2.server.service.JPATokenStoreCleanup;
import org.genesys2.server.service.TokenVerificationService; import org.genesys2.server.service.TokenVerificationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
@Service @Service
@Transactional(readOnly = true) @Transactional(readOnly = true)
public class TokenVerificationServiceImpl implements TokenVerificationService, JPATokenStoreCleanup { public class TokenVerificationServiceImpl implements TokenVerificationService, JPATokenStoreCleanup {
private static final Log LOG = LogFactory.getLog(TokenVerificationServiceImpl.class); private static final Log LOG = LogFactory.getLog(TokenVerificationServiceImpl.class);
private static final int HOURS_UNTIL_INVALID = 4; private static final int HOURS_UNTIL_INVALID = 48;
@Autowired @Autowired
private VerificationTokenRepository verificationTokenRepository; private VerificationTokenRepository verificationTokenRepository;
...@@ -61,8 +60,8 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J ...@@ -61,8 +60,8 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J
return token; return token;
} }
@Override @Override
@Transactional @Transactional
public void cancel(String tokenUuid) throws NoSuchVerificationTokenException { public void cancel(String tokenUuid) throws NoSuchVerificationTokenException {
final VerificationToken verificationToken = verificationTokenRepository.findByUuid(tokenUuid); final VerificationToken verificationToken = verificationTokenRepository.findByUuid(tokenUuid);
if (verificationToken == null) { if (verificationToken == null) {
...@@ -99,7 +98,6 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J ...@@ -99,7 +98,6 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J
return verificationToken; return verificationToken;
} }
/** /**
* Cleanup executed every 10 minutes * Cleanup executed every 10 minutes
*/ */
......
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