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
ConstructorsConstructorDescriptionBambooWebSudoManagerImpl(BambooAuthenticationContext bambooAuthenticationContext, BambooPermissionManager bambooPermissionManager, FeatureManager featureManager, WebSudoIpAllowlistService webSudoIpAllowlistService) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecuteRequest(javax.servlet.http.HttpServletRequest request) voidenforceWebSudoProtection(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, @Nullable org.apache.struts2.ActionInvocation invocation) Enforces web sudo protection for the given action request.getWebSudoSessionExpiry(@Nullable javax.servlet.http.HttpServletRequest request) Returns the expiry time of the current web sudo session, if one existsbooleanisUnableToHoldWebSudo(@Nullable javax.servlet.http.HttpServletRequest request) Checks if the current request is unable to hold a web sudo session.voidremoveWebSudoFromSession(@Nullable javax.servlet.http.HttpServletRequest request) Removes the web sudo attribute from the current session, if one existsvoidsetWebSudoSession(@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.voidwillExecuteWebSudoRequest(javax.servlet.http.HttpServletRequest request) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.sal.BambooWebSudoManager
enforceWebSudoProtection
-
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:
canExecuteRequestin interfacecom.atlassian.sal.api.websudo.WebSudoManager
-
enforceWebSudoProtection
public void enforceWebSudoProtection(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, @Nullable @Nullable org.apache.struts2.ActionInvocation invocation) Description copied from interface:BambooWebSudoManagerEnforces web sudo protection for the given action request.- Specified by:
enforceWebSudoProtectionin interfaceBambooWebSudoManager- Parameters:
request- the HTTP servlet requestresponse- the HTTP servlet responseinvocation- used to determine the redirect URL if the user is not authenticated
-
willExecuteWebSudoRequest
public void willExecuteWebSudoRequest(javax.servlet.http.HttpServletRequest request) throws com.atlassian.sal.api.websudo.WebSudoSessionException - Specified by:
willExecuteWebSudoRequestin 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:BambooWebSudoManagerSets the web sudo timestamp on the current session and the web sudo headers if the response is passed.- Specified by:
setWebSudoSessionin 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:BambooWebSudoManagerReturns the expiry time of the current web sudo session, if one exists- Specified by:
getWebSudoSessionExpiryin 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:BambooWebSudoManagerRemoves the web sudo attribute from the current session, if one exists- Specified by:
removeWebSudoFromSessionin interfaceBambooWebSudoManager- Parameters:
request- the current request
-
isUnableToHoldWebSudo
public boolean isUnableToHoldWebSudo(@Nullable @Nullable javax.servlet.http.HttpServletRequest request) Description copied from interface:BambooWebSudoManagerChecks 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:
isUnableToHoldWebSudoin interfaceBambooWebSudoManager- Parameters:
request- the current request- Returns:
falseif the request is able to hold a web sudo session,trueotherwise
-