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
Refactor social auth providers #121
Open
wsargent
wants to merge
2
commits into
mohiva:master
Choose a base branch
from
wsargent:refactor-social-auth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,73 @@ | ||
silhouette { | ||
callback.host = "localhost:9000" | ||
callback.host=${?SILHOUETTE_CALLBACK_HOST} | ||
|
||
callback.scheme = "http" | ||
callback.scheme=${?SILHOUETTE_CALLBACK_SCHEME} | ||
callback.url = ${silhouette.callback.scheme}"://"${silhouette.callback.host} | ||
|
||
// Disabled for testing on localhost without SSL, otherwise cookie couldn't be set | ||
cookie.secure = false | ||
cookie.path = "/" | ||
|
||
# Authenticator settings | ||
authenticator.cookieName="authenticator" | ||
authenticator.cookiePath="/" | ||
authenticator.secureCookie=false // Disabled for testing on localhost without SSL, otherwise cookie couldn't be set | ||
authenticator.httpOnlyCookie=true | ||
authenticator.sameSite="Lax" | ||
authenticator.useFingerprinting=true | ||
authenticator.authenticatorIdleTimeout=30 minutes | ||
authenticator.authenticatorExpiry=12 hours | ||
authenticator { | ||
cookieName="authenticator" | ||
cookiePath=${silhouette.cookie.path} | ||
secureCookie=${silhouette.cookie.secure} | ||
httpOnlyCookie=true | ||
sameSite="Lax" | ||
useFingerprinting=true | ||
authenticatorIdleTimeout=30 minutes | ||
authenticatorExpiry=12 hours | ||
|
||
authenticator.rememberMe.cookieMaxAge=30 days | ||
authenticator.rememberMe.authenticatorIdleTimeout=5 days | ||
authenticator.rememberMe.authenticatorExpiry=30 days | ||
rememberMe.cookieMaxAge=30 days | ||
rememberMe.authenticatorIdleTimeout=5 days | ||
rememberMe.authenticatorExpiry=30 days | ||
|
||
authenticator.signer.key = "[changeme]" // A unique encryption key | ||
authenticator.crypter.key = "[changeme]" // A unique encryption key | ||
signer.key = "[changeme]" // A unique encryption key | ||
signer.key = ${?AUTH_SIGNER_KEY} | ||
|
||
crypter.key = "[changeme]" // A unique encryption key | ||
crypter.key = ${?AUTH_CRYPTER_KEY} | ||
} | ||
|
||
# OAuth1 token secret provider settings | ||
oauth1TokenSecretProvider.cookieName="OAuth1TokenSecret" | ||
oauth1TokenSecretProvider.cookiePath="/" | ||
oauth1TokenSecretProvider.secureCookie=false // Disabled for testing on localhost without SSL, otherwise cookie couldn't be set | ||
oauth1TokenSecretProvider.httpOnlyCookie=true | ||
oauth1TokenSecretProvider.sameSite="Lax" | ||
oauth1TokenSecretProvider.expirationTime=5 minutes | ||
oauth1TokenSecretProvider { | ||
cookieName="OAuth1TokenSecret" | ||
cookiePath=${silhouette.cookie.path} | ||
secureCookie=${silhouette.cookie.secure} | ||
httpOnlyCookie=true | ||
sameSite="Lax" | ||
expirationTime=5 minutes | ||
|
||
oauth1TokenSecretProvider.signer.key = "[changeme]" // A unique encryption key | ||
oauth1TokenSecretProvider.crypter.key = "[changeme]" // A unique encryption key | ||
signer.key = "[changeme]" // A unique encryption key | ||
crypter.key = "[changeme]" // A unique encryption key | ||
} | ||
|
||
# # OAuth2 state provider settings | ||
oauth2StateProvider.secureCookie=${silhouette.cookie.secure} | ||
|
||
# Social state handler | ||
socialStateHandler.signer.key = "[changeme]" // A unique encryption key | ||
|
||
# CSRF state item handler settings | ||
csrfStateItemHandler.cookieName="OAuth2State" | ||
csrfStateItemHandler.cookiePath="/" | ||
csrfStateItemHandler.secureCookie=false // Disabled for testing on localhost without SSL, otherwise cookie couldn't be set | ||
csrfStateItemHandler.httpOnlyCookie=true | ||
csrfStateItemHandler.sameSite="Lax" | ||
csrfStateItemHandler.expirationTime=5 minutes | ||
|
||
csrfStateItemHandler.signer.key = "[changeme]" // A unique encryption key | ||
csrfStateItemHandler { | ||
cookieName="OAuth2State" | ||
cookiePath=${silhouette.cookie.path} | ||
secureCookie=${silhouette.cookie.secure} | ||
httpOnlyCookie=true | ||
sameSite="Lax" | ||
expirationTime=5 minutes | ||
|
||
# Facebook provider | ||
facebook.authorizationURL="https://graph.facebook.com/v2.3/oauth/authorize" | ||
facebook.accessTokenURL="https://graph.facebook.com/v2.3/oauth/access_token" | ||
facebook.redirectURL="http://localhost:9000/authenticate/facebook" | ||
facebook.clientID="" | ||
facebook.clientID=${?FACEBOOK_CLIENT_ID} | ||
facebook.clientSecret="" | ||
facebook.clientSecret=${?FACEBOOK_CLIENT_SECRET} | ||
facebook.scope="email" | ||
|
||
# Google provider | ||
google.authorizationURL="https://accounts.google.com/o/oauth2/auth" | ||
google.accessTokenURL="https://accounts.google.com/o/oauth2/token" | ||
google.redirectURL="http://localhost:9000/authenticate/google" | ||
google.clientID="" | ||
google.clientID=${?GOOGLE_CLIENT_ID} | ||
google.clientSecret="" | ||
google.clientSecret=${?GOOGLE_CLIENT_SECRET} | ||
google.scope="profile email" | ||
|
||
# VK provider | ||
vk.authorizationURL="http://oauth.vk.com/authorize" | ||
vk.accessTokenURL="https://oauth.vk.com/access_token" | ||
vk.redirectURL="http://localhost:9000/authenticate/vk" | ||
vk.clientID="" | ||
vk.clientID=${?VK_CLIENT_ID} | ||
vk.clientSecret="" | ||
vk.clientSecret=${?VK_CLIENT_SECRET} | ||
vk.scope="email" | ||
|
||
# Twitter provider | ||
twitter.requestTokenURL="https://twitter.com/oauth/request_token" | ||
twitter.accessTokenURL="https://twitter.com/oauth/access_token" | ||
twitter.authorizationURL="https://twitter.com/oauth/authenticate" | ||
twitter.callbackURL="http://localhost:9000/authenticate/twitter" | ||
twitter.consumerKey="" | ||
twitter.consumerKey=${?TWITTER_CONSUMER_KEY} | ||
twitter.consumerSecret="" | ||
twitter.consumerSecret=${?TWITTER_CONSUMER_SECRET} | ||
|
||
# Xing provider | ||
xing.requestTokenURL="https://api.xing.com/v1/request_token" | ||
xing.accessTokenURL="https://api.xing.com/v1/access_token" | ||
xing.authorizationURL="https://api.xing.com/v1/authorize" | ||
xing.callbackURL="http://localhost:9000/authenticate/xing" | ||
xing.consumerKey="" | ||
xing.consumerKey=${?XING_CONSUMER_KEY} | ||
xing.consumerSecret="" | ||
xing.consumerSecret=${?XING_CONSUMER_SECRET} | ||
|
||
# Yahoo provider | ||
yahoo.providerURL="https://me.yahoo.com/" | ||
yahoo.callbackURL="http://localhost:9000/authenticate/yahoo" | ||
yahoo.axRequired={ | ||
"fullname": "http://axschema.org/namePerson", | ||
"email": "http://axschema.org/contact/email", | ||
"image": "http://axschema.org/media/image/default" | ||
signer.key = "[changeme]" // A unique encryption key | ||
} | ||
yahoo.realm="http://localhost:9000" | ||
} | ||
|
||
include "social/facebook" | ||
include "social/github" | ||
include "social/google" | ||
include "social/twitter" | ||
include "social/vk" | ||
include "social/xing" | ||
include "social/yahoo" |
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,12 @@ | ||
silhouette { | ||
facebook { | ||
authorizationURL="https://graph.facebook.com/v2.3/oauth/authorize" | ||
accessTokenURL="https://graph.facebook.com/v2.3/oauth/access_token" | ||
redirectURL=${silhouette.callback.url}"/authenticate/facebook" | ||
clientID="" | ||
clientID=${?FACEBOOK_CLIENT_ID} | ||
clientSecret="" | ||
clientSecret=${?FACEBOOK_CLIENT_SECRET} | ||
scope="email" | ||
} | ||
} |
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,12 @@ | ||
silhouette { | ||
github { | ||
authorizationURL="https://github.com/login/oauth/authorize" | ||
accessTokenURL="https://github.com/login/oauth/access_token" | ||
redirectURL=${silhouette.callback.url}"/authenticate/github" | ||
clientID="" | ||
clientID=${?GITHUB_CLIENT_ID} | ||
clientSecret="" | ||
clientSecret=${?GITHUB_CLIENT_SECRET} | ||
scope="profile email" | ||
} | ||
} |
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,13 @@ | ||
silhouette { | ||
google { | ||
authorizationURL="https://accounts.google.com/o/oauth2/auth" | ||
accessTokenURL="https://accounts.google.com/o/oauth2/token" | ||
redirectURL=${silhouette.callback.url}"/authenticate/google" | ||
clientID="" | ||
clientID=${?GOOGLE_CLIENT_ID} | ||
clientSecret="" | ||
clientSecret=${?GOOGLE_CLIENT_SECRET} | ||
scope="profile email openid" | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the theory here is that you should be able to define these from configuration, and have them loaded in by dependency injection automatically: see https://github.com/playframework/playframework/blob/master/core/play/src/main/scala/play/api/http/HttpFilters.scala#L78 for an implementation.