Package com.atlassian.confluence.user
Class DefaultSignupManager
- java.lang.Object
-
- com.atlassian.confluence.user.DefaultSignupManager
-
- All Implemented Interfaces:
SignupManager
public class DefaultSignupManager extends Object implements SignupManager
Handles easy-user creation in its myriad forms.- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description static StringNOTIFY_ON_SIGNUP_TOKENstatic StringPREVIOUS_SIGNUP_TOKENstatic StringSIGNUP_TOKEN
-
Constructor Summary
Constructors Constructor Description DefaultSignupManager(com.atlassian.bandana.BandanaManager bandanaManager, com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator, UserVerificationTokenManager userVerificationTokenManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, SettingsManager settingsManager, com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer, EmailService notificationsService, NotificationsSender notificationsSender, com.atlassian.event.api.EventPublisher eventPublisher, UserChecker userChecker, PersonalInformationManager personalInformationManager, com.atlassian.core.task.MultiQueueTaskManager taskManager, I18NBeanFactory i18NBeanFactory, DataSourceFactory dataSourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSignUpWith(String token)Return true if the given token is valid for a user to self-sign-up.StringcreateUserPendingConfirmation(com.atlassian.user.User user, String password)Creates a new user and marks them disabled pending their email confirmation?booleandoesUserHaveOutdatedSignupToken(com.atlassian.user.User user)voidenableConfirmedUser(com.atlassian.user.User user)Enable previously disabled user who signed up and confirmed their email.StringgetRelativeSignupURL()StringgetRestrictedDomains()Returns comma separated list of domains.StringgetSignUpToken()Gets the current sign-up token, or creates a new one and returns it.StringgetSignupURL()booleanisDomainRestrictedSignupEnabled()booleanisEmailOnRestrictedDomain(String email)Checks if the given email address is on one of the configured restricted domains.booleanisEmailSentOnInviteSignUp()booleanisPendingConfirmation(com.atlassian.user.User user)Is given user tried to sign up but hasn't confirmed their email yet?booleanisPublicSignupPermitted()Returns true if users can sign themselves for this instance.booleanisTokenForUserValid(com.atlassian.user.User user, String token)StringrefreshAndGetToken()Creates a new sign-up token and returns it.StringrestorePreviousToken()Restore the previous private-signup token and returns it.voidsendConfirmationEmail(String token, com.atlassian.user.User user)Sends a confirmation email to the given new user.NotificationSendResultsendInvites(SendUserInviteEvent event)Send invitation emails with a message to a list of email addresses.voidsendWelcomeEmail(ConfluenceUser user)Sends a welcome email to the given new user.voidsetDomainRestrictedSignupMode(String allowedDomains)Set the domains that user's email address should belong to to be able to sign up.voidsetEmailSentOnInviteSignUp(boolean notify)voidsetPrivateSignupMode()voidsetPublicSignupMode()
-
-
-
Field Detail
-
SIGNUP_TOKEN
public static final String SIGNUP_TOKEN
- See Also:
- Constant Field Values
-
PREVIOUS_SIGNUP_TOKEN
public static final String PREVIOUS_SIGNUP_TOKEN
- See Also:
- Constant Field Values
-
NOTIFY_ON_SIGNUP_TOKEN
public static final String NOTIFY_ON_SIGNUP_TOKEN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultSignupManager
public DefaultSignupManager(com.atlassian.bandana.BandanaManager bandanaManager, com.atlassian.security.random.SecureTokenGenerator secureTokenGenerator, UserVerificationTokenManager userVerificationTokenManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, SettingsManager settingsManager, com.atlassian.renderer.WikiStyleRenderer wikiStyleRenderer, EmailService notificationsService, NotificationsSender notificationsSender, com.atlassian.event.api.EventPublisher eventPublisher, UserChecker userChecker, PersonalInformationManager personalInformationManager, com.atlassian.core.task.MultiQueueTaskManager taskManager, I18NBeanFactory i18NBeanFactory, DataSourceFactory dataSourceFactory)- Since:
- 7.17
-
-
Method Detail
-
refreshAndGetToken
public String refreshAndGetToken()
Description copied from interface:SignupManagerCreates a new sign-up token and returns it. This invalidates the previous token.- Specified by:
refreshAndGetTokenin interfaceSignupManager- Returns:
- a random sign-up token
-
canSignUpWith
public boolean canSignUpWith(String token)
Description copied from interface:SignupManagerReturn true if the given token is valid for a user to self-sign-up.- Specified by:
canSignUpWithin interfaceSignupManager- Parameters:
token- a sign-up token from a URL given to an invited user
-
isEmailSentOnInviteSignUp
public boolean isEmailSentOnInviteSignUp()
- Specified by:
isEmailSentOnInviteSignUpin interfaceSignupManager- Returns:
- true if notification emails should be sent to admins when a user signs themselves up.
-
isPublicSignupPermitted
public boolean isPublicSignupPermitted()
Description copied from interface:SignupManagerReturns true if users can sign themselves for this instance.- Specified by:
isPublicSignupPermittedin interfaceSignupManager
-
getRelativeSignupURL
public String getRelativeSignupURL()
- Specified by:
getRelativeSignupURLin interfaceSignupManager
-
getSignupURL
public String getSignupURL()
- Specified by:
getSignupURLin interfaceSignupManager
-
setEmailSentOnInviteSignUp
public void setEmailSentOnInviteSignUp(boolean notify)
- Specified by:
setEmailSentOnInviteSignUpin interfaceSignupManager- Parameters:
notify- true if notification emails should be sent to admins when a user signs themselves up, false if not
-
restorePreviousToken
public String restorePreviousToken()
Description copied from interface:SignupManagerRestore the previous private-signup token and returns it.- Specified by:
restorePreviousTokenin interfaceSignupManager
-
getSignUpToken
public String getSignUpToken()
Description copied from interface:SignupManagerGets the current sign-up token, or creates a new one and returns it.- Specified by:
getSignUpTokenin interfaceSignupManager- Returns:
- a random sign-up token
-
sendInvites
public NotificationSendResult sendInvites(SendUserInviteEvent event)
Description copied from interface:SignupManagerSend invitation emails with a message to a list of email addresses.- Specified by:
sendInvitesin interfaceSignupManager- Returns:
- the number of emails sent
-
sendConfirmationEmail
public void sendConfirmationEmail(String token, com.atlassian.user.User user)
Description copied from interface:SignupManagerSends a confirmation email to the given new user.- Specified by:
sendConfirmationEmailin interfaceSignupManager- Parameters:
token- the token that the user must validate againstuser- the new user
-
sendWelcomeEmail
public void sendWelcomeEmail(ConfluenceUser user)
Description copied from interface:SignupManagerSends a welcome email to the given new user.- Specified by:
sendWelcomeEmailin interfaceSignupManager- Parameters:
user- the new user
-
setPublicSignupMode
public void setPublicSignupMode()
- Specified by:
setPublicSignupModein interfaceSignupManager
-
setPrivateSignupMode
public void setPrivateSignupMode()
- Specified by:
setPrivateSignupModein interfaceSignupManager
-
setDomainRestrictedSignupMode
public void setDomainRestrictedSignupMode(String allowedDomains)
Description copied from interface:SignupManagerSet the domains that user's email address should belong to to be able to sign up.- Specified by:
setDomainRestrictedSignupModein interfaceSignupManager- Parameters:
allowedDomains- comma separated list of domains
-
getRestrictedDomains
public String getRestrictedDomains()
Description copied from interface:SignupManagerReturns comma separated list of domains. Users with email in those domains are allowed to sign up. Provided domain restricted sign up is enabled.- Specified by:
getRestrictedDomainsin interfaceSignupManager- Returns:
- comma separated list of domains
-
isEmailOnRestrictedDomain
public boolean isEmailOnRestrictedDomain(String email)
Description copied from interface:SignupManagerChecks if the given email address is on one of the configured restricted domains.- Specified by:
isEmailOnRestrictedDomainin interfaceSignupManager- Parameters:
email- the email address. Can be null.- Returns:
- true, if the domain name of the email matches one of the restricted domains.
-
isPendingConfirmation
public boolean isPendingConfirmation(com.atlassian.user.User user)
Description copied from interface:SignupManagerIs given user tried to sign up but hasn't confirmed their email yet?- Specified by:
isPendingConfirmationin interfaceSignupManager- Returns:
- true if the given user tried to sign up but hasn't confirmed their email yet.
-
isTokenForUserValid
public boolean isTokenForUserValid(com.atlassian.user.User user, String token)- Specified by:
isTokenForUserValidin interfaceSignupManager- Returns:
- true if given token a valid token that was issued when the given user tried to signup
-
doesUserHaveOutdatedSignupToken
public boolean doesUserHaveOutdatedSignupToken(com.atlassian.user.User user)
- Specified by:
doesUserHaveOutdatedSignupTokenin interfaceSignupManager- Returns:
- true if a given user has tried to sign up but hasn't confirmed their email within a reasonable time (1 month)
-
enableConfirmedUser
public void enableConfirmedUser(com.atlassian.user.User user) throws com.atlassian.crowd.exception.runtime.UserNotFoundException, com.atlassian.crowd.exception.runtime.OperationFailedException, com.atlassian.crowd.exception.InvalidUserException, com.atlassian.crowd.exception.OperationNotPermittedExceptionDescription copied from interface:SignupManagerEnable previously disabled user who signed up and confirmed their email.- Specified by:
enableConfirmedUserin interfaceSignupManager- Throws:
com.atlassian.crowd.exception.runtime.UserNotFoundExceptioncom.atlassian.crowd.exception.runtime.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidUserExceptioncom.atlassian.crowd.exception.OperationNotPermittedException
-
createUserPendingConfirmation
public String createUserPendingConfirmation(com.atlassian.user.User user, String password) throws com.atlassian.crowd.exception.runtime.OperationFailedException, com.atlassian.crowd.exception.InvalidUserException, com.atlassian.crowd.exception.InvalidCredentialException, com.atlassian.crowd.exception.OperationNotPermittedException
Description copied from interface:SignupManagerCreates a new user and marks them disabled pending their email confirmation?- Specified by:
createUserPendingConfirmationin interfaceSignupManager- Parameters:
user- the new userpassword- the password for the new user- Returns:
- the token that the user must validate against in order to confirm their email
- Throws:
com.atlassian.crowd.exception.runtime.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidUserExceptioncom.atlassian.crowd.exception.InvalidCredentialExceptioncom.atlassian.crowd.exception.OperationNotPermittedException
-
isDomainRestrictedSignupEnabled
public boolean isDomainRestrictedSignupEnabled()
- Specified by:
isDomainRestrictedSignupEnabledin interfaceSignupManager- Returns:
- true if sign up is enabled only for some specified domains
-
-