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

create auth facebook #162

Open
wants to merge 1 commit into
base: rest_api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/SymfonyRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ function_exists('simplexml_import_dom'),

$this->addRecommendation(
class_exists('DomDocument'),
'PHP-XML module should be installed',
'Install and enable the <strong>PHP-XML</strong> module.'
'PHP-DOM and PHP-XML modules should be installed',
'Install and enable the <strong>PHP-DOM</strong> and the <strong>PHP-XML</strong> modules.'
);

$this->addRecommendation(
Expand Down
35 changes: 19 additions & 16 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ imports:
- { resource: jms_serializer.yml }
- { resource: twig.yml }
- { resource: liip_imagine.yml }
- { resource: service.yml }

framework:
#esi: ~
Expand Down Expand Up @@ -108,36 +109,38 @@ fos_rest:
nelmio_api_doc: CheDream

hwi_oauth:
connect:
account_connector: geekhub.user.dream_user_provider
confirmation: false
# connect:
# account_connector: geekhub.user.dream_user_provider
# confirmation: false
# name of the firewall in which this bundle is active, this setting MUST be set
firewall_name: main
fosub:
username_iterations: 30
properties:
# these properties will be used/redefined later in the custom FOSUBUserProvider service.
facebook: facebook_id
vkontakte: vkontakte_id
odnoklassniki: odnoklassniki_id
# vkontakte: vkontakte_id
# odnoklassniki: odnoklassniki_id
resource_owners:
facebook:
type: facebook
client_id: "%facebook_app_id%"
client_secret: "%facebook_app_secret%"
scope: "email, user_photos, user_website, user_birthday"
vkontakte:
type: vkontakte
client_id: "%vkontakte_app_id%"
client_secret: "%vkontakte_app_secret%"
scope: "photos"
odnoklassniki:
type: odnoklassniki
client_id: "%odnoklassniki_app_id%"
client_secret: "%odnoklassniki_app_secret%"
scope: "VALUABLE_ACCESS;PHOTO CONTENT"
options:
application_key: "%odnoklassniki_app_key%"
display: popup
# vkontakte:
# type: vkontakte
# client_id: "%vkontakte_app_id%"
# client_secret: "%vkontakte_app_secret%"
# scope: "photos"
# odnoklassniki:
# type: odnoklassniki
# client_id: "%odnoklassniki_app_id%"
# client_secret: "%odnoklassniki_app_secret%"
# scope: "VALUABLE_ACCESS;PHOTO CONTENT"
# options:
# application_key: "%odnoklassniki_app_key%"

geekhub_user:
image:
Expand Down
10 changes: 10 additions & 0 deletions app/config/routing_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ faq:
type: rest
resource: "@GeekhubResourceBundle/Controller/Api/FaqController.php"

hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login

hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect

facebook_login:
pattern: /login/check-facebook
17 changes: 10 additions & 7 deletions app/config/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ security:
id: fos_user.user_provider.username
my_custom_hwi_provider:
id: geekhub.user.dream_user_provider
_hwi_provider:
id: aouth_user_provider

firewalls:
main:
Expand All @@ -25,19 +27,20 @@ security:
path: /logout
target: /
anonymous: true

oauth:
resource_owners:
facebook: "/login-social/check-facebook"
vkontakte: "/login-social/check-vkontakte"
odnoklassniki: "/login-social/check-odnoklassniki"
login_path: /
failure_path: /nologin
facebook: "/login/check-facebook"
login_path: /login
failure_path: /login

oauth_user_provider:
service: geekhub.user.dream_user_provider
service: aouth_user_provider
anonymous: true

access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/connect, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: [ROLE_MODERATOR, ROLE_SUPER_ADMIN]}
- { path: ^/dream/edit, role: ROLE_USER }
16 changes: 16 additions & 0 deletions app/config/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Learn more about services, parameters and containers at
# http://symfony.com/doc/current/book/service_container.html
parameters:
# parameter_name: value

user_class_name: Geekhub\UserBundle\Entity\User

services:
# service_name:
# class: AppBundle\Directory\ClassName
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]
aouth_user_provider:
class: Geekhub\UserBundle\Model\OAuthUserProvider
arguments:
- @doctrine
- %user_class_name%
Loading