-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#34] begin implementation of silhouette, the project builds and appl…
…ication is launched
- Loading branch information
Vincent Doba
committed
Oct 19, 2014
1 parent
329b173
commit 2bec82e
Showing
55 changed files
with
431 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
import play.api.mvc._ | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
class ActivityController(override implicit val env: RuntimeEnvironment[BasicProfile]) extends Controller | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
class ActivityController(override implicit val env: Environment[User, SessionAuthenticator]) extends Silhouette[User, SessionAuthenticator] | ||
{ | ||
|
||
def index = SecuredAction(WithDomain()) { | ||
def index = SecuredAction { | ||
implicit request => | ||
Ok(views.html.activity.index(request.user)) | ||
Ok(views.html.activity.index(request.identity)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import play.api.mvc.Controller | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
class Application(override implicit val env: RuntimeEnvironment[BasicProfile]) | ||
extends Controller | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
class Application(override implicit val env: Environment[User, SessionAuthenticator]) | ||
extends Silhouette[User, SessionAuthenticator] { | ||
|
||
def index = SecuredAction(WithDomain()) { | ||
def index = SecuredAction() { | ||
implicit request => | ||
Ok(views.html.index(request.user)).flashing("welcome" -> "connard") | ||
Ok(views.html.index(request.identity)).flashing("welcome" -> "connard") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package controllers | ||
|
||
import com.mohiva.play.silhouette.api.{LogoutEvent, Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
import scala.concurrent.Future | ||
|
||
class AuthenticationController(override implicit val env: Environment[User, SessionAuthenticator]) | ||
extends Silhouette[User, SessionAuthenticator] { | ||
|
||
def signOut = SecuredAction.async { implicit request => | ||
val result = Future.successful(Redirect(routes.Application.index)) | ||
env.eventBus.publish(LogoutEvent(request.identity, request, request2lang)) | ||
env.authenticatorService.discard(request.authenticator, result) | ||
} | ||
|
||
def signIn() = play.mvc.Results.TODO | ||
|
||
def signUp() = play.mvc.Results.TODO | ||
|
||
def authenticate(provider: String) = play.mvc.Results.TODO | ||
|
||
def credentials() = play.mvc.Results.TODO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain._ | ||
import play.api.mvc._ | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
|
||
// Reactive Mongo imports | ||
|
||
// Reactive Mongo plugin, including the JSON-specialized collection | ||
import play.modules.reactivemongo.MongoController | ||
|
||
|
||
class ClientController(override implicit val env: RuntimeEnvironment[BasicProfile]) extends Controller | ||
class ClientController(override implicit val env: Environment[User, SessionAuthenticator]) extends Silhouette[User, SessionAuthenticator] | ||
with InvoiceSerializer | ||
with MongoController | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
{ | ||
|
||
def clientsView = SecuredAction(WithDomain()) { | ||
def clientsView = SecuredAction { | ||
implicit request => | ||
Ok(views.html.clients(request.user)) | ||
Ok(views.html.clients(request.identity)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import play.api.mvc._ | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
class ConfigurationController(override implicit val env: RuntimeEnvironment[BasicProfile]) extends Controller | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
class ConfigurationController(override implicit val env: Environment[User, SessionAuthenticator]) extends Silhouette[User, SessionAuthenticator] | ||
{ | ||
|
||
def index = SecuredAction(WithDomain()) { | ||
def index = SecuredAction { | ||
implicit request => | ||
Ok(views.html.configurations.index(request.user)) | ||
Ok(views.html.configurations.index(request.identity)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import play.api.mvc._ | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
class ContributionsController(override implicit val env: RuntimeEnvironment[BasicProfile]) extends Controller | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
class ContributionsController(override implicit val env: Environment[User, SessionAuthenticator]) extends Silhouette[User, SessionAuthenticator] | ||
{ | ||
|
||
def index = SecuredAction(WithDomain()) { | ||
def index = SecuredAction { | ||
implicit request => | ||
Ok(views.html.contributions.index(request.user)) | ||
Ok(views.html.contributions.index(request.identity)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package controllers | ||
|
||
import auth.WithDomain | ||
import play.api.mvc._ | ||
import securesocial.core.{BasicProfile, RuntimeEnvironment} | ||
import com.mohiva.play.silhouette.api.{Environment, Silhouette} | ||
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator | ||
import domain.User | ||
|
||
class ExpenseController(override implicit val env: RuntimeEnvironment[BasicProfile]) | ||
extends Controller | ||
with securesocial.core.SecureSocial[BasicProfile] { | ||
class ExpenseController(override implicit val env: Environment[User, SessionAuthenticator]) | ||
extends Silhouette[User, SessionAuthenticator] | ||
{ | ||
|
||
def index = SecuredAction(WithDomain()) { | ||
def index = SecuredAction { | ||
implicit request => | ||
Ok(views.html.expense.index(request.user)) | ||
Ok(views.html.expense.index(request.identity)) | ||
} | ||
|
||
} |
Oops, something went wrong.