GenericAuthorizationPolicy

mbauer83.zio_http_authorization.AuthorizationPolicy$.GenericAuthorizationPolicy
class GenericAuthorizationPolicy(val requiredRoles: Set[Role], val requiredPermissions: Set[String | Symbol]) extends AuthorizationPolicy[User[_, _], Resource[_]]

An AuthorizationPolicy that authorizes access if and only if the user has all of the required roles and all of the required permissions.

Attributes

Graph
Supertypes
trait AuthorizationPolicy[User[_, _], Resource[_]]
class Object
trait Matchable
class Any

Members list

Type members

Inherited types

type ResourceType = R

Attributes

Inherited from:
AuthorizationPolicy
type UserType = U

Attributes

Inherited from:
AuthorizationPolicy

Value members

Concrete methods

def authorized[Res <: Resource[_] | Iterable[Resource[_]]](user: User[_, _])(resource: Res): ZIO[Any, UserNotAuthorizedForResourceException[_], Res]

An effect which either fails with a UserNotAuthorizedForResourceException or succeeds with the resource if the user is authorized to access the resource.

An effect which either fails with a UserNotAuthorizedForResourceException or succeeds with the resource if the user is authorized to access the resource.

If the resource is an scala.collection.Iterable, the effect must fail if and only if the user is not authorized to access any of the resources in the collection. Otherwise, it must succeed with a filtered version of the resource.

Attributes

Concrete fields