Class HttpAuthUtil
- java.lang.Object
-
- jetbrains.buildServer.controllers.interceptors.auth.util.HttpAuthUtil
-
public class HttpAuthUtil extends Object
Utilities forHttpAuthenticationScheme
- Since:
- 8.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
LOGIN_PAGE_PROPERTY
-
Constructor Summary
Constructors Constructor Description HttpAuthUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getUnauthenticatedReason(javax.servlet.http.HttpServletRequest request)
Returns unauthenticated reason set for the request or null if no reason was setstatic HttpAuthenticationResult
sendAnswer(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String wwwAuthenticateHeader)
Sets status code "401", status message and needed headers in the response, keeps connectionstatic HttpAuthenticationResult
sendUnauthorized(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String reason, Set<HttpAuthenticationProtocol> protocols)
Sets status code "401", status message and needed headers in the responsestatic HttpAuthenticationResult
sendUnauthorized(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String reason, HttpAuthenticationProtocolsProvider protocolsProvider, Map<String,String> properties)
Sets status code "401", status message and needed headers in the responsestatic HttpAuthenticationResult
sendUnauthorized(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable e, Set<HttpAuthenticationProtocol> protocols)
Sets status code "401", status message and needed headers in the responsestatic HttpAuthenticationResult
sendUnauthorized(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable e, Set<HttpAuthenticationProtocol> protocols, String loginPageUrl)
Sets status code "401", status message and needed headers in the responsestatic HttpAuthenticationResult
sendUnauthorized(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable e, HttpAuthenticationProtocolsProvider protocolsProvider, Map<String,String> properties)
Sets status code "401", status message and needed headers in the responsestatic void
setUnauthenticatedReason(javax.servlet.http.HttpServletRequest request, String reason)
Sets unauthenticated reason for the request to be shown on login page
-
-
-
Field Detail
-
LOGIN_PAGE_PROPERTY
@NotNull public static final String LOGIN_PAGE_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
setUnauthenticatedReason
public static void setUnauthenticatedReason(@NotNull javax.servlet.http.HttpServletRequest request, @Nullable String reason)
Sets unauthenticated reason for the request to be shown on login page- Parameters:
request
- requestreason
- reason
-
getUnauthenticatedReason
@Nullable public static String getUnauthenticatedReason(@NotNull javax.servlet.http.HttpServletRequest request)
Returns unauthenticated reason set for the request or null if no reason was set- Parameters:
request
- request- Returns:
- see above
-
sendUnauthorized
@NotNull public static HttpAuthenticationResult sendUnauthorized(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @NotNull Throwable e, @NotNull HttpAuthenticationProtocolsProvider protocolsProvider, @NotNull Map<String,String> properties) throws IOException
Sets status code "401", status message and needed headers in the response- Parameters:
request
- requestresponse
- responsee
- exception to get error message fromprotocolsProvider
- provider of the protocols to specify in the response headersproperties
- properties for the protocol provider- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
sendUnauthorized
@NotNull public static HttpAuthenticationResult sendUnauthorized(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @NotNull Throwable e, @NotNull Set<HttpAuthenticationProtocol> protocols) throws IOException
Sets status code "401", status message and needed headers in the response- Parameters:
request
- requestresponse
- responsee
- exception to get error message fromprotocols
- protocols to specify in the response headers- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
sendUnauthorized
@NotNull public static HttpAuthenticationResult sendUnauthorized(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @NotNull Throwable e, @NotNull Set<HttpAuthenticationProtocol> protocols, @Nullable String loginPageUrl) throws IOException
Sets status code "401", status message and needed headers in the response- Parameters:
request
- requestresponse
- responsee
- exception to get error message fromprotocols
- protocols to specify in the response headersloginPageUrl
- optional URL to login page to include into the response for non browser clients- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
sendUnauthorized
@NotNull public static HttpAuthenticationResult sendUnauthorized(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @Nullable String reason, @NotNull HttpAuthenticationProtocolsProvider protocolsProvider, @NotNull Map<String,String> properties) throws IOException
Sets status code "401", status message and needed headers in the response- Parameters:
request
- requestresponse
- responsereason
- error messageprotocolsProvider
- provider of the protocols to specify in the response headersproperties
- properties for the protocol provider- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
sendUnauthorized
@NotNull public static HttpAuthenticationResult sendUnauthorized(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @Nullable String reason, @NotNull Set<HttpAuthenticationProtocol> protocols) throws IOException
Sets status code "401", status message and needed headers in the response- Parameters:
request
- requestresponse
- responsereason
- error messageprotocols
- protocols to specify in the response headers- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
sendAnswer
@NotNull public static HttpAuthenticationResult sendAnswer(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @NotNull String wwwAuthenticateHeader) throws IOException
Sets status code "401", status message and needed headers in the response, keeps connection- Parameters:
request
- requestresponse
- responsewwwAuthenticateHeader
- answer for client according to the used protocol- Returns:
HttpAuthenticationResult.unauthenticated()
- Throws:
IOException
- if I/O error occurred
-
-