Skip to content

Instantly share code, notes, and snippets.

@jtreminio
jtreminio / ApiAppApi.php
Created November 24, 2021 15:23
openapi-generator creates a PHP SDK where the OAuth typehints in the `OpenAPI\Client\Api\ApiAppApi::apiAppCreate()` method are not namespaced
<?php
/**
* ApiAppApi
* PHP version 7.3
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
const ServiceCategory = {
"Application Engine": 0,
"Web Server": 0,
"Database Engine": 0,
"Other": 0,
};
const ServiceCategories = Object.keys(ServiceCategory);
interface ServiceType {
I've deployed to two regions:
us-east-1
us-west-1
I've configured an instance in each region as my strongswan VPN, and they can connect to the other
region's instance just fine through their EIP.
Both regions have a single VPC with a private and a public subnet.
@jtreminio
jtreminio / gist:bcb78ccb97978a2cbd9e
Last active February 2, 2017 18:27
Sample PuPHPet Apache vhost conf file
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
<VirtualHost *:80>
ServerName awesome.dev
## Vhost docroot
DocumentRoot "/var/www/awesome/web"
[02:58 PM]-[vagrant@packer-virtualbox-iso]-[/usr/local/rvm/gems/ruby-1.9.3-p547/bin]
$ ./puppet --version
/usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'puppet' (>= 0) among 19 total gem(s) (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from ./puppet:22:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
<?php
interface Baz
{
public function BazBaz();
}
=========
interface Bar extends Baz

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.
$ sudo iptables -v -L
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
xdebug.idekey=xdebug
xdebug.remote_host=10.0.2.2
xdebug.default_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_port = 9000
$ sudo strace -o test.log -tt php info.php
15:10:58.267019 execve("/usr/bin/php", ["php", "info.php"], [/* 15 vars */]) = 0
15:10:58.267190 brk(0) = 0x1c6b000
15:10:58.267231 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
15:10:58.267267 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6a46b13000
15:10:58.267295 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
15:10:58.267329 open("/etc/ld.so.cache", O_RDONLY) = 3
15:10:58.267353 fstat(3, {st_mode=S_IFREG|0644, st_size=20514, ...}) = 0
15:10:58.267378 mmap(NULL, 20514, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6a46b0d000