-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support social authentication (#230)
- Loading branch information
TAKESHI SHIMADA
committed
Jul 17, 2019
1 parent
e1e9364
commit c5318cb
Showing
54 changed files
with
606 additions
and
304 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 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
33 changes: 33 additions & 0 deletions
33
.../io/github/cactacea/backend/core/infrastructure/validators/AuthenticationsValidator.scala
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,33 @@ | ||
package io.github.cactacea.backend.core.infrastructure.validators | ||
|
||
import com.google.inject.{Inject, Singleton} | ||
import com.twitter.util.Future | ||
import io.github.cactacea.backend.core.infrastructure.dao.AuthenticationsDAO | ||
import io.github.cactacea.backend.core.infrastructure.identifiers.AccountId | ||
import io.github.cactacea.backend.core.util.exceptions.CactaceaException | ||
import io.github.cactacea.backend.core.util.responses.CactaceaErrors._ | ||
|
||
@Singleton | ||
class AuthenticationsValidator @Inject()( | ||
authenticationsDAO: AuthenticationsDAO | ||
) { | ||
|
||
def findAccountId(providerId: String, providerKey: String): Future[AccountId] = { | ||
authenticationsDAO.find(providerId, providerKey).flatMap(_ match { | ||
case Some(a) => | ||
a.accountId match { | ||
case Some(id) => | ||
Future.value(id) | ||
case None => | ||
Future.exception(CactaceaException(AccountNotFound)) | ||
} | ||
case None => | ||
Future.exception(CactaceaException(AccountNotFound)) | ||
}) | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
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
10 changes: 10 additions & 0 deletions
10
core/src/main/scala/io/github/cactacea/backend/core/util/configs/OAuth1Config.scala
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,10 @@ | ||
package io.github.cactacea.backend.core.util.configs | ||
|
||
case class OAuth1Config ( | ||
requestTokenURL: Option[String], | ||
accessTokenURL: Option[String], | ||
authorizationURL: Option[String], | ||
callbackURL: Option[String], | ||
consumerKey: Option[String], | ||
consumerSecret: Option[String] | ||
) |
10 changes: 10 additions & 0 deletions
10
core/src/main/scala/io/github/cactacea/backend/core/util/configs/OAuth2Config.scala
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,10 @@ | ||
package io.github.cactacea.backend.core.util.configs | ||
|
||
case class OAuth2Config ( | ||
authorizationURL: Option[String], | ||
accessTokenURL: Option[String], | ||
redirectURL: Option[String], | ||
clientID: Option[String], | ||
clientSecret: Option[String], | ||
scope: Option[String] | ||
) |
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
Oops, something went wrong.