PartialServerEndpointWithSecurityOutput
An endpoint with the security logic provided, and the main logic yet unspecified. See Endpoint.serverSecurityLogicWithOutput.
The provided security part of the server logic transforms inputs of type SECURITY_INPUT
, either to an error of type ERROR_OUTPUT
, or
to a tuple consisting of values of types SECURITY_OUPUT
and PRINCIPAL
.
The part of the server logic which is not provided, will have to transform both PRINCIPAL
and the rest of the input INPUT
either
into an error, or a value of type OUTPUT
. The response is then built from SECURITY_OUTPUT
and OUTPUT
combined.
Inputs/outputs can be added to partial endpoints as to regular endpoints. The shape of the error outputs can be adjusted in a limited
way, by adding new error output variants, similar as if they were defined using Tapir.oneOf; the variants and the existing error
outputs should usually have a common supertype (other than Any
). Hence, it's possible to create a base, secured input, and then
specialise it with inputs, outputs and logic as needed.
- Type parameters:
- ERROR_OUTPUT
Error output parameter types.
- F
The effect type used in the provided partial server logic.
- INPUT
Input parameter types.
- OUTPUT
Output parameter types.
- PRINCIPAL
The type of the value returned by the security logic.
- R
The capabilities that are required by this endpoint's inputs/outputs.
Any
, if no requirements.- SECURITY_INPUT
Security input parameter types, which the security logic accepts and returns a
PRINCIPAL
or an errorERROR_OUTPUT
.- SECURITY_OUTPUT
Security output parameter types.
Type members
Types
Value members
Concrete methods
Inherited methods
Adds a new error variant, where the current error output is represented as a Left
, and the given one as a Right
.
Adds a new error variant, where the current error output is represented as a Left
, and the given one as a Right
.
- Inherited from:
- EndpointErrorOutputVariantsOps
Appends a new error output variant.
Appends a new error output variant.
A variant for the current endpoint output will be created using the given Tapir.oneOfVariant. This is needed to capture the logic
which allows deciding if a run-time value is applicable to a variant. If the erasure of the E
type is different from E
, there will
be a compile-time failure, as no such run-time check is possible. In this case, use errorOutVariantsFromCurrent and create a
variant using one of the other variant factory methods (e.g. Tapir.oneOfVariantValueMatcher).
During encoding/decoding, the new o
variant will be checked after the current variant.
More specifically, the current error output is replaced with a Tapir.oneOf output, where:
- the first output variant is the current variant:
oneOfVariant(errorOutput)
- the second output variant is the given
o
Usage example:
sealed trait Parent
case class Child1(v: String) extends Parent
case class Child2(v: String) extends Parent
val e: PublicEndpoint[Unit, Parent, Unit, Any] = endpoint
.errorOut(stringBody.mapTo[Child1])
.errorOutVariant[Parent](oneOfVariant(stringBody.mapTo[Child2]))
Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using EndpointServerLogicOps.serverSecurityLogic.
- Type parameters:
- E2
A common supertype of the new variant and the current output
E
.
- Value parameters:
- o
The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.
- Inherited from:
- EndpointErrorOutputVariantsOps
Same as errorOutVariant, but allows appending multiple variants in one go.
Same as errorOutVariant, but allows appending multiple variants in one go.
- Inherited from:
- EndpointErrorOutputVariantsOps
Replace the error output with a Tapir.oneOf output, using the variants returned by variants
. The current output should be
included in one of the returned variants.
Replace the error output with a Tapir.oneOf output, using the variants returned by variants
. The current output should be
included in one of the returned variants.
Allows creating the variant list in a custom order, placing the current variant in an arbitrary position, and using default variants if necessary.
Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using EndpointServerLogicOps.serverSecurityLogic.
- Type parameters:
- E2
A common supertype of the new variant and the current output
E
.
- Inherited from:
- EndpointErrorOutputVariantsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointErrorOutputVariantsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointInputsMacros
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsMacros
The method defined in a fixed method input in this endpoint, if any (using e.g. EndpointInputsOps.get or EndpointInputsOps.post).
The method defined in a fixed method input in this endpoint, if any (using e.g. EndpointInputsOps.get or EndpointInputsOps.post).
- Inherited from:
- EndpointMetaOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointInputsOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsOps
- Inherited from:
- EndpointOutputsOps
Renders endpoint path, by default all parametrised path and query components are replaced by {param_name} or {paramN}, e.g. for
Renders endpoint path, by default all parametrised path and query components are replaced by {param_name} or {paramN}, e.g. for
endpoint.in("p1" / path[String] / query[String]("par2"))
returns /p1/{param1}?par2={par2}
- Value parameters:
- includeAuth
Should authentication inputs be included in the result.
- Inherited from:
- EndpointMetaOps
Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.)
Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.)
- Inherited from:
- EndpointMetaOps
Detailed description of the endpoint, with inputs/outputs represented in the same order as originally defined, including mapping information.
Detailed description of the endpoint, with inputs/outputs represented in the same order as originally defined, including mapping information.
- Inherited from:
- EndpointMetaOps
Equivalent to .toString
, shows the whole case class structure.
Equivalent to .toString
, shows the whole case class structure.
- Inherited from:
- EndpointMetaOps
Deprecated and Inherited methods
- Deprecated
[Since version 0.19.0]
- Inherited from:
- EndpointMetaOps