User

mbauer83.zio_http_authorization.User$
object User

Users are the basic subject of role-based authorization. They are generic in their type of UserId and tenant id.

Aside from their identity, users contain their assigned Roles and Permissions which can be checked by AuthorizationPolicies.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
User.type

Members list

Type members

Classlikes

case class GenericUser[I <: UserId, T <: TenantId](id: I, tenantId: Option[T], roles: Set[Role], permissions: Set[(Permission, ResourceSelector[_, _])]) extends User[I, T]

An all-purpose user-model for multi-tenant systems.

An all-purpose user-model for multi-tenant systems.

Attributes

Supertypes
trait User[I, T]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object User

Defines the DEFAULT user to be used when no user can be identified.

Defines the DEFAULT user to be used when no user can be identified.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
User.type
trait User[I <: UserId, T <: TenantId] extends Product, Serializable

A user in the bounded context of role-based authorization.

A user in the bounded context of role-based authorization.

tenantId is optional since superusers will not belong to any tenant. User-models for single-tenant systems can use Nothing as the type for the tenantId.

Attributes

Example

Example usage without tenantId

 case class ExampleUser(id: String, roles: Set[Role], permissions: Set[(Permission, ResourceSelector[_, _])], otherData: String) extends User[String, Nothing]:
   val tenantId: Option[Nothing] = None

Example usage with UUID for id and tenantId

 case class ExampleUser(
   id: UUID,
   tenantId: Option[UUID],
   roles: Set[Role],
   permissions: Set[(Permission, ResourceSelector[_, _])],
   otherData: String
 ) extends User[UUID, UUID]
Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class GenericUser[I, T]
trait UserWithoutTenantId[I <: UserId] extends User[I, Nothing]

Simplifies User-models for single-tenant systems.

Simplifies User-models for single-tenant systems.

Attributes

Supertypes
trait User[I, Nothing]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

type UserId = UUID | Symbol | String | Number | Product & Serializable

Users can be identified by a java.util.UUID, scala.Symbol, String, java.lang.Number, or a scala.Product with a scala.Serializable.

Users can be identified by a java.util.UUID, scala.Symbol, String, java.lang.Number, or a scala.Product with a scala.Serializable.

Attributes