HistoryEndpoints

org.mbari.oni.endpoints.HistoryEndpoints
class HistoryEndpoints(entityManagerFactory: EntityManagerFactory, fastPhylogenyService: FastPhylogenyService)(using jwtService: JwtService, executionContext: ExecutionContext) extends Endpoints

Attributes

Graph
Supertypes
trait Endpoints
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def all: List[Endpoint[_, _, _, _, _]]

Attributes

Definition Classes
override def allImpl: List[ServerEndpoint[Any, Future]]

Attributes

Definition Classes

Inherited methods

def handleErrors[T](f: => Either[Throwable, T]): Either[ErrorMsg, T]

Attributes

Inherited from:
Endpoints
def handleErrorsAsync[T](f: => Either[Throwable, T])(using ec: ExecutionContext): Future[Either[ErrorMsg, T]]

Attributes

Inherited from:
Endpoints
def handleOption[T](f: => Option[T]): Either[ErrorMsg, T]

Attributes

Inherited from:
Endpoints
def handleOptionAsync[T](f: => Option[T])(using executionContext: ExecutionContext): Future[Either[ErrorMsg, T]]

Attributes

Inherited from:
Endpoints
def handleSecureErrors[T](f: => Either[Throwable, T]): Either[ErrorMsg, T]

Like handleErrors but also maps access errors: missing credentials become Unauthorized (401) and any other AccessException (a known user who isn't allowed to do this) becomes Forbidden (403). Only use this with endpoints built from secureEndpoint, since openEndpoint does not declare those error variants.

Like handleErrors but also maps access errors: missing credentials become Unauthorized (401) and any other AccessException (a known user who isn't allowed to do this) becomes Forbidden (403). Only use this with endpoints built from secureEndpoint, since openEndpoint does not declare those error variants.

Attributes

Inherited from:
Endpoints
def handleSecureErrorsAsync[T](f: => Either[Throwable, T])(using ec: ExecutionContext): Future[Either[ErrorMsg, T]]

Attributes

Inherited from:
Endpoints
def resolveCaller(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]])(using jwtService: JwtService): Either[ErrorMsg, Caller]

Works out who is calling, for endpoints whose rules depend on both the caller and the request (e.g. what's being changed). A user's account, including their role, is looked up with findUser rather than trusted from the token, so a user who has been demoted can't keep using a still-valid token.

Works out who is calling, for endpoints whose rules depend on both the caller and the request (e.g. what's being changed). A user's account, including their role, is looked up with findUser rather than trusted from the token, so a user who has been demoted can't keep using a still-valid token.

Attributes

Returns

Caller.ApiKey for an API-key token, Caller.User for a user login, or an error: 401 for a missing or invalid token or a user that no longer exists, 500 if the user couldn't be looked up

Inherited from:
Endpoints
def resolveCallerAsync(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]])(using jwtService: JwtService, executionContext: ExecutionContext): Future[Either[ErrorMsg, Caller]]

Attributes

Inherited from:
Endpoints
def verify(jwtOpt: Option[String])(using jwtService: JwtService): Identity[Either[Unauthorized, Unit]]

Attributes

Inherited from:
Endpoints
def verifyApiKeyOrUser(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]], allowed: UserAccount => Boolean)(using jwtService: JwtService): Either[ErrorMsg, Unit]

Security logic for endpoints that accept either an API-key token (issued by JwtService.authorize) or a logged-in user whose current role satisfies allowed. The user's role is looked up with findUser rather than trusted from the token's claims, so a user who has been demoted can't keep using a still-valid token.

Security logic for endpoints that accept either an API-key token (issued by JwtService.authorize) or a logged-in user whose current role satisfies allowed. The user's role is looked up with findUser rather than trusted from the token's claims, so a user who has been demoted can't keep using a still-valid token.

Value parameters

allowed

Returns true if the user may call the endpoint

findUser

Looks up a user account by name (normally UserAccountService.findByUserName)

Attributes

