Mechanisms to determine if a user is authenticated and subsequently authorised to see a page
To utilise this library add this to your sbt build file
"com.cjww-dev.libs" % "authorisation_2.11" % "1.12.0"
Extend a class with Actions and utilise authorisedFor() to secure an action.
If the user is not authorised they will be directed to the specified URL provided in authorisedFor()
class ExampleController @Inject()(val authConnector: AuthConnector) extends Controller with Actions {
def exampleAction: Action[AnyContent] = authorisedFor("/login/page").async {
implicit user =>
implicit request =>
Future.successful(Ok)
}
}
This code is open source software licensed under the Apache 2.0 License