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 org.springframework.beans.factory.annotation.Autowired;
|
12
|
import org.springframework.stereotype.Component;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.service.IUserService;
|
15
|
import eu.etaxonomy.cdm.model.permission.User;
|
16
|
|
17
|
/**
|
18
|
* @author a.kohlbecker
|
19
|
* @since Nov 3, 2021
|
20
|
*/
|
21
|
@Component
|
22
|
public class AccountCreationRequestTokenStore extends AbstractRequestTokenStore<AccountCreationRequest> {
|
23
|
|
24
|
@Autowired
|
25
|
private IUserService userService;
|
26
|
|
27
|
@Override
|
28
|
public AccountCreationRequest createNewToken(User user, String randomToken, int tokenLifetimeMinutes) {
|
29
|
userService.encodeUserPassword(user, user.getPassword());
|
30
|
AccountCreationRequest token = new AccountCreationRequest(user.getUsername(), user.getPassword(), user.getEmailAddress(), randomToken, tokenLifetimeMinutes);
|
31
|
return token;
|
32
|
}
|
33
|
|
34
|
}
|