Package org.ctan.site.services.account
Class AccountService
java.lang.Object
org.ctan.site.services.account.AccountService
The class
AccountService
contains service methods for the CTAN
site user.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The package transport object.static class
The transport object.static class
The user transport object. -
Constructor Summary
ConstructorsConstructorDescriptionAccountService
(@NonNull UserStore store, @NonNull TicketStore ticketStore, @NonNull AuthorStore authorStore, @NonNull MailService mailService) This is the constructor for the classUserService
. -
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
The methodisEmpty
provides means to check whether the argument isnull
or the empty string.The methodlogin
provides means to login.The methodlogin
provides means to login.The methodregisterAccount
provides means to start the registration process.boolean
The methodset
provides means to set a single attribute of the user and save the result.boolean
setPasswdFromTicket
(String ticket, String password) The methodsetPasswdFromTicket
provides means to set the password from a ticket.boolean
setPassword
(@NonNull String account, @NonNull String password) The methodsetPassword
provides means to set the password from a user.verifyTicket
(String key) The methodverifyTicket
provides means to check that a ticket exists and is not expired.
-
Constructor Details
-
AccountService
public AccountService(@NonNull @NonNull UserStore store, @NonNull @NonNull TicketStore ticketStore, @NonNull @NonNull AuthorStore authorStore, @NonNull @NonNull MailService mailService) This is the constructor for the classUserService
.- Parameters:
store
- the underlying storeticketStore
- the ticket storeauthorStore
- the author storemailService
- the mail service
-
-
Method Details
-
isEmpty
The methodisEmpty
provides means to check whether the argument isnull
or the empty string.- Parameters:
s
- the reference string- Returns:
true
if the string isnull
or empty
-
login
public AccountService.UserTo login(@NonNull @NonNull String account, @NonNull @NonNull String password) The methodlogin
provides means to login.- Parameters:
account
- the accountpassword
- the password- Returns:
- the user or
null
-
refresh
public AccountService.UserTo refresh(@NonNull @NonNull String account, @NonNull @NonNull String refresh) The methodlogin
provides means to login.- Parameters:
account
- the accountrefresh
- the refresh token- Returns:
- the user or
null
-
registerAccount
public AccountService.To registerAccount(String account, String email, String name, Gender gender, String lang) The methodregisterAccount
provides means to start the registration process.- Parameters:
account
- the accountemail
- the emailname
- the namegender
- the genderlang
- the locale to use- Returns:
- the registered account
-
set
public boolean set(@NonNull @NonNull String account, @NonNull @NonNull String attribute, @NonNull @NonNull String value) The methodset
provides means to set a single attribute of the user and save the result.- Parameters:
account
- the accountattribute
- the attributevalue
- the value
-
setPasswdFromTicket
The methodsetPasswdFromTicket
provides means to set the password from a ticket.- Parameters:
ticket
- the ticketpassword
- the password- Returns:
true
iff the password could be stored
-
setPassword
The methodsetPassword
provides means to set the password from a user.- Parameters:
account
- the user namepassword
- the new password- Returns:
true
iff the password has been changed
-
verifyTicket
The methodverifyTicket
provides means to check that a ticket exists and is not expired.- Parameters:
key
- the ticket key- Returns:
- the user name or
null
-