This repository has been archived by the owner on Sep 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move silhouette traits to different file
- Loading branch information
Showing
2 changed files
with
30 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package controllers | ||
|
||
import com.mohiva.play.silhouette.api.{Authenticator, Env, Identity} | ||
import play.api.mvc.RequestHeader | ||
|
||
trait IdentityProvider[I <: Identity] { | ||
def identity: I | ||
} | ||
|
||
trait AuthenticatorProvider[A <: Authenticator] { | ||
def authenticator: A | ||
} | ||
|
||
// XXX should be OOTB | ||
trait SecuredRequestHeader[E <: Env] extends RequestHeader | ||
with IdentityProvider[E#I] | ||
with AuthenticatorProvider[E#A] | ||
|
||
trait IdentityAwareProvider[I <: Identity] { | ||
def identity: Option[I] | ||
} | ||
|
||
trait AuthenticatorAwareProvider[A <: Authenticator] { | ||
def authenticator: Option[A] | ||
} | ||
|
||
// XXX should be OOTB | ||
trait UserAwareRequestHeader[E <: Env] extends RequestHeader | ||
with IdentityAwareProvider[E#I] | ||
with AuthenticatorAwareProvider[E#A] |