AuthBucket\Bundle\OAuth2Bundle - OAuth2 in Symfony Bundle

AuthBucket\Bundle\OAuth2Bundle is a Symfony Bundle, which integrate AuthBucket\OAuth2 as easy as possible into your Symfony Project.

Installation

Simply add a dependency on authbucket/oauth2-bundle to your project's composer.json file if you use Composer to manage the dependencies of your project.

Here is a minimal example of a composer.json:

{
    "require": {
        "authbucket/oauth2-bundle": "dev-master"
    }
}

You also have to add AuthBucketOAuth2Bundle to your AppKernel.php:

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new AuthBucket\Bundle\OAuth2Bundle\AuthBucketOAuth2Bundle(),
        );
        return $bundles;
    }
}

Demo

This library bundle with a Symfony based AuthBucketOAuth2Bundle. Read though Demo for more information.

You may also run the demo locally. Open a console and execute the following command to install the latest version in the oauth2-bundle/ directory:

$ composer create-project authbucket/oauth2-bundle oauth2-bundle/ dev-master

Then use the PHP built-in web server to run the demo application:

$ cd oauth2-bundle/
$ php app/console server:run

If you get the error There are no commands defined in the "server" namespace., then you are probably using PHP 5.3. That's ok! But the built-in web server is only available for PHP 5.4.0 or higher. If you have an older version of PHP or if you prefer a traditional web server such as Apache or Nginx, read the Configuring a web server article.

Open your browser and access the http://127.0.0.1:8000 URL to see the Welcome page of demo application.

Also access http://127.0.0.1:8000/admin/refresh_database to initialize the bundled SQLite database with user account admin:secrete.

AuthBucket\OAuth2 - Symfony Based OAuth2 PHP Library

The primary goal of AuthBucket\OAuth2 is to develop a standards compliant RFC6749 OAuth2.0 library; secondary goal would be develop corresponding wrapper Symfony2 Bundle and Drupal module.

Installation

Simply add a dependency on authbucket/oauth2 to your project's composer.json file if you use Composer to manage the dependencies of your project.

Here is a minimal example of a composer.json:

{
    "require": {
        "authbucket/oauth2": "dev-master"
    }
}

Demo

This library bundle with a Silex based AuthBucketOAuth2ServiceProvider. Read though Demo for more information.

You may also run the demo locally. Open a console and execute the following command to install the latest version in the oauth2/ directory:

$ composer create-project authbucket/oauth2 oauth2/ dev-master

Then use the PHP built-in web server to run the demo application:

$ cd oauth2/
$ php app/console server:run

If you get the error There are no commands defined in the "server" namespace., then you are probably using PHP 5.3. That's ok! But the built-in web server is only available for PHP 5.4.0 or higher. If you have an older version of PHP or if you prefer a traditional web server such as Apache or Nginx, read the Configuring a web server article.

Open your browser and access the http://localhost:8000 URL to see the Welcome page of demo application.

Also access http://localhost:8000/admin/refresh_database to initialize the bundled SQLite database with user account admin:secrete.

VIM Profile for PHP/Drupal/Symfony Development

Finally I archive my VIM profile for PHP/Drupal/Symfony development and can be found from GitHub: https://github.com/phpshift/vim-pathogen-installer

Assume you are using Linux/Mac for development, execute following command to install my VIM profile in single command:

