Project

General

Profile

Download (2.72 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.service.security;
10

    
11
import org.springframework.util.concurrent.ListenableFuture;
12

    
13
/**
14
 * @author a.kohlbecker
15
 * @since Nov 8, 2021
16
 */
17
public interface IPasswordResetService {
18

    
19
    /**
20
     * Create a request token and send it to the user via email.
21
     *
22
     * Must conform to the recommendations of <a href=
23
     * "https://cheatsheetseries.owasp.org/cheatsheets/Forgot_Password_Cheat_Sheet.html">
24
     * https://cheatsheetseries.owasp.org/cheatsheets/Forgot_Password_Cheat_Sheet.html</a>
25
     *
26
     * <ul>
27
     * <li>Hides internal processing time differences by sending the email
28
     * asynchronously</li>
29
     * <li>Access to the method is rate limited, see {@link #RATE_LIMIT}</li>
30
     * </ul>
31
     *
32
     * @param userNameOrEmail
33
     *            The user name or email address of the user requesting for a
34
     *            password reset.
35
     * @param passwordRequestFormUrlTemplate
36
     *            A template string for {@code String.format()} for the URL to
37
     *            the request form in which the user can enter the new password.
38
     *            The template string must contain one string placeholder
39
     *            {@code %s} for the request token string.
40
     * @return A <code>Future</code> for a <code>Boolean</code> flag. The
41
     *         boolean value will be <code>false</code> in case the max access
42
     *         rate for this method has been exceeded and a time out has
43
     *         occurred. Other internal error states are intentionally hidden to
44
     *         avoid leaking of information on the existence of users (see above
45
     *         link to the Forgot_Password_Cheat_Sheet).
46
     */
47
    ListenableFuture<Boolean> emailResetToken(String userNameOrEmail, String passwordRequestFormUrlTemplate);
48

    
49
    /**
50
     *
51
     * @param token
52
     *            the token string
53
     * @param newPassword
54
     *            The new password to set
55
     * @return A <code>Future</code> for a <code>Boolean</code> flag. The
56
     *         boolean value will be <code>false</code> in case the max access
57
     *         rate for this method has been exceeded and a time out has
58
     *         occurred. Other internal error states are intentionally hidden to
59
     *         avoid leaking of information on the existence of users (see above
60
     *         link to the Forgot_Password_Cheat_Sheet).
61
     * @throws PasswordResetException
62
     */
63
    ListenableFuture<Boolean> resetPassword(String token, String newPassword) throws PasswordResetException;
64

    
65
}
(2-2/4)