Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to knpuniversity/oauth2-client-bundle #824

Merged
merged 14 commits into from
Jan 30, 2018
31 changes: 12 additions & 19 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,24 @@ framework:
- mustache
- twig

hwi_oauth:
firewall_names:
- main
resource_owners:
elife:
type: oauth2
class: eLife\Journal\Security\OAuth2\ElifeResourceOwner
client_id: '%oauth2_client_id%'
client_secret: '%oauth2_client_secret%'
access_token_url: '%api_url%/oauth2/token'
authorization_url: '%api_url_public%/oauth2/authorize'
paths:
identifier: id
nickname: id
realname: name
options:
csrf: true
use_referer: true

isometriks_spam:
honeypot:
field: '%honeypot_field%'
global: true
message: Please try submitting the form again.

knpu_oauth2_client:
clients:
elife:
type: generic
provider_class: eLife\Journal\Security\OAuth2\ElifeProvider
client_id: '%oauth2_client_id%'
client_secret: '%oauth2_client_secret%'
redirect_route: log-in-check
provider_options:
api_url: '%api_url%'
api_url_public: '%api_url_public%'

monolog:
channels:
- api
Expand Down
12 changes: 4 additions & 8 deletions app/config/security.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
security:
providers:
oauth:
id: hwi_oauth.user.provider
id: knpu.oauth2.user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt))/
security: false
main:
anonymous: ~
guard:
authenticators:
- elife.journal.security.authenticator.elife
logout:
path: /log-out
target: /
oauth:
login_path: /log-in
failure_path: /
oauth_user_provider:
service: hwi_oauth.user.provider
resource_owners:
elife: /log-in/check
access_control:
- path: ^/log-in
roles: IS_AUTHENTICATED_ANONYMOUSLY
8 changes: 8 additions & 0 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ services:
- '%hypothesis_client_id%'
- '%hypothesis_client_secret%'

elife.journal.security.authenticator.elife:
class: eLife\Journal\Security\Authenticator\ElifeAuthenticator
public: false
arguments:
- '@oauth2.registry'
- '@router'
- '@security.http_utils'

elife.journal.security.voter.feature.can_authenticate:
class: eLife\Journal\Security\Voter\SessionAttributeVoter
public: false
Expand Down
8 changes: 7 additions & 1 deletion app/config/services_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
class: Csa\Bundle\GuzzleBundle\Cache\MockStorageAdapter
arguments:
- '%api_mock%'
- ['Authorization', 'Content-Length', 'Host', 'host', 'Referer', 'referer', 'User-Agent', 'user-agent', 'X-Guzzle-Cache']
- ['authorization', 'content-length', 'host', 'referer', 'user-agent', 'x-guzzle-cache']

elife.guzzle.middleware.mock.storage.validating:
class: test\eLife\Journal\ValidatingStorageAdapter
Expand All @@ -36,6 +36,12 @@ services:
- '@elife.guzzle.middleware.mock.storage.validating.inner'
- '@elife.api_validator.validator'

elife.guzzle.middleware.mock.storage.normalizing:
class: test\eLife\Journal\NormalizingStorageAdapter
decorates: elife.guzzle.middleware.mock.storage
arguments:
- '@elife.guzzle.middleware.mock.storage.normalizing.inner'

elife.guzzle.middleware.mock:
class: Csa\Bundle\GuzzleBundle\GuzzleHttp\Middleware\MockMiddleware
arguments:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"fabpot/goutte": "^3.2",
"firebase/php-jwt": "^5.0",
"guzzlehttp/promises": "^1.3",
"hwi/oauth-bundle": "^0.6@dev",
"isometriks/spam-bundle": "^1.0",
"kevinrob/guzzle-cache-middleware": "^3.2",
"knpuniversity/oauth2-client-bundle": "^1.16",
"mindplay/composer-locator": "^2.1",
"mustache/mustache": "^2.12",
"nelmio/security-bundle": "^2.4",
Expand Down
Loading