Skip to content

Instantly share code, notes, and snippets.

View DragonBe's full-sized avatar
:octocat:
The next step…

M van Dam DragonBe

:octocat:
The next step…
View GitHub Profile
@DragonBe
DragonBe / UserShield.php
Created April 12, 2023 21:13
This class provides encryption and decryption possibilities to store sensitive data or personal information in a secure way.
<?php
declare(strict_types=1);
namespace Dragonbe\Utility;
use Exception;
/**
* This class provides two-way encryption and decryption
* possibilities to store sensitive data or personal
@DragonBe
DragonBe / azure-ad-connect.php
Last active December 5, 2024 12:38
A simple PoC to access Azure AD for authentication
<?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 August 16, 2021 07:03
The common pattern for user registration, sign in, reset and removal of an account written out

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 21:24
Convert an Azure Connection String for MySQL into a PDO resource
<?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 17:46
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.

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 October 8, 2019 21:44
Quickly set up a Vagrantbox with Debian 8 and PHP 7.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 December 5, 2021 23:03
Quickly run PHP 7.2, MySQL 5.7 and Nginx 1.14 within Vagrant
# -*- 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 June 7, 2018 07:47
Creating a GPG signed archive of your GIT source code with SHA 256 checksums in bash
#!/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 March 20, 2018 09:29
A quick Vagrant file to get started with PHP 7.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 January 19, 2018 16:26
A quick-and-simple VM with PHP 7.2
# -*- 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"