Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #87 from akkie/master
Browse files Browse the repository at this point in the history
Change access modifier for methods buildProfile and doAuth to public.
  • Loading branch information
akkie committed Feb 2, 2014
2 parents 8d226dd + 3890ff4 commit 942076c
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class OAuth1Provider(
* @param request The request header.
* @return Either a Result or the auth info from the provider.
*/
protected def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, OAuth1Info]] = {
def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, OAuth1Info]] = {
if (request.queryString.get(Denied).isDefined) {
throw new AccessDeniedException(AuthorizationError.format(id, Denied))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class OAuth2Provider(
* @param request The request header.
* @return Either a Result or the auth info from the provider.
*/
protected def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, OAuth2Info]] = {
def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, OAuth2Info]] = {
request.queryString.get(Error).flatMap(_.headOption).map {
case e @ AccessDenied => throw new AccessDeniedException(AuthorizationError.format(id, e))
case error => throw new AuthenticationException(AuthorizationError.format(id, error))
Expand Down
20 changes: 10 additions & 10 deletions app/com/mohiva/play/silhouette/core/providers/SocialProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ trait SocialProvider[A] extends Provider {
}

/**
* Gets the auth info implementation.
* Subclasses need to implement the authentication logic.
*
* @return The auth info implementation.
* This method needs to return a auth info object that then gets passed to the buildIdentity method.
*
* @param request The request header.
* @return Either a Result or the auth info from the provider.
*/
protected def authInfoService: AuthInfoService
def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, A]]

/**
* Subclasses need to implement this method to populate the profile information from the service provider.
*
* @param authInfo The auth info received from the provider.
* @return The build social profile.
*/
protected def buildProfile(authInfo: A): Future[SocialProfile]
def buildProfile(authInfo: A): Future[SocialProfile]

/**
* Subclasses need to implement the authentication logic.
*
* This method needs to return a auth info object that then gets passed to the buildIdentity method.
* Gets the auth info implementation.
*
* @param request The request header.
* @return Either a Result or the auth info from the provider.
* @return The auth info implementation.
*/
protected def doAuth()(implicit request: RequestHeader): Future[Either[SimpleResult, A]]
protected def authInfoService: AuthInfoService
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class LinkedInProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
httpLayer.url(API).sign(oAuth1Service.sign(authInfo)).get().map { response =>
val json = response.json
(json \ ErrorCode).asOpt[Int] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TwitterProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
httpLayer.url(API).sign(oAuth1Service.sign(authInfo)).get().map { response =>
val json = response.json
(json \ Errors \\ Code).headOption.map(_.as[Int]) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class XingProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth1Info): Future[SocialProfile] = {
httpLayer.url(API).sign(oAuth1Service.sign(authInfo)).get().map { response =>
val json = response.json
(json \ ErrorName).asOpt[String] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class FacebookProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Error).asOpt[JsObject] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FoursquareProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Response \ User).asOpt[String] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GitHubProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Message).asOpt[String] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GoogleProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Error).asOpt[JsObject] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class InstagramProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Response \ User).asOpt[String] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LinkedInProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ ErrorCode).asOpt[Int] match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class VkProvider(
* @param authInfo The auth info received from the provider.
* @return The social profile.
*/
protected def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
def buildProfile(authInfo: OAuth2Info): Future[SocialProfile] = {
httpLayer.url(API.format(authInfo.accessToken)).get().map { response =>
val json = response.json
(json \ Error).asOpt[JsObject] match {
Expand Down

0 comments on commit 942076c

Please sign in to comment.