EndpointPolicyProvider

mbauer83.zio_http_authorization.EndpointPolicyProvider$.EndpointPolicyProvider

Permits effectful retrieval of a matching AuthorizationPolicy given a Request as well as effectful registration of AuthorizationPolicies using a partial function from Request to a policy.

Both the retrieval and registration methods are polymorphic in the types of the User and Resource to which the policy applies.

A default policy is also required. This is used as a fallback when no matching policy is found.

Attributes

Note

To fail safe when no matching policy is found, it is strongly recommended to set the provided DenyAllPolicy as the default policy.

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def getPolicy[U <: User[_, _] : ClassTag, R <: Resource[_] : ClassTag](req: Request): ZIO[Any, Nothing, AuthorizationPolicy[U, R]]

An effect which always succeds with an appropriate AuthorizationPolicy given a zio.http.Request, with fallback to the defaultPolicy if no matching policy is found.

An effect which always succeds with an appropriate AuthorizationPolicy given a zio.http.Request, with fallback to the defaultPolicy if no matching policy is found.

Attributes

def registerPolicy[U <: User[_, _] : ClassTag, R <: Resource[_] : ClassTag](matcher: PartialFunction[Request, AuthorizationPolicy[U, R]]): ZIO[Any, Nothing, EndpointPolicyProvider]

Registers an AuthorizationPolicy with a partial function.

Registers an AuthorizationPolicy with a partial function.

Attributes

Abstract fields