Skip to content

Instantly share code, notes, and snippets.

View carlcraig's full-sized avatar
🦄
Working

Carl Craig carlcraig

🦄
Working
View GitHub Profile
@carlcraig
carlcraig / Admin-LTE-Angular.js
Created June 30, 2015 11:31
Admin-LTE-Angular
(function () {
'use strict';
angular
.module('admin-lte', [])
.directive('adminLteLayout', adminLteLayoutDirective)
.directive('adminLteTree', adminLteTreeDirective)
.directive('adminLteSidebarToggle', adminLteSidebarToggleDirective)
.directive('adminLteSidebarToggleSwipe', adminLteSidebarToggleSwipeDirective)
.directive('adminLteBoxWidget', adminLteBoxWidgetDirective);
@carlcraig
carlcraig / parameters.rake
Last active January 18, 2016 09:52
Capistrano Symfony Parameters
desc "create empty parameters"
task :parameters_empty do
on roles(:all) do
if not test("[ -f #{shared_path}/app/config/parameters.yml ]")
upload! StringIO.new('---'), "#{shared_path}/app/config/parameters.yml"
end
end
end
desc "configure parameters with dist values if not defined"
@carlcraig
carlcraig / gruntfile.js
Created February 1, 2015 04:03
Simple Grunt LiveReload
module.exports = function(grunt) {
grunt.initConfig({
watch: {
options: {
livereload: true
},
app: {
files: ['index.html', 'partials/**/*.html', 'js/**/*.js', 'css/**/*.css'],
tasks: []
@carlcraig
carlcraig / ErrorHandler.js
Last active August 29, 2015 14:14
JS Error Catching
(function ErrorHandler(errorElement) {
var self = this;
self.errorcount = 0;
self.onerror = onerror;
self.originalOnerror = window.onerror;
self.revertErrorHandler = revertErrorHandler;
window.onerror = self.onerror;
window.onload = onload;
<?php
namespace Application\ProdrepHelperBundle\Component\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
/**
*/
class AjaxAuthenticationListener
@carlcraig
carlcraig / 1. remapConfigsToParameters.php
Last active May 23, 2017 15:00
Symfony2 Extension Configuration function to remap config tree builder to parameters
<?php
/**
* Remaps Configurations to Parameters
*
* @param array $configs The array of configurations
* @param ContainerBuilder $container The container builder
* @param string $prefix A prefix to apply to all parameters
* @param array $ignore An array of parameter namespaces to ignore
* @param array $isArray An array of parameter namespaces which should be arrays

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.