Package io.helidon.security
Class SecurityRequestBuilder<T extends SecurityRequestBuilder<T>>
- java.lang.Object
-
- io.helidon.security.SecurityRequestBuilder<T>
-
- Type Parameters:
T
- Type of the builder, used to enable extensibility of this builder
- Direct Known Subclasses:
OutboundSecurityClientBuilder
,SecurityClientBuilder
public class SecurityRequestBuilder<T extends SecurityRequestBuilder<T>> extends Object
Fluent API to build a security request.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SecurityRequest
buildRequest()
Build the security request.T
explicitProvider(String providerName)
Use an explicit provider.T
object(Object resource)
Put object to this request.T
object(String key, Object object)
Bind object to a specific name.T
object(String key, Supplier<Object> object)
Bind object supplier to a specific name.T
object(Supplier<Object> resource)
Put object supplier to this request.T
optional(boolean optional)
Set that security is optional.T
requestMessage(Entity entity)
Set the request message to use when security provider requires access to it.T
responseMessage(Entity entity)
Set the response message to use when security provider requires access to it.T
tracingSpan(Span span)
Deprecated.to be removed in 2.0, now needed for backward compatibilityT
tracingSpan(SpanContext spanContext)
Tracing span to support Open tracing.
-
-
-
Method Detail
-
object
public T object(Object resource)
Put object to this request. Creates a default mapping to name "object".- Parameters:
resource
- resource instance to be available to security provider- Returns:
- updated builder instance
-
object
public T object(Supplier<Object> resource)
Put object supplier to this request. Creates a default mapping to name "object".- Parameters:
resource
- supplier of resource instance to be available to security provider- Returns:
- updated builder instance
-
object
public T object(String key, Object object)
Bind object to a specific name. Example: a security policy for move operation expects source object bound to "object" and target object bound to "target" you could achieve this by callingobject(sourceInstance)
to bind the "object" part of the statement andobject("target", targetInstance)
to bind the "target" part of the statement- Parameters:
key
- key to bind this object underobject
- resource instance- Returns:
- updated builder instance
-
object
public T object(String key, Supplier<Object> object)
Bind object supplier to a specific name. Example: a security policy for move operation expects source object bound to "object" and target object bound to "target" you could achieve this by callingobject(sourceInstance)
to bind the "object" part of the statement andobject("target", targetInstance)
to bind the "target" part of the statement- Parameters:
key
- key to bind this object underobject
- supplier of resource instance- Returns:
- updated builder instance
-
tracingSpan
@Deprecated public T tracingSpan(Span span)
Deprecated.to be removed in 2.0, now needed for backward compatibilityTracing span to support Open tracing. Provider developer can add additional spans as children of this span to trace their progress.- Parameters:
span
- span of current security request (e.g. authentication, authorization or outbound)- Returns:
- updated builder instance
- See Also:
GlobalTracer.get()
,Tracer.buildSpan(String)
-
tracingSpan
public T tracingSpan(SpanContext spanContext)
Tracing span to support Open tracing. Provider developer can add additional spans as children of this span to trace their progress.- Parameters:
spanContext
- span of current security request (e.g. authentication, authorization or outbound, or any parent if these are not traced)- Returns:
- updated builder instance
- See Also:
GlobalTracer.get()
,Tracer.buildSpan(String)
-
explicitProvider
public T explicitProvider(String providerName)
Use an explicit provider.- Parameters:
providerName
- Name of a configuredSecurityProvider
- Returns:
- updated request builder instance
-
optional
public T optional(boolean optional)
Set that security is optional. Required is default.- Parameters:
optional
- set to true to make this security request optional- Returns:
- this instance
-
requestMessage
public T requestMessage(Entity entity)
Set the request message to use when security provider requires access to it.- Parameters:
entity
- Message to use, may be null (e.g. for requests without entity)- Returns:
- updated builder instance
-
responseMessage
public T responseMessage(Entity entity)
Set the response message to use when security provider requires access to it.- Parameters:
entity
- Message to use, may be null (e.g. for responses without entity)- Returns:
- updated builder instance
-
buildRequest
public SecurityRequest buildRequest()
Build the security request. Not using name "build" on purpose, so overriding classes can build their expected type.- Returns:
- Security request built from this builder.
-
-