bash <(curl -sL https://github.com/phpshift/vim-pathogen-installer/raw/master/install.sh)

Enjoy!

OpenStack Havana Deploy by Rackspace Private Cloud v4.2.2

This HOWTO will guide you though a multi-node Openstack Havana deployment with Rackspace Private Cloud v4.2.2.

Before start I will assume you have a clean Ubuntu Server 12.04 installed with minimal packages requirement. It is strongly recommend to install Openstack for a new host, as it will modify a lot of default settings; from the other point of view, don't install Openstack on top of an online production that already well configured ;-)

OpenStack Havana Flat Network Example

After installing OpenStack Havana with Rackspace Private Cloud Software, one of the next important step is to enable its network access. General Havana's Neutron can be found from Configuring OpenStack Networking, and here I would like to provide an example setup similar as that of previous nova-network simple flat network architecture.

Announcing TWBS jQuery: Simple jQuery Update for Drupal 7

During TWBS development upgrade Drupal 7 core jQuery libraries into its latest version for Bootstrap is a must. BTW jQuery Update seems not my cup of tea because it give me too much trobule within previous site building experience: too complicated, bundle everything within its own archive (which I love to manage 3rd party libraries with drush make and Libraries API), and it is really too much for my use case. So why not just work out a simplified version?

After some research and development during Christmas holiday, I would like to introduce my helper module named "TWBS jQuery". The goal of TWBS jQuery is to provide a handy support for jQuery upgrade and act as the helper module for on going Drupal-Bootstrap-Remix development.

All replacement will be handled automatically. No additional configuration is required.

Key Features

NOTE: We don't officially support overlay.module as deprecated in favour of using together with TWBS.

Getting Started

Download and install with drush manually:

drush -y dl --dev twbs_jquery
drush -y make --no-core sites/all/modules/twbs_jquery/twbs_jquery.make

Package into your own drush .make file (e.g. drustack_core.make):

api = 2
core = 7.x
projects[twbs_jquery][download][branch] = 7.x-3.x
projects[twbs_jquery][download][type] = git
projects[twbs_jquery][download][url] = http://git.drupal.org/project/twbs_jquery.git
projects[twbs_jquery][subdir] = contrib

Live Demo

TWBS jQuery is now integrated into DruStack distribution, so you can try it in a live sandbox with simplytest.me.

Why Another jQuery Module?

For general and generic jQuery update functionality, you should always consider another jQuery Update module which started since 2007-04-26.

On the other hand you should consider about using this module because of:

  • Purely design for assist TWBS, which means you will have the best compatibility when using both together
  • Fetch libraries directly from original repository and handle initialization with Libraries API; jQuery Update bundle all libraries into it's own code repository and initialize manually
  • Only support latest official version of libraries which result as no additional configuration required; jQuery Update support multiple version of jQuery
  • Much simple implementation which handle all upgrade and replacement automatically; jQuery Update provide more customization options

Author

Please feel free to test it out and comment with your idea. Let's enjoy simplified jQuery update experience ;-)

Announcing TWBS LESS: Simple LESS Support for Drupal 7

During TWBS development I figure out that introducing LESS support in Drupal 7 would be a great idea when combine with Bootstrap and Font Awesome. After some research and development during Christmas holiday, I would like to introduce my helper module named "TWBS LESS". The goal of TWBS LESS is to provide a handy support for LESS and act as the helper module for on going Drupal-Bootstrap-Remix development.

Add your files just like any other CSS file, just with .less as the extension, and they will be automatically processed. No additional configuration is required.

Key Features

  • Provide drush make file for library download
  • Confirm library successfully initialized with hook_requirements()
  • Support both LTR *.less and RTL *-rtl.less, as like as that of locale_css_alter() supported
  • If Drupal's CSS aggregation enabled, all .less will automatically pre-compile as .css at server-side by lessphp before Drupal CSS aggregation
  • If Drupal's CSS aggregation disabled, all .less will link with rel set to "stylesheel/less" individually, so less.js will handle in client-side live- compile
  • Support FireLESS for .less debug with Firebug in client-side compile mode

Getting Started

Download and install with drush manually:

drush -y dl --dev twbs_less
drush -y make --no-core sites/all/modules/twbs_less/twbs_less.make

Package into your own drush .make file (e.g. build-drustack.make):

api = 2
core = 7.x
projects[twbs_less][download][branch] = 7.x-3.x
projects[twbs_less][download][type] = git
projects[twbs_less][download][url] = http://git.drupal.org/project/twbs_less.git
projects[twbs_less][subdir] = contrib

Live Demo

TWBS LESS is now integrated into DruStack distribution, so you can try it in a live sandbox with simplytest.me.

Why Another LESS Module?

For general and generic LESS support you should always consider another LESS CSS Preprocessor module which started since 2010-03-04.

On the other hand you should consider about using this module because of:

  • Purely design for assist TWBS, which means you will have the best compatibility when using both together
  • Support both server-side pre-compile / client-side live-compile with debug mode enable; LESS CSS Preprocessor support server-side pre-compile
  • RTL support with *-rtl.less just as simple as CSS *-rtl.css that Drupal core supported; LESS CSS Preprocessor RTL support will work as long as your files are named "somename.css.less"
  • Server-side pre-compile CSS will name based on its original .less md5_file() result, which means even you add a single space the cache file will also be regenerate; LESS CSS Preprocessor calculate based on filemtime()
  • Much simple implementation which handle all LESS support automatically as like as that of Drupal core CSS support; LESS CSS Preprocessor provide more customization options

Known Issues

IMHO, below limitation as not directly due to our current implementation:

  • Can't package into Drupal distribution hosted under drupal.org GIT repository directly (but able to include into your own build-*.make or simplytest.make), because:
  • LESS variables and mixins that defined by other else module/theme can't be reuse directly (e.g. You can't reuse . fa mixin that provided by TWBS Font Awesome into your own module/theme), because:
    • If using server-side pre-compile, all LESS/CSS should be sorted in correct order, all url() and @import should replace as correct absolute URL, and aggregated into a single-fat-file before compile into CSS at once
    • If using client-side live-compile, external .less should be referenced by @import with absolute URL correctly

