Skip to content

Instantly share code, notes, and snippets.

View nepda's full-sized avatar

Nepomuk Pajonk nepda

View GitHub Profile
@nepda
nepda / .gitignore
Last active October 31, 2018 17:38 — forked from ThomasRueckert/unifysell-api-install.sh
Complete basic working example for using the unifysell API with the PHP SDK. [unifysell Account required]
vendor/
composer.lock
@nepda
nepda / example-auth-openidc.conf
Created March 25, 2018 19:07
apache mod_auth_openidc
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html/
@nepda
nepda / server.php
Created March 25, 2018 18:58
Proof of concept keycloak - server.php
<?php
require_once 'vendor/autoload.php';
use \Firebase\JWT\JWT;
$jwt = explode(' ', $_SERVER['HTTP_AUTHORIZATION'])[1];
$key = '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmistH3NpQsolL6XBGeMMe0W3E67Yfc9kSe+/hlY12r2FSjb3JC0kpO8elrAGbJMRvuWI7d1RmWirhfoDOmwZoNBm0SoHuTXFOw/FKFt+opNbTmOciXg5HmbvXUnr+KSCQUx0NBwoW+LUGZLhYi5nVaidF1Ic02ttSOa9Ldlw+uYQRQABhJ9usUkrEkvlzVFtNEGOMwEAA4uqNn9gs1Jnn8P3k511/YqkH0PLpyGg2i2q3QQydo1Bx302wn9C2O4LgA6RW6uGnOw3oMvfn050nlwrhJ+3cjdU1tmZQYujovtULXU9e5IUMo3EOIB6JgymXrvlrewwy7iPl61m4sRMbQIDAQAB
@nepda
nepda / client.php
Created March 25, 2018 18:57
Proof of concept keycloak - client.php
<?php
require_once 'vendor/autoload.php';
define('AUTH_SERVER_URL', 'http://localhost:8080');
define('AUTH_REALM', 'my-app');
define('AUTH_CLIENT_ID', 'my-client');
define('AUTH_CLIENT_SECRET', '1b148a52-3d7e-4d04-992a-255e25c6311c');
$tokenObject = null;
@nepda
nepda / composer.json
Last active March 25, 2018 18:57
Proof of concept keycloak - composer.json
{
"require": {
"league/oauth2-client": "2.*",
"stevenmaguire/oauth2-keycloak": "2.*"
}
}
wget https://downloads.jboss.org/keycloak/3.4.3.Final/keycloak-3.4.3.Final.zip
unzip keycloak-3.4.3.Final.zip
cd keycloak-3.4.3.Final
bash ./bin/standalone.sh
@nepda
nepda / graceful-bash-loop-exiting.sh
Created January 5, 2018 13:26
Stop bash loop gracefully with trap for Ctr+C
#!/bin/bash
stop=0
function ctr_c {
stop=1
echo " caught. Gracefully stopping"
trap - SIGINT SIGTERM
echo "Press Ctr+C again to force SIGINT"
}
trap "ctr_c" SIGINT SIGTERM
@nepda
nepda / systemd-stop-and-wait.sh
Created December 21, 2017 09:46
Stopping and waiting for PID to be finished for systemd user services
#!/usr/bin/env bash
serviceName=$1
if [ "${serviceName}" = "" ] || [ "${serviceName}" = "--help" ]
then
echo "Usage $0 [service-name.service]"
echo ""
echo "Stops the systemd user services and waits for real end of processes"
echo "Stops also all services which ConsistsOf this one (recursively)"
{"message":"An error occurred during dispatching of command \u0022Prooph\\ProophessorDo\\Model\\User\\Command\\RegisterUser\u0022","trace":"#
0 /var/www/vendor/zendframework/zend-expressive/src/Middleware/LazyLoadingMiddleware.php(60): Prooph\\Psr7Middleware\\CommandMiddleware-\u003Eprocess(Object(Zend\\Diactoros\\ServerRequest), Object(Zend\\Stratigility\\Next))\n#
1 /var/www/vendor/zendframework/zend-stratigility/src/Next.php(144): Zend\\Expressive\\Middleware\\LazyLoadingMiddleware-\u003Eprocess(Object(Zend\\Diactoros\\ServerRequest), Object(Zend\\Stratigility\\Next))\n#
2 /var/www/vendor/zendframework/zend-stratigility/src/Next.php(95): Zend\\Stratigility\\Next-\u003Ehandle(Object(Zend\\Diactoros\\ServerRequest))\n#
3 /var/www/src/Middleware/JsonError.php(32): Zend\\Stratigility\\Next-\u003Eprocess(Object(Zend\\Diactoros\\ServerRequest))\n#
4 /var/www/vendor/zendframework/zend-stratigility/src/Next.php(144): Prooph\\ProophessorDo\\Middleware\\JsonError-\u003Eprocess(Object(Zend\\Diactoros\\ServerRequest),
<?php
require_once 'vendor/autoload.php';
$integrationAdminTokenService = new Swagger\Client\Api\IntegrationAdminTokenServiceV1Api();
$loginBody = new \Swagger\Client\Model\Body136();
$loginBody->setPassword('username');
$loginBody->setUsername('password');
$token = $integrationAdminTokenService->integrationAdminTokenServiceV1CreateAdminAccessTokenPost($loginBody);