Inherited from:
Endpoints
def verifyApiKeyOrUserAsync(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]], allowed: UserAccount => Boolean)(using jwtService: JwtService, executionContext: ExecutionContext): Future[Either[ErrorMsg, Unit]]

Attributes

Inherited from:
Endpoints
def verifyAsync(jwtOpt: Option[String])(using jwtService: JwtService, executionContext: ExecutionContext): Future[Either[Unauthorized, Unit]]

Attributes

Inherited from:
Endpoints
def verifyLogin(jwtOpt: Option[String])(using jwtService: JwtService): Identity[Either[Unauthorized, UserAccount]]

Attributes

Inherited from:
Endpoints
def verifyLoginAsync(jwtOpt: Option[String])(using jwtService: JwtService, executionContext: ExecutionContext): Future[Either[Unauthorized, UserAccount]]

Attributes

Inherited from:
Endpoints
def verifyUser(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]], allowed: UserAccount => Boolean)(using jwtService: JwtService): Either[ErrorMsg, Unit]

Like verifyApiKeyOrUser but API-key tokens are rejected: only a logged-in user whose current role (looked up with findUser, not trusted from the token) satisfies allowed may call the endpoint.

Like verifyApiKeyOrUser but API-key tokens are rejected: only a logged-in user whose current role (looked up with findUser, not trusted from the token) satisfies allowed may call the endpoint.

Attributes

Inherited from:
Endpoints
def verifyUserAsync(jwtOpt: Option[String], findUser: String => Either[Throwable, Option[UserAccount]], allowed: UserAccount => Boolean)(using jwtService: JwtService, executionContext: ExecutionContext): Future[Either[ErrorMsg, Unit]]

Attributes

Inherited from:
Endpoints

Concrete fields

val approveEndpoint: Endpoint[Option[String], Long, ErrorMsg, ExtendedHistory, Any]
val approveEndpointImpl: ServerEndpoint[Any, Future]
val approvedCountEndpoint: Endpoint[Unit, Unit, ErrorMsg, Count, Any]
val approvedCountEndpointImpl: ServerEndpoint[Any, Future]
val approvedEndpoints: Endpoint[Unit, (Paging, Option[String]), ErrorMsg, Page[Seq[ExtendedHistory]], Any]
val approvedEndpointsImpl: ServerEndpoint[Any, Future]
val deleteEndpoint: Endpoint[Option[String], Long, ErrorMsg, Unit, Any]
val deleteEndpointImpl: ServerEndpoint[Any, Future]
val findByConceptNameEndpoint: Endpoint[Unit, String, ErrorMsg, Seq[ExtendedHistory], Any]
val findByConceptNameEndpointImpl: ServerEndpoint[Any, Future]
val findByIdEndpoint: Endpoint[Unit, Long, ErrorMsg, ExtendedHistory, Any]
val findByIdEndpointImpl: ServerEndpoint[Any, Future]
val pendingCountEndpoint: Endpoint[Unit, Unit, ErrorMsg, Count, Any]
val pendingCountEndpointImpl: ServerEndpoint[Any, Future]
val pendingEndpoint: Endpoint[Unit, (Paging, Option[String]), ErrorMsg, Page[Seq[ExtendedHistory]], Any]
val pendingEndpointImpl: ServerEndpoint[Any, Future]
val rejectEndpoint: Endpoint[Option[String], Long, ErrorMsg, ExtendedHistory, Any]
val rejectEndpointImpl: ServerEndpoint[Any, Future]

Inherited fields

The 401 message when a request that needs a logged-in user or an API key token arrives without one

The 401 message when a request that needs a logged-in user or an API key token arrives without one

Attributes

Inherited from:
Endpoints
val baseEndpoint: Endpoint[Unit, Unit, Unit, Unit, Any]

Attributes

Inherited from:
Endpoints
val log: Logger

Attributes

Inherited from:
Endpoints
val openEndpoint: Endpoint[Unit, Unit, ErrorMsg, Unit, Any]

