Package com.atlassian.sal.api.websudo
Interface WebSudoManager
public interface WebSudoManager
Allows the client to request WebSudo protection from the host application.
Usage pattern:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
try {
webSudoManager.willExecuteWebSudoRequest(request);
// do something
} catch(WebSudoSessionException wes) {
webSudoManager.enforceWebSudoProtection(request, response);
}
}
- Since:
- 2.2
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecuteRequest(javax.servlet.http.HttpServletRequest request) Check whether this request can be executed.voidenforceWebSudoProtection(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Ensure that the current request is protected by a WebSudo session.voidwillExecuteWebSudoRequest(javax.servlet.http.HttpServletRequest request) Mark the current request as a request for a WebSudo protected resource.
-
Method Details
-
canExecuteRequest
boolean canExecuteRequest(javax.servlet.http.HttpServletRequest request) Check whether this request can be executed. This checks if the request is already part of a WebSudo session or if WebSudo is enabled at all.Calling this method has no side effects.
- Parameters:
request- the currentHttpServletRequest- Returns:
trueif this request is protected by a WebSudo session or WebSudo is disabled,falseotherwise.
-
enforceWebSudoProtection
void enforceWebSudoProtection(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Ensure that the current request is protected by a WebSudo session. Typically this will result in a redirect to a WebSudo form which in turn redirects to the original request.This is a no op if this request is already protected by a WebSudo session (i.e.
canExecuteRequest(javax.servlet.http.HttpServletRequest)would return true).- Parameters:
request- the currentHttpServletRequestresponse- the currentHttpServletResponse
-
willExecuteWebSudoRequest
void willExecuteWebSudoRequest(javax.servlet.http.HttpServletRequest request) throws WebSudoSessionException Mark the current request as a request for a WebSudo protected resource.Throws a
WebSudoSessionExceptionif the currentrequestis not protected by WebSudo.This notifies the host application that the
requestis a request for a WebSudp protected resource.- Parameters:
request- the currentHttpServletRequest- Throws:
WebSudoSessionException- if the currentrequestis not protected by WebSudo.- Since:
- 2.2.0-beta10
-