Mechanisms to determine if a user is authenticated and subsequently authorised to make api calls
To utilise this library add this to your sbt build file
"com.cjww-dev.libs" % "backend-auth_2.11" % "2.9.0"
Determines whether the user is authorised to access the requested resource.
class ExampleController @Inject()() extends Controller with Authorisation {
def exampleAction(id: String): Action[AnyContent] = Action.async {
implicit request =>
authorised(id) { context =>
Ok
}
}
}
Validates whether the user has an active session.
class ExampleController @Inject()() extends Controller with Authentication {
def exampleAction(id: String): Action[AnyContent] = Action.async {
implicit request =>
authenticated(id) {
Ok
}
}
}
This code is open source software licensed under the Apache 2.0 License