Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
The next step…

M van Dam DragonBe

:octocat:
The next step…
View GitHub Profile
@DragonBe
DragonBe / azure-ad-connect.php
Last active May 17, 2022
A simple PoC to access Azure AD for authentication
View azure-ad-connect.php
<?php
declare(strict_types=1);
use League\OAuth2\Client\Provider\GenericProvider;
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
const APP_SESS_ID = 'AZPHPSID';
const OAUTH_APP_ID = '';
@DragonBe
DragonBe / auth-standard-requirements.md
Last active Aug 16, 2021
The common pattern for user registration, sign in, reset and removal of an account written out
View auth-standard-requirements.md

Auth Stnadard Requirements

Problem statement

To tackle the common application pattern for authenticating, registering, resetting credentials, verifying, and unregistering from an application, the common patterns exists but many implementations make it hard to use the best solutions of different frameworks. While almost each application has this requirement, no standard has been defined.

Possible reasons why it's difficult

  • Too many backend solutions for storing and updating credentials (DB, LDAP/AD, API, SSO, SAML, …)
  • Added complexity when authorisation is required
  • Added complexity when MFA is required
@DragonBe
DragonBe / azureConnectionStringToPdo.php
Created May 2, 2021
Convert an Azure Connection String for MySQL into a PDO resource
View azureConnectionStringToPdo.php
<?php
declare(strict_types=1);
/**
* Example usage:
*
* $connString = 'Database=localdb;Data Source=127.0.0.1:12345;User Id=dbuser;Password=$3cR37!';
* $pdo = azureConnectionStringToPdo($connString);
*/
@DragonBe
DragonBe / WooCommerce Plugin Privacy Checker Concept.md
Created May 10, 2020
Here's a step-by-step process to check if a WooCommerce plugin adopts the privacy functionality provided by the platform by extending WC_Abstract_Privacy.
View WooCommerce Plugin Privacy Checker Concept.md

Plugins checker

This is a small report about plugins I've verified with phpdoc for extending WC_Abstract_Privacy privacy class provided by WooCommerce.

Based on information found in WooCommerce Guidelines for GDPR, Making Woo Extensions GDPR compliant and the whole WC_Abstract_Privacy class API.

Plugins not extending the privacy class

@DragonBe
DragonBe / Vagrantfile-php7.3
Created Oct 8, 2019
Quickly set up a Vagrantbox with Debian 8 and PHP 7.3
View Vagrantfile-php7.3
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.hostname = "jenkins-php7"
config.vm.network "private_network", ip: "192.168.121.4"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "shell", inline: <<-SCRIPT
apt-get update
apt-get upgrade -y
apt-get install -y \
ca-certificates \
@DragonBe
DragonBe / Vagrantfile
Last active Dec 5, 2021
Quickly run PHP 7.2, MySQL 5.7 and Nginx 1.14 within Vagrant
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 2.2.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vagrant.plugins = ["vagrant-vbguest"]
@DragonBe
DragonBe / gitarchive.sh
Created Jun 7, 2018
Creating a GPG signed archive of your GIT source code with SHA 256 checksums in bash
View gitarchive.sh
#!/bin/bash
# Getting the current project's directory
pf=$(printf '%q\n' "${PWD##*/}")
# Getting the current configured user's email
gpguser=$(git config user.email)
if [ -z $gpguser ]
then
echo "!!! ERROR: No user for GIT configured !!!"
@DragonBe
DragonBe / Vagrantfile-php7.2
Created Mar 20, 2018
A quick Vagrant file to get started with PHP 7.2
View Vagrantfile-php7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
@script = <<SCRIPT
# Fix for https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
if ! grep -q "ubuntu-xenial" /etc/hosts; then
echo "127.0.0.1 ubuntu-xenial" >> /etc/hosts
fi
@DragonBe
DragonBe / Vagrantfile
Created Jan 19, 2018
A quick-and-simple VM with PHP 7.2
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.host_name = "phpvm"
config.vm.box_check_update = false
config.vm.network "private_network", ip: "192.168.33.67"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
@DragonBe
DragonBe / azure-sdk-commands.md
Created Dec 1, 2017
Basic Microsoft Azure CLI/SDK commands to quickly launch a web app on Azure cloud services
View azure-sdk-commands.md
azure login
azure group create -t project=<project_name> <group_name> westeurope
azure appserviceplan create <group_name> <service_name> westeurope F1
azure webapp create <group_name> <app_name> westeurope <service_name>
azure webapp config set --phpversion 7.1 --detailederrorloggingenabled true <group_name> <app_name>