Project

General

Profile

Download (1.52 KB) 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.Optional;
12

    
13
import eu.etaxonomy.cdm.model.permission.User;
14

    
15
/**
16
 * @author a.kohlbecker
17
 * @since Nov 3, 2021
18
 */
19
public interface IPasswordResetTokenStore {
20

    
21
    public static final int TOKEN_LIFETIME_MINUTES_DEFAULT = 60 * 6;
22

    
23
    public PasswordResetRequest create(User user);
24

    
25
    /**
26
     * Removes the corresponding <code>PasswordResetRequest</code> from the
27
     * store
28
     *
29
     * @param token
30
     *            The token string
31
     * @return true if the token to be remove has existed, otherwise false
32
     */
33
    public boolean remove(String token);
34

    
35
    /**
36
     * Checks is the supplied token exists and has not expired.
37
     *
38
     * @param token
39
     *            The token string
40
     * @return true if the token is valid
41
     */
42
    public boolean isEligibleToken(String token);
43

    
44
    /**
45
     * Returns the corresponding <code>PasswordResetRequest</code> if it exists
46
     * and is not expired.
47
     *
48
     * @param token
49
     *            The token string
50
     * @return the valid <code>PasswordResetRequest</code> or an empty
51
     *         <code>Optional</code>
52
     */
53
    public Optional<PasswordResetRequest> findResetRequest(String token);
54

    
55

    
56
    public void setTokenLifetimeMinutes(int tokenLifetimeMinutes);
57

    
58

    
59
}
(1-1/3)