Author

Please feel free to test it out and comment with your idea. Let's enjoy simplified theme development with LESS ;-)

OpenStack Swift + swift3 note

  * template[/etc/swift/proxy-server.conf] action create
    - update template[/etc/swift/proxy-server.conf] from f3a461 to 53dc90
        --- /etc/swift/proxy-server.conf    2013-09-25 11:55:44.761021775 +0800
        +++ /tmp/chef-rendered-template20130927-22717-s7qboe    2013-09-27 14:45:42.401640911 +0800
        @@ -26,7 +26,7 @@
         bind_port = 8080
         
         [pipeline:main]
        -pipeline = catch_errors healthcheck cache swift3 s3token ratelimit authtoken keystoneauth proxy-server

Sync Drupal Distribution Profile With GIT Managed Project

As managing my Drupal distribution - DruStack, with both Drupal.org version and GitHub version, one of the daily duty is to keep their submodules in synchonize. E.g. in case drupal-org.make say we would like to fetch drustack_core as below:

projects[drustack_core][download][branch] = 7.x-23.x
projects[drustack_core][download][type] = git
projects[drustack_core][download][url] = http://git.drupal.org/project/drustack_core.git
projects[drustack_core][subdir] = drustack

In GitHub submodule I need to check out the corresponding branch with "7.x-23.x". Moreover, in case drupal-org.make say we would like to fetch multiflex3 as below:

projects[multiflex3][subdir] = contrib
projects[multiflex3][version] = 3.2

In GitHub submodule I should check out the corresponding tag with "7.x-3.2", too.

So How to sync it in a handy way?

cat profiles/drustack/drupal-org.make | grep branch | while read LINE; do \
    echo $LINE; \
    PROJECT=`echo $LINE | sed 's/projects\[\(.*\)\]\[download\].* = \(.*\)/\1/g'`; \
    BRANCH=`echo $LINE | sed 's/projects\[\(.*\)\]\[download\].* = \(.*\)/\2/g'`; \
    GIT="git --git-dir=`find . -type f -name '.git' | grep \"\/$PROJECT\/\" | grep -v libraries`"; \
    $GIT fetch; \
    $GIT checkout $BRANCH; \
    $GIT pull; \
    $GIT status; \
done

cat profiles/drustack/drupal-org.make | grep version | while read LINE; do \
    echo $LINE; \
    PROJECT=`echo $LINE | sed 's/projects\[\(.*\)\]\[version\].* = \(.*\)/\1/g'`; \
    TAG="7.x-`echo $LINE | sed 's/projects\[\(.*\)\]\[version\].* = \(.*\)/\2/g'`"; \
    GIT="git --git-dir=`find . -type f -name '.git' | grep \"\/$PROJECT\/\" | grep -v libraries`"; \
    $GIT fetch; \
    $GIT checkout $TAG; \
    $GIT status; \
done

永遠不要跟一個純傻逼爭論

永遠不要跟一個純傻逼爭論,因為他會把你的智商拉到跟他一個水平,然後用他多年當傻逼的豐富經驗打敗你。

Pages

Subscribe to Edison Wong RSS