Project

General

Profile

Download (992 Bytes) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2021 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.api.security;
10

    
11
import java.util.Calendar;
12
import java.util.Date;
13

    
14
/**
15
 * @author a.kohlbecker
16
 * @since Nov 18, 2021
17
 */
18
public class AbstractRequestToken {
19

    
20
    protected String token;
21
    private Date expiryDate;
22

    
23
    /**
24
     * 
25
     */
26
    public AbstractRequestToken() {
27
        super();
28
    }
29

    
30
    public String getToken() {
31
        return token;
32
    }
33

    
34
    public Date getExpiryDate() {
35
        return expiryDate;
36
    }
37

    
38
    protected void setExpiryDate(int minutes) {
39
        Calendar now = Calendar.getInstance();
40
        now.add(Calendar.MINUTE, minutes);
41
        this.expiryDate = now.getTime();
42
    }
43

    
44
    public boolean isExpired() {
45
        return new Date().after(this.expiryDate);
46
    }
47

    
48
}
(1-1/7)