AuthMiddleware

io.github.edadma.apion.AuthMiddleware

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class Auth(user: String, roles: Set[String])

Authentication context for requests

Authentication context for requests

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Config(secretKey: String, requireAuth: Boolean, excludePaths: Set[String], tokenRefreshThreshold: Long, maxTokenLifetime: Long, issuer: String, audience: Option[String])

Configuration for authentication middleware

Configuration for authentication middleware

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ErrorResponse(error: String, message: String, details: Option[String])

Error responses for authentication failures

Error responses for authentication failures

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

In-memory token store for demonstration

In-memory token store for demonstration

Attributes

Supertypes
trait TokenStore
class Object
trait Matchable
class Any
case class TokenPayload(sub: String, roles: Set[String], exp: Long, iat: Long, iss: String, aud: Option[String], jti: String)

Enhanced token payload with additional claims

Enhanced token payload with additional claims

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait TokenStore

Token storage and validation trait

Token storage and validation trait

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Value members

Concrete methods

def apply(config: Config, tokenStore: TokenStore): Handler

Main authentication middleware

Main authentication middleware

Attributes

def createAccessToken(subject: String, roles: Set[String], config: Config): String

Create a new access token

Create a new access token

Attributes

def createRefreshToken(subject: String, config: Config, validityPeriod: Long): String

Create a refresh token

Create a refresh token

Attributes

def logout(token: String, secretKey: String, tokenStore: TokenStore): Future[Result]

Logout mechanism to revoke tokens

Logout mechanism to revoke tokens

Attributes

def refreshToken(refreshToken: String, config: Config, tokenStore: TokenStore): Future[Result]

Refresh access token

Refresh access token

Attributes