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 String
AUTHENTICATION_DETAILS_ATTRIBUTE
static String
GUEST_USER_PARAM
static String
RESET_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 SUser
checkPassword(String username, String password)
Attempts to authenticate using specified username and password and if authentication was successful returns corresponding User object.String
getDefaultLoginPageUrl(javax.servlet.http.HttpServletRequest request)
Returns default login page URL.String
getDefaultLogoutPageUrl(javax.servlet.http.HttpServletRequest request)
Returns the default logout URL.String
getLoginPageUrl(javax.servlet.http.HttpServletRequest request)
Returns URL to a page which should be used as login page in TeamCity.org.springframework.web.servlet.ModelAndView
getLoginView(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Returns view to show login page.String
getLogoutPageUrl(javax.servlet.http.HttpServletRequest request)
Returns the logout URLboolean
isGuestLoginByUrlRequest(javax.servlet.http.HttpServletRequest request)
Returns true if request parameters indicate that a guest login is initiated.User
login(String username, String password, javax.servlet.http.HttpServletRequest request)
Authenticates user by specified username and passwordSUser
login(ServerPrincipal principal, boolean forceRememberMe, AuthModule<? extends AuthModuleType> authModule, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Authenticates the specified userUser
login(UserCredentials userCredentials, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Authenticates user by specified credentialsUser
loginFromRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Verifies that authentication information provided with request is valid.void
logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Performs logout.void
logoutAllSessions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean terminateCurrentSession)
Performs logout of all other sessions of current user.SUser
refreshLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Updates login information in session and cookies if exist.void
rememberTwoFactorLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Stores information inRememberMe
about 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:LoginPageProvider
Returns URL to a page which should be used as login page in TeamCity.- Specified by:
getLoginPageUrl
in interfaceLoginPageProvider
- Returns:
- see above
-
getLogoutPageUrl
@NotNull public String getLogoutPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelEx
Returns the logout URL- Specified by:
getLogoutPageUrl
in 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:WebLoginModelEx
Returns view to show login page.- Specified by:
getLoginView
in interfaceWebLoginModelEx
- Returns:
- login view corresponding to this model
-
checkPassword
@NotNull public SUser checkPassword(String username, String password) throws AuthenticationFailedException
Description copied from interface:WebLoginModel
Attempts to authenticate using specified username and password and if authentication was successful returns corresponding User object.- Specified by:
checkPassword
in 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:WebLoginModel
Verifies that authentication information provided with request is valid.- Specified by:
loginFromRequest
in 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:WebLoginModel
Authenticates user by specified username and password- Specified by:
login
in 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:WebLoginModelEx
Authenticates user by specified credentials- Specified by:
login
in 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:WebLoginModelEx
Authenticates the specified user- Specified by:
login
in 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:WebLoginModel
Updates login information in session and cookies if exist.- Specified by:
refreshLogin
in 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:WebLoginModel
Returns true if request parameters indicate that a guest login is initiated.- Specified by:
isGuestLoginByUrlRequest
in 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:WebLoginModel
Returns default login page URL.- Specified by:
getDefaultLoginPageUrl
in interfaceWebLoginModel
- Parameters:
request
- current request- Returns:
- see above
-
getDefaultLogoutPageUrl
@NotNull public String getDefaultLogoutPageUrl(@NotNull javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebLoginModelEx
Returns the default logout URL.- Specified by:
getDefaultLogoutPageUrl
in 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:WebLoginModelEx
Stores information inRememberMe
about user provided in request. Should be called only on successful 2FA. Will do nothing if request does not contain user.- Specified by:
rememberTwoFactorLogin
in interfaceWebLoginModelEx
-
logout
public void logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:WebLoginModel
Performs logout.- Specified by:
logout
in 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:WebLoginModel
Performs logout of all other sessions of current user.- Specified by:
logoutAllSessions
in interfaceWebLoginModel
- Parameters:
request
- HTTP requestresponse
- HTTP response
-
-