Package com.atlassian.bamboo.sal
Class BambooWebSudoManagerImpl
java.lang.Object
com.atlassian.bamboo.sal.BambooWebSudoManagerImpl
- All Implemented Interfaces:
BambooWebSudoManager
,com.atlassian.sal.api.websudo.WebSudoManager
-
Field Summary
Fields inherited from interface com.atlassian.bamboo.sal.BambooWebSudoManager
WEB_SUDO_HEADER, WEB_SUDO_HEADER_VALUE_AUTHORISED, WEB_SUDO_HEADER_VALUE_REQUIRE_AUTHENTICATION, WEB_SUDO_REQUEST_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionBambooWebSudoManagerImpl
(BambooAuthenticationContext bambooAuthenticationContext, BambooPermissionManager bambooPermissionManager, FeatureManager featureManager, WebSudoIpAllowlistService webSudoIpAllowlistService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canExecuteRequest
(javax.servlet.http.HttpServletRequest request) void
enforceWebSudoProtection
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) getWebSudoSessionExpiry
(@Nullable javax.servlet.http.HttpServletRequest request) Returns the expiry time of the current web sudo session, if one existsboolean
isUnableToHoldWebSudo
(@Nullable javax.servlet.http.HttpServletRequest request) Checks if the current request is unable to hold a web sudo session.void
removeWebSudoFromSession
(@Nullable javax.servlet.http.HttpServletRequest request) Removes the web sudo attribute from the current session, if one existsvoid
setWebSudoSession
(@Nullable javax.servlet.http.HttpServletRequest request, @Nullable javax.servlet.http.HttpServletResponse response) Sets the web sudo timestamp on the current session and the web sudo headers if the response is passed.void
willExecuteWebSudoRequest
(javax.servlet.http.HttpServletRequest request)
-
Constructor Details
-
BambooWebSudoManagerImpl
public BambooWebSudoManagerImpl(BambooAuthenticationContext bambooAuthenticationContext, BambooPermissionManager bambooPermissionManager, FeatureManager featureManager, WebSudoIpAllowlistService webSudoIpAllowlistService)
-
-
Method Details
-
canExecuteRequest
public boolean canExecuteRequest(javax.servlet.http.HttpServletRequest request) - Specified by:
canExecuteRequest
in interfacecom.atlassian.sal.api.websudo.WebSudoManager
-
enforceWebSudoProtection
public void enforceWebSudoProtection(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) - Specified by:
enforceWebSudoProtection
in interfacecom.atlassian.sal.api.websudo.WebSudoManager
-
willExecuteWebSudoRequest
public void willExecuteWebSudoRequest(javax.servlet.http.HttpServletRequest request) throws com.atlassian.sal.api.websudo.WebSudoSessionException - Specified by:
willExecuteWebSudoRequest
in interfacecom.atlassian.sal.api.websudo.WebSudoManager
- Throws:
com.atlassian.sal.api.websudo.WebSudoSessionException
-
setWebSudoSession
public void setWebSudoSession(@Nullable @Nullable javax.servlet.http.HttpServletRequest request, @Nullable @Nullable javax.servlet.http.HttpServletResponse response) Description copied from interface:BambooWebSudoManager
Sets the web sudo timestamp on the current session and the web sudo headers if the response is passed.- Specified by:
setWebSudoSession
in interfaceBambooWebSudoManager
- Parameters:
request
- the current requestresponse
- the response for the current request
-
getWebSudoSessionExpiry
@NotNull public @NotNull Optional<Instant> getWebSudoSessionExpiry(@Nullable @Nullable javax.servlet.http.HttpServletRequest request) Description copied from interface:BambooWebSudoManager
Returns the expiry time of the current web sudo session, if one exists- Specified by:
getWebSudoSessionExpiry
in interfaceBambooWebSudoManager
- Parameters:
request
- the current request- Returns:
- the expiry time of the current web sudo session, if one exists
-
removeWebSudoFromSession
public void removeWebSudoFromSession(@Nullable @Nullable javax.servlet.http.HttpServletRequest request) Description copied from interface:BambooWebSudoManager
Removes the web sudo attribute from the current session, if one exists- Specified by:
removeWebSudoFromSession
in interfaceBambooWebSudoManager
- Parameters:
request
- the current request
-
isUnableToHoldWebSudo
public boolean isUnableToHoldWebSudo(@Nullable @Nullable javax.servlet.http.HttpServletRequest request) Description copied from interface:BambooWebSudoManager
Checks if the current request is unable to hold a web sudo session. Reasons for this could be that the feature is disabled, the user is not an admin, the user is making a request from a non-allowed IP address, etc.- Specified by:
isUnableToHoldWebSudo
in interfaceBambooWebSudoManager
- Parameters:
request
- the current request- Returns:
false
if the request is able to hold a web sudo session,true
otherwise
-