Attributes

Inherited from:
Endpoints
val paging: EndpointInput[Paging]

Attributes

Inherited from:
Endpoints
val secureEndpoint: Endpoint[Option[String], Unit, ErrorMsg, Unit, Any]

Attributes

Inherited from:
Endpoints

Implicits

Inherited implicits

implicit def sConcept: Schema[Concept]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptCreate: Schema[ConceptCreate]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptDelete: Schema[ConceptDelete]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptMetadata: Schema[ConceptMetadata]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptName: Schema[RawConceptName]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptNameCreate: Schema[ConceptNameCreate]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptNameUpdate: Schema[ConceptNameUpdate]

Attributes

Inherited from:
Endpoints
implicit lazy val sConceptUpdate: Schema[ConceptUpdate]

Attributes

Inherited from:
Endpoints
implicit lazy val sCount: Schema[Count]

Attributes

Inherited from:
Endpoints
implicit lazy val sDoi: Schema[ReferenceQuery]

Attributes

Inherited from:
Endpoints
implicit lazy val sExtendedHistory: Schema[ExtendedHistory]

Attributes

Inherited from:
Endpoints
implicit lazy val sInstant: Schema[Instant]

Attributes

Inherited from:
Endpoints
implicit lazy val sLinkCreate: Schema[LinkCreate]

Attributes

Inherited from:
Endpoints
implicit lazy val sLinkUpdate: Schema[LinkUpdate]

Attributes

Inherited from:
Endpoints
implicit lazy val sMedia: Schema[Media]

Attributes

Inherited from:
Endpoints
implicit lazy val sMediaCreate: Schema[MediaCreate]

Attributes

Inherited from:
Endpoints
implicit lazy val sMediaUpdate: Schema[MediaUpdate]

Attributes

Inherited from:
Endpoints
implicit lazy val sPageSeqExtendedHistory: Schema[Page[Seq[ExtendedHistory]]]

Attributes

Inherited from:
Endpoints
implicit lazy val sPageSeqReference: Schema[Page[Seq[Reference]]]

Attributes

Inherited from:
Endpoints
implicit lazy val sPageSeqString: Schema[Page[Seq[String]]]

Attributes

Inherited from:
Endpoints
implicit lazy val sPaging: Schema[Paging]

Attributes

Inherited from:
Endpoints
implicit lazy val sPrefNode: Schema[PrefNode]

Attributes

Inherited from:
Endpoints
implicit lazy val sPrefNodeUpdate: Schema[PrefNodeUpdate]

Attributes

Inherited from:
Endpoints
implicit lazy val sRank: Schema[Rank]

Attributes

Inherited from:
Endpoints
implicit def sRawConcept: Schema[RawConcept]

Attributes

Inherited from:
Endpoints
implicit lazy val sReference: Schema[Reference]

Attributes

Inherited from:
Endpoints
implicit lazy val sReferenceUpdate: Schema[ReferenceUpdate]

Attributes

Inherited from:
Endpoints

Attributes

Inherited from:
Endpoints

Attributes

Inherited from:
Endpoints
implicit def sSerdeConcept: Schema[SerdeConcept]

Attributes

Inherited from:
Endpoints
implicit lazy val sSort: Schema[Sort]

Attributes

Inherited from:
Endpoints
implicit lazy val sURI: Schema[URI]

Attributes

Inherited from:
Endpoints
implicit lazy val sURL: Schema[URL]

Attributes

Inherited from:
Endpoints
implicit lazy val sUserAccount: Schema[UserAccount]

Attributes

Inherited from:
Endpoints
implicit lazy val sUserAccountCreate: Schema[UserAccountCreate]

Attributes

Inherited from:
Endpoints
implicit lazy val sUserAccountInfo: Schema[UserAccountInfo]

Attributes

Inherited from:
Endpoints
implicit lazy val sUserAccountUpdate: Schema[UserAccountUpdate]

Attributes

Inherited from:
Endpoints