Giter Club home page Giter Club logo

liiponeallbundle's Introduction

UNMAINTAINED

This bundle is no longer maintained. Feel free to fork it if needed.

Introduction

This is still a work in progress!

This Bundle enables integration of the Oneall.com into Symfony2. The code is based on https://github.com/FriendsOfSymfony/FOSFacebookBundle

Please also refer to the Oneall documentation: http://docs.oneall.com/plugins/

Furthermore please also refer to the official documentation on security, especially for details on the configuration: http://symfony.com/doc/current/book/security.html

Build Status

Prerequisites

This version requires Symfony 2.1

Installation

  1. Add the following lines in your composer.json:
{
  "require": {
      "liip/oneall-bundle": "dev-master"
  }
}
  1. Run the composer to download the bundle
$ php composer.phar require liip/oneall-bundle
  1. Add this bundle to your application's kernel:
        // app/ApplicationKernel.php
        public function registerBundles()
        {
            return array(
                // ...
                new Liip\OneallBundle\LiipOneallBundle(),
                // ...
            );
        }
  1. Add the following routes to your application and point them at actual controller actions
        #application/config/routing.yml
        liip_oneall_check:
            pattern:  /login_check
        liip_oneall_logout:
            pattern:  /logout
        #application/config/routing.xml
        <route id="liip_oneall_check" pattern="/login_check" />
        <route id="liip_oneall_logout" pattern="/logout" />
  1. Configure the oneall service in your config (most of the information can be copied out of the oneall.com control panel):
        # application/config/config.yml
        liip_oneall:
            site_subdomain: my_subdomain
            site_public_key: my_not_so_secret_key
            site_private_key: my_s3cr3t_key
            social_links: [linkedin, facebook, github, twitter]
            default_firewall_name: main
            callback_path: /foo
        # application/config/config.xml
        <liip_oneall:api
            site_subdomain="my_subdomain"
            site_public_key="my_not_so_secret_key"
            site_private_key="my_s3cr3t_key"
            default_firewall_name="main"
            callback_path="/foo"
        >
              <social-links>linkedin</social-links>
              <social-links>facebook</social-links>
              <social-links>github</social-links>
              <social-links>twitter</social-links>
        </liip_oneall:api>
 > Note you only need to specify either ``default_firewall_name`` or ``callback_path``.
 The ``callback_path`` can either be a relative path or a route name.
  1. Add this configuration if you want to use the security component:
        # application/config/config.yml
        security:
            firewalls:
                public:
                    # since anonymous is allowed users will not be forced to login
                    pattern:   ^/.*
                    liip_oneall:
                        check_path: liip_oneall_check
                    anonymous: true
                    logout:
                        handlers: ["liip_oneall.logout_handler"]

            access_control:
                - { path: ^/secured/.*, role: [IS_AUTHENTICATED_FULLY] } # This is the route secured with liip_oneall
                - { path: ^/.*, role: [IS_AUTHENTICATED_ANONYMOUSLY] }
 You have to add `/secured/` in your routing for this to work. An example would be...
            liip_oneall_secured:
                pattern: /secured/
                defaults: { _controller: AcmeDemoBundle:Welcome:index }
  1. Optionally define a custom user provider class and use it as the provider or define path for login. There is a default implementation for FOSUserBundle integration
        # application/config/config.yml
        security:
            providers:
                # choose the provider name freely
                my_liip_oneall_provider:
                    id: liip_oneall.user_provider   # see "Example Custom User Provider using the FOS\UserBundle" chapter further down

            firewalls:
                public:
                    pattern:   ^/.*
                    liip_oneall:
                        login_path: /login
                        check_path: liip_oneall_check
                        default_target_path: /
                        provider: my_liip_oneall_provider
                    anonymous: true
                    logout:
                        handlers: ["liip_oneall.logout_handler"]
  1. Optionally use access control to secure specific URLs
        # application/config/config.yml
        security:
            # ...
            
            access_control:
                - { path: ^/oneall/,           role: [ROLE_ONEALL] }
                - { path: ^/.*,                role: [IS_AUTHENTICATED_ANONYMOUSLY] }
The role `ROLE_ONEALL` has to be added in your User class (see Acme\MyBundle\Entity\User::setFBData() below).
> Note that the order of access control rules matters!

Setting up the JavaScript SDK

A templating Twig extension is included for loading the Oneall JavaScript SDK and initializing it with parameters from your service container. To setup the Oneall JavaScript environment, add the following to your layout just after the opening body tag:

<!-- inside a twig template -->
{{ oneall_initialize() }}

Include the login button in your templates

Just add the following code in one of your templates:

<!-- inside a twig template -->
{{ oneall_login_button({'login_container_id': 'some_tag_id'}) }}

Note that login_container_id is optional and defaults to oa_social_login_container.

Include the logut url in your templates

TODO

liiponeallbundle's People

Contributors

lsmith77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sennychu d-skora

liiponeallbundle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.