Skip to content
Snippets Groups Projects
Commit 04ca8aed authored by Felipe D'Abrantes's avatar Felipe D'Abrantes
Browse files

Use authentication middleware in POST/PUT endpoints

parent 15f125ac
No related branches found
No related tags found
1 merge request!14Add endpoints to manage Dailies
......@@ -5,7 +5,7 @@ import play.api.mvc._
import play.api.libs.json.{JsValue, JsLookupResult}
import models.{Daily}
import models.actions.{AuthenticatedUserAction}
import models.actions.{AuthenticatedUserAction, AuthenticationRequest}
import models.exceptions.{ConflictException, NotFoundException, InvalidRequestBodyException, InvalidQueryParameterException}
import scala.concurrent.TimeoutException
......@@ -79,7 +79,7 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents,
/**
* Create an Action to create a Daily.
*/
def create() = Action { implicit request: Request[AnyContent] =>
def create() = authenticatedUserAction { implicit request: AuthenticationRequest[AnyContent] =>
println("DailyController:create")
try {
......@@ -98,7 +98,7 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents,
/**
* Create an Action to like a Daily.
*/
def like() = Action { implicit request: Request[AnyContent] =>
def like() = authenticatedUserAction { implicit request: AuthenticationRequest[AnyContent] =>
println("DailyController:like")
try {
......@@ -118,7 +118,7 @@ class DailyController @Inject()(val controllerComponents: ControllerComponents,
/**
* Create an Action to unlike a Daily.
*/
def unlike() = Action { implicit request: Request[AnyContent] =>
def unlike() = authenticatedUserAction { implicit request: AuthenticationRequest[AnyContent] =>
println("DailyController:unlike")
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment