- java.lang.Object
-
- io.helidon.security.AuthorizationResponse.Builder
-
- All Implemented Interfaces:
Builder<AuthorizationResponse>
,Supplier<AuthorizationResponse>
- Enclosing class:
- AuthorizationResponse
public static class AuthorizationResponse.Builder extends Object
Builder for custom Authorization responses.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthorizationResponse
build()
Create a new authorization response based on this builder.T
description(String description)
Set description of this security response failure.T
requestHeader(String header, String value)
Add a single-value header.T
requestHeader(String header, List<String> values)
Add a multi-value header.T
requestHeaders(Map<String,List<String>> headers)
Set additional/replacement headers for request.T
responseHeader(String header, String value)
Add a single-value header.T
responseHeader(String header, List<String> values)
Add a multi-value header.T
responseHeaders(Map<String,List<String>> headers)
Set additional/replacement headers for request.T
status(SecurityResponse.SecurityStatus status)
Set security status of this security response.T
statusCode(int statusCode)
Set a status code for failed statuses.T
throwable(Throwable exception)
Set throwable causing failure of the security request.
-
-
-
Method Detail
-
build
public AuthorizationResponse build()
Create a new authorization response based on this builder.- Returns:
- response based on this builder
-
statusCode
public T statusCode(int statusCode)
Set a status code for failed statuses. This is expected to use HTTP status codes. If an integration is done with a non-http protocol, you must map these status codes appropriately.- Parameters:
statusCode
- HTTP status code- Returns:
- updated builder instance
-
status
public T status(SecurityResponse.SecurityStatus status)
Set security status of this security response.- Parameters:
status
- Status to set- Returns:
- updated builder instance
-
description
public T description(String description)
Set description of this security response failure.- Parameters:
description
- Description to provide to called in case of failed security, or null if no information can be provided- Returns:
- updated builder instance
-
throwable
public T throwable(Throwable exception)
Set throwable causing failure of the security request.- Parameters:
exception
- Exception that caused failure- Returns:
- updated builder instance
-
requestHeaders
public T requestHeaders(Map<String,List<String>> headers)
Set additional/replacement headers for request.- Parameters:
headers
- map with headers- Returns:
- updated builder instance
-
requestHeader
public T requestHeader(String header, String value)
Add a single-value header. Note that if methodrequestHeaders(Map)
is called after this method, it will remove changes by this method.- Parameters:
header
- header namevalue
- header value- Returns:
- this instance
-
requestHeader
public T requestHeader(String header, List<String> values)
Add a multi-value header. Note that if methodrequestHeaders(Map)
is called after this method, it may remove changes by this method.- Parameters:
header
- header namevalues
- header values- Returns:
- this instance
-
responseHeaders
public T responseHeaders(Map<String,List<String>> headers)
Set additional/replacement headers for request.- Parameters:
headers
- map with headers- Returns:
- updated builder instance
-
responseHeader
public T responseHeader(String header, String value)
Add a single-value header. Note that if methodresponseHeaders(Map)
is called after this method, it will remove changes by this method.- Parameters:
header
- header namevalue
- header value- Returns:
- this instance
-
-