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 classThe package transport object.static classThe transport object.static classThe 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 booleanThe methodisEmptyprovides means to check whether the argument isnullor the empty string.The methodloginprovides means to login.The methodpasswdprovides means to create a ticket and send it to the user.The methodrefreshprovides means to refresh the access token.The methodregisterAccountprovides means to start the registration process.booleanThe methodsetprovides means to set a single attribute of the user and save the result.booleansetPasswdFromTicket(String ticket, String password) The methodsetPasswdFromTicketprovides means to set the password from a ticket.booleansetPassword(@NonNull String account, @NonNull String password) The methodsetPasswordprovides means to set the password from a user.verifyTicket(String key) The methodverifyTicketprovides 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 methodisEmptyprovides means to check whether the argument isnullor the empty string.- Parameters:
s- the reference string- Returns:
trueif the string isnullor empty
-
login
public AccountService.UserTo login(@NonNull @NonNull String account, @NonNull @NonNull String passwd) The methodloginprovides means to login.- Parameters:
account- the accountpasswd- the password- Returns:
- the user or
null
-
passwd
The methodpasswdprovides means to create a ticket and send it to the user.- Parameters:
account- the account nameemail- the associated email address- Returns:
- a new ticket or
nullif something fails
-
refresh
public AccountService.UserTo refresh(@NonNull @NonNull String account, @NonNull @NonNull String refresh) The methodrefreshprovides means to refresh the access token.- 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 methodregisterAccountprovides 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 methodsetprovides means to set a single attribute of the user and save the result.- Parameters:
account- the accountattribute- the attributevalue- the value
-
setPasswdFromTicket
The methodsetPasswdFromTicketprovides means to set the password from a ticket.- Parameters:
ticket- the ticketpassword- the password- Returns:
trueiff the password could be stored
-
setPassword
The methodsetPasswordprovides means to set the password from a user.- Parameters:
account- the user namepassword- the new password- Returns:
trueiff the password has been changed
-
verifyTicket
The methodverifyTicketprovides means to check that a ticket exists and is not expired.- Parameters:
key- the ticket key- Returns:
- the ticket or
null
-