| .. | .. |
|---|
| 20 | 20 | @Singleton |
|---|
| 21 | 21 | public class TokenHelper { |
|---|
| 22 | 22 | |
|---|
| 23 | | - private static final Logger log = LogManager.getLogger(TokenHelper.class); |
|---|
| 23 | + private static final Logger LOG = LogManager.getLogger(TokenHelper.class); |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | /** |
|---|
| 26 | 26 | * Period before token expires, set in hours. |
|---|
| .. | .. |
|---|
| 52 | 52 | sb.append(Utils.toIsoFormat(date)); |
|---|
| 53 | 53 | return Base64.encodeBytes(sb.toString().getBytes("utf-8")); |
|---|
| 54 | 54 | } catch (NoSuchAlgorithmException e) { |
|---|
| 55 | | - log.error("Error generating SHA-256 hash", e); |
|---|
| 55 | + LOG.error("Error generating SHA-256 hash", e); |
|---|
| 56 | 56 | } catch (UnsupportedEncodingException e) { |
|---|
| 57 | | - log.error("Error generating SHA-256 hash", e); |
|---|
| 57 | + LOG.error("Error generating SHA-256 hash", e); |
|---|
| 58 | 58 | } |
|---|
| 59 | 59 | return null; |
|---|
| 60 | 60 | |
|---|
| .. | .. |
|---|
| 92 | 92 | String newSecret = generateSecret(user, date); |
|---|
| 93 | 93 | return newSecret.equals(secret); |
|---|
| 94 | 94 | } catch (IOException e) { |
|---|
| 95 | | - log.error("Error decoding Base64 token", e); |
|---|
| 95 | + LOG.error("Error decoding Base64 token", e); |
|---|
| 96 | 96 | } catch (NoSuchAlgorithmException e) { |
|---|
| 97 | | - log.error("Error generation secret to compare with", e); |
|---|
| 97 | + LOG.error("Error generation secret to compare with", e); |
|---|
| 98 | 98 | } |
|---|
| 99 | 99 | return false; |
|---|
| 100 | 100 | } |
|---|
| .. | .. |
|---|
| 110 | 110 | String user = parts[1]; |
|---|
| 111 | 111 | return user; |
|---|
| 112 | 112 | } catch (IOException e) { |
|---|
| 113 | | - log.error("Error decoding Base64 token", e); |
|---|
| 113 | + LOG.error("Error decoding Base64 token", e); |
|---|
| 114 | 114 | } |
|---|
| 115 | 115 | return null; |
|---|
| 116 | 116 | } |
|---|
| .. | .. |
|---|
| 124 | 124 | Date date = Utils.toDateFromIso(parts[2]); |
|---|
| 125 | 125 | return date; |
|---|
| 126 | 126 | } catch (IOException e) { |
|---|
| 127 | | - log.error("Error decoding Base64 token", e); |
|---|
| 127 | + LOG.error("Error decoding Base64 token", e); |
|---|
| 128 | 128 | } |
|---|
| 129 | 129 | return null; |
|---|
| 130 | 130 | } |
|---|