Class WebLoginModelImpl
- java.lang.Object
-
- jetbrains.buildServer.controllers.login.WebLoginModelImpl
-
- All Implemented Interfaces:
LoginPageProvider,WebLoginModel,WebLoginModelEx,ServerExtension,TeamCityExtension
public class WebLoginModelImpl extends Object implements WebLoginModelEx
WebLoginModelEx implementation.- Author:
- Pavel.Sher Date: 17.03.2006
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUTHENTICATION_DETAILS_ATTRIBUTEstatic StringGUEST_USER_PARAMstatic StringRESET_INSECURE_PASSWORD_REQUIRED_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description WebLoginModelImpl(BuildServerEx buildServer, ServerLoginModel serverLoginModel, RememberMe rememberMe, ServerResponsibility serverResponsibility, SessionModel sessionModel, RegistrationInvitations registrationInvitations, DomainIsolationProtection domainIsolationProtection, TwoFactorPasswordManager twoFactorManager, UsersLoadBalancer usersLoadBalancer, PasswordComplexityChecker checker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SUsercheckPassword(String username, String password)Attempts to authenticate using specified username and password and if authentication was successful returns corresponding User object.StringgetDefaultLoginPageUrl(javax.servlet.http.HttpServletRequest request)Returns default login page URL.StringgetDefaultLogoutPageUrl(javax.servlet.http.HttpServletRequest request)Returns the default logout URL.StringgetLoginPageUrl(javax.servlet.http.HttpServletRequest request)Returns URL to a page which should be used as login page in TeamCity.org.springframework.web.servlet.ModelAndViewgetLoginView(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Returns view to show login page.StringgetLogoutPageUrl(javax.servlet.http.HttpServletRequest request)Returns the logout URLbooleanisGuestLoginByUrlRequest(javax.servlet.http.HttpServletRequest request)Returns true if request parameters indicate that a guest login is initiated.Userlogin(String username, String password, javax.servlet.http.HttpServletRequest request)Authenticates user by specified username and passwordSUserlogin(ServerPrincipal principal, boolean forceRememberMe, AuthModule<? extends AuthModuleType> authModule, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Authenticates the specified userUserlogin(UserCredentials userCredentials, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Authenticates user by specified credentialsUserloginFromRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Verifies that authentication information provided with request is valid.voidlogout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Performs logout.voidlogoutAllSessions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean terminateCurrentSession)Performs logout of all other sessions of current user.SUserrefreshLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Updates login information in session and cookies if exist.voidrememberTwoFactorLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Stores information inRememberMeabout user provided in request.
-
-
-
Field Detail
-
GUEST_USER_PARAM
public static final String GUEST_USER_PARAM
- See Also:
- Constant Field Values
-
RESET_INSECURE_PASSWORD_REQUIRED_ATTRIBUTE
public static final String RESET_INSECURE_PASSWORD_REQUIRED_ATTRIBUTE
- See Also:
- Constant Field Values
-
AUTHENTICATION_DETAILS_ATTRIBUTE
public static final String AUTHENTICATION_DETAILS_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WebLoginModelImpl
public WebLoginModelImpl(@NotNull BuildServerEx buildServer, @NotNull ServerLoginModel serverLoginModel, @NotNull RememberMe rememberMe, @NotNull ServerResponsibility serverResponsibility, @NotNull SessionModel sessionModel, @NotNull RegistrationInvitations registrationInvitations, @NotNull DomainIsolationProtection domainIsolationProtection, @NotNull TwoFactorPasswordManager twoFactorManager, @NotNull UsersLoadBalancer usersLoadBalancer, @NotNull PasswordComplexityChecker checker)
-
-
Method Detail
-
getLoginPageUrl
@NotNull public String getLoginPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:LoginPageProviderReturns URL to a page which should be used as login page in TeamCity.- Specified by:
getLoginPageUrlin interfaceLoginPageProvider- Returns:
- see above
-
getLogoutPageUrl
@NotNull public String getLogoutPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelExReturns the logout URL- Specified by:
getLogoutPageUrlin interfaceWebLoginModelEx- Parameters:
request- HTTP request- Returns:
- logout URL
-
getLoginView
@NotNull public org.springframework.web.servlet.ModelAndView getLoginView(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response)Description copied from interface:WebLoginModelExReturns view to show login page.- Specified by:
getLoginViewin interfaceWebLoginModelEx- Returns:
- login view corresponding to this model
-
checkPassword
@NotNull public SUser checkPassword(String username, String password) throws AuthenticationFailedException
Description copied from interface:WebLoginModelAttempts to authenticate using specified username and password and if authentication was successful returns corresponding User object.- Specified by:
checkPasswordin interfaceWebLoginModel- Parameters:
username- usernamepassword- password- Returns:
- User object, never null
- Throws:
AuthenticationFailedException- if authentication failed
-
loginFromRequest
@NotNull public User loginFromRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AuthenticationFailedException
Description copied from interface:WebLoginModelVerifies that authentication information provided with request is valid.- Specified by:
loginFromRequestin interfaceWebLoginModel- Parameters:
request- HTTP requestresponse- HTTP response- Returns:
- authorized User, never null
- Throws:
AuthenticationFailedException- if authentication failed
-
login
@NotNull public User login(String username, String password, javax.servlet.http.HttpServletRequest request) throws AuthenticationFailedException
Description copied from interface:WebLoginModelAuthenticates user by specified username and password- Specified by:
loginin interfaceWebLoginModel- Parameters:
username- usernamepassword- passwordrequest- HTTP request- Returns:
- authenticated User, never null
- Throws:
AuthenticationFailedException- if authentication failed
-
login
@NotNull public User login(@NotNull UserCredentials userCredentials, @NotNull javax.servlet.http.HttpServletRequest request, @Nullable javax.servlet.http.HttpServletResponse response) throws AuthenticationFailedException
Description copied from interface:WebLoginModelExAuthenticates user by specified credentials- Specified by:
loginin interfaceWebLoginModelEx- Parameters:
userCredentials- user credentialsrequest- HTTP requestresponse- HTTP response- Returns:
- authenticated User, never null
- Throws:
AuthenticationFailedException- if authentication failed
-
login
@NotNull public SUser login(@NotNull ServerPrincipal principal, boolean forceRememberMe, @NotNull AuthModule<? extends AuthModuleType> authModule, @NotNull javax.servlet.http.HttpServletRequest request, @Nullable javax.servlet.http.HttpServletResponse response) throws AuthenticationFailedException
Description copied from interface:WebLoginModelExAuthenticates the specified user- Specified by:
loginin interfaceWebLoginModelEx- Parameters:
principal- principalforceRememberMe- true, if login should be remembered even if there is no "remember" parameter in requestauthModule- authentication module used to loginrequest- HTTP requestresponse- HTTP response- Returns:
- authenticated user
- Throws:
AuthenticationFailedException
-
refreshLogin
@Nullable public SUser refreshLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:WebLoginModelUpdates login information in session and cookies if exist.- Specified by:
refreshLoginin interfaceWebLoginModel- Parameters:
request- HTTP requestresponse- HTTP response- Returns:
- authenticated User or null if user does not exist any more
-
isGuestLoginByUrlRequest
public boolean isGuestLoginByUrlRequest(javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelReturns true if request parameters indicate that a guest login is initiated.- Specified by:
isGuestLoginByUrlRequestin interfaceWebLoginModel- Parameters:
request- request- Returns:
- true if guest user login detected by request parameters
-
getDefaultLoginPageUrl
@NotNull public String getDefaultLoginPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelReturns default login page URL.- Specified by:
getDefaultLoginPageUrlin interfaceWebLoginModel- Parameters:
request- current request- Returns:
- see above
-
getDefaultLogoutPageUrl
@NotNull public String getDefaultLogoutPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelExReturns the default logout URL.- Specified by:
getDefaultLogoutPageUrlin interfaceWebLoginModelEx- Parameters:
request- HTTP request- Returns:
- logout URL
-
rememberTwoFactorLogin
public void rememberTwoFactorLogin(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response)Description copied from interface:WebLoginModelExStores information inRememberMeabout user provided in request. Should be called only on successful 2FA. Will do nothing if request does not contain user.- Specified by:
rememberTwoFactorLoginin interfaceWebLoginModelEx
-
logout
public void logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Description copied from interface:WebLoginModelPerforms logout.- Specified by:
logoutin interfaceWebLoginModel- Parameters:
request- HTTP requestresponse- HTTP response
-
logoutAllSessions
public void logoutAllSessions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean terminateCurrentSession)Description copied from interface:WebLoginModelPerforms logout of all other sessions of current user.- Specified by:
logoutAllSessionsin interfaceWebLoginModel- Parameters:
request- HTTP requestresponse- HTTP response
-
-