Commit 8ffbbed6 authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Merge branch 'saml-auth-integration' into 'master'

Saml auth integration

See merge request kretschmar/doorcode!9
parents 159c94a9 abe605d7
Pipeline #2224 passed with stages
in 1 minute and 53 seconds
......@@ -24,6 +24,12 @@ build_web_backend:
# Currently set to build timeout
expire_in: 1 hour
test_php_styles:
stage: test
script:
- cd src/web/backend
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --stop-on-violation --using-cache=no
test_web_backend_unit:
stage: test
script:
......
error_reporting = E_ALL
display_startup_errors = On
display_errors = On
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
xdebug.remote_port=9999
xdebug.remote_autostart=1
# DockerNAT gateway IP
xdebug.remote.host=host.docker.internal
xdebug.remote.mode=req
xdebug.remote.handler=dbgp
......@@ -27,7 +27,7 @@ $config = [
* external url, no matter where you come from (direct access or via the
* reverse proxy).
*/
'baseurlpath' => 'http://localhost:8080/simplesaml-idp/',
'baseurlpath' => 'https://localhost:8080/simplesaml-idp/',
/*
* The 'application' configuration array groups a set configuration options
......
......@@ -6,13 +6,13 @@
* See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-sp-remote
*/
$metadata['http://localhost:8080/simplesaml/module.php/saml/sp/metadata.php/default-sp'] = array (
$metadata['https://localhost:8080/simplesaml/module.php/saml/sp/metadata.php/default-sp'] = array (
'SingleLogoutService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://localhost:8080/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp',
'Location' => 'https://localhost:8080/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp',
),
),
'AssertionConsumerService' =>
......@@ -21,25 +21,25 @@ $metadata['http://localhost:8080/simplesaml/module.php/saml/sp/metadata.php/defa
array (
'index' => 0,
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'http://localhost:8080/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
'Location' => 'https://localhost:8080/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
),
1 =>
array (
'index' => 1,
'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
'Location' => 'http://localhost:8080/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp',
'Location' => 'https://localhost:8080/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp',
),
2 =>
array (
'index' => 2,
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact',
'Location' => 'http://localhost:8080/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
'Location' => 'https://localhost:8080/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
),
3 =>
array (
'index' => 3,
'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01',
'Location' => 'http://localhost:8080/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp/artifact',
'Location' => 'https://localhost:8080/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp/artifact',
),
),
'certData' => 'MIIEwTCCAymgAwIBAgIUOBK2NqzhcX63Vj6AIoGNzzRp8WgwDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xFjAUBgNVBAcMDUNvbGxlZ2UgUGxhY2UxHzAdBgNVBAoMFldhbGxhIFdhbGxhIFVuaXZlcnNpdHkxEzARBgNVBAsMCktyZXRzY2htYXIwHhcNMjAwMTIxMTAyODE1WhcNMzAwMTIwMTAyODE1WjBwMQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjEWMBQGA1UEBwwNQ29sbGVnZSBQbGFjZTEfMB0GA1UECgwWV2FsbGEgV2FsbGEgVW5pdmVyc2l0eTETMBEGA1UECwwKS3JldHNjaG1hcjCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKSU6Xayh+chaCvKHwMuvKZcxt6Qrt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kC+kLViYkrN/dzLMgYREBoyY6cB9HjYI1qd3KKk6wUDwKtQp729pKLY7Mnw26U0AHCPYBn',
......
......@@ -25,7 +25,7 @@ $config = [
// The entity ID of the IdP this SP should contact.
// Can be NULL/unset, in which case the user will be shown a list of available IdPs.
'idp' => 'http://localhost:8080/simplesaml-idp/saml2/idp/metadata.php',
'idp' => 'https://localhost:8080/simplesaml-idp/saml2/idp/metadata.php',
// The URL to the discovery service.
// Can be NULL/unset, in which case a builtin discovery service will be used.
......
......@@ -8,15 +8,15 @@
* See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-idp-remote
*/
$metadata['http://localhost:8080/simplesaml-idp/saml2/idp/metadata.php'] = array (
$metadata['https://localhost:8080/simplesaml-idp/saml2/idp/metadata.php'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'http://localhost:8080/simplesaml-idp/saml2/idp/metadata.php',
'entityid' => 'https://localhost:8080/simplesaml-idp/saml2/idp/metadata.php',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://localhost:8080/simplesaml-idp/saml2/idp/SSOService.php',
'Location' => 'https://localhost:8080/simplesaml-idp/saml2/idp/SSOService.php',
),
),
'SingleLogoutService' =>
......@@ -24,7 +24,7 @@ $metadata['http://localhost:8080/simplesaml-idp/saml2/idp/metadata.php'] = array
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://localhost:8080/simplesaml-idp/saml2/idp/SingleLogoutService.php',
'Location' => 'https://localhost:8080/simplesaml-idp/saml2/idp/SingleLogoutService.php',
),
),
'certData' => 'MIIEwTCCAymgAwIBAgIUWlixu/uHDLux2Txl3HGBngrYZxQwDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xFjAUBgNVBAcMDUNvbGxlZ2UgUGxhY2UxHzAdBgNVBAoM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/WcKga7IVb7/xNw5uqWfJI+ndtz45AwJ/zpzQjvAMipZwjtwAgryXhcAdBlzhSRNdysPPCDCxjQWqaI+SSWMa0Ud/frXgYeOP9ID73qOf9rKrSjftJKXCYpXsjGykkv9GrCjJxe+usRSHXw6ddrO7aYfl7mXjsXQh+OlhuKog8MGUOQMa2I14qn8qTPKNmMl62Qu06pYFgDez9oLPM40mEilRpNQHO/lDqwS8J6x8Ir/Ub8a38s+VkIWGHsnvLDR/tHW0VI+RGsL10hsUbV2geIQ0CkDOJMo9kohlLqBf0WKr+sSRH7n/M/Kd0bccERTnr9NYl76Wuddo3v4JcIf48vYE8pUFDmCTGRwnTN6vCnNZLvWa/+WwYLpN8KhYW',
......
......@@ -10,3 +10,4 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.php_cs.cache
<?php
$finder = PhpCsFixer\Finder::create()
->in(realpath(__DIR__ . '/app'))
->in(realpath(__DIR__ . '/src'))
->in(realpath(__DIR__ . '/config'))
->in(realpath(__DIR__ . '/database'))
->in(realpath(__DIR__ . '/routes'))
->in(realpath(__DIR__ . '/tests'));
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sortAlgorithm' => 'length'
]
])
->setUsingCache(true)
->setFinder($finder);
......@@ -3,17 +3,18 @@
namespace App\Console\Commands\GatewayCommands;
use Illuminate\Console\GeneratorCommand;
abstract class BaseGatewayFileGenerator extends GeneratorCommand {
abstract class BaseGatewayFileGenerator extends GeneratorCommand
{
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace) {
protected function getDefaultNamespace($rootNamespace)
{
$namespace = $rootNamespace . '\\Gateways';
foreach (explode('/', $this->getNameInput()) as $folder) {
$namespace .= '\\' . $folder;
......@@ -27,7 +28,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
* @param string $name
* @return string
*/
protected function getNamespace($name) {
protected function getNamespace($name)
{
return $this->getDefaultNamespace($this->rootNamespace());
}
......@@ -38,7 +40,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name) {
protected function replaceClass($stub, $name)
{
$name = last(explode('\\', $name));
return parent::replaceClass($stub, $name);
}
......@@ -48,7 +51,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
*
* @return string
*/
public function rootNamespace() {
public function rootNamespace()
{
return 'Source';
}
}
......@@ -3,10 +3,10 @@
namespace App\Console\Commands\GatewayCommands;
use Illuminate\Console\Command;
class CreateGateway extends Command {
class CreateGateway extends Command
{
/**
* The name and signature of the console command.
*
......@@ -24,7 +24,8 @@ class CreateGateway extends Command {
/**
* Execute the console command.
*/
public function handle(): void {
public function handle(): void
{
$name = $this->argument('name');
$this->call(
'gateway:create-interface',
......
......@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands;
class GenerateBaseGateway extends BaseGatewayFileGenerator {
class GenerateBaseGateway extends BaseGatewayFileGenerator
{
/**
* The name and signature of the console command.
*
......@@ -31,7 +31,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator {
*
* @return string
*/
protected function getStub() {
protected function getStub()
{
return __DIR__ . '/stubs/Repository.stub';
}
......@@ -41,7 +42,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator {
* @param string $name
* @return string
*/
protected function getPath($name) {
protected function getPath($name)
{
$baseName = $this->getNameInput();
$className = last(explode('/', $baseName));
......
......@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands;
class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator {
class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator
{
/**
* The name and signature of the console command.
*
......@@ -31,7 +31,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator {
*
* @return string
*/
protected function getStub() {
protected function getStub()
{
$type = $this->argument('type');
return __DIR__ . '/stubs/' . ucfirst($type) . '.stub';
}
......@@ -42,7 +43,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator {
* @param string $name
* @return string
*/
protected function getPath($name) {
protected function getPath($name)
{
$name = $this->getNameInput();
$type = $this->argument('type');
return $this->laravel->basePath() . '/src/Gateways/' . $name . '/' . $type . $name . 'Repository.php';
......
......@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands;
class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator {
class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator
{
/**
* The name and signature of the console command.
*
......@@ -31,7 +31,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator {
*
* @return string
*/
protected function getStub() {
protected function getStub()
{
return __DIR__ . '/stubs/Provider.stub';
}
......@@ -41,7 +42,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator {
* @param string $name
* @return string
*/
protected function getPath($name) {
protected function getPath($name)
{
$fullName = $this->getNameInput();
$className = last(explode('/', $fullName));
......
......@@ -3,6 +3,6 @@
namespace DummyNamespace;
class DatabaseDummyClassRepository implements DummyClassRepository {
class DatabaseDummyClassRepository implements DummyClassRepository
{
}
......@@ -3,6 +3,6 @@
namespace DummyNamespace;
class InMemoryDummyClassRepository implements DummyClassRepository {
class InMemoryDummyClassRepository implements DummyClassRepository
{
}
......@@ -3,6 +3,6 @@
namespace DummyNamespace;
class LocalDummyClassRepository extends InMemoryDummyClassRepository {
class LocalDummyClassRepository extends InMemoryDummyClassRepository
{
}
......@@ -3,7 +3,6 @@
namespace DummyNamespace;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Support\DeferrableProvider;
......@@ -11,13 +10,15 @@ use Illuminate\Contracts\Support\DeferrableProvider;
/**
* Service provider must be registered in AppServiceProvider
*/
class DummyClassRepositoryServiceProvider extends ServiceProvider implements DeferrableProvider {
class DummyClassRepositoryServiceProvider extends ServiceProvider implements DeferrableProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register() {
public function register()
{
$this->app->singleton(DummyClassRepository::class, static function (Application $app) {
if (env('APP_ENV') === 'memory') {
return new LocalDummyClassRepository();
......@@ -36,13 +37,15 @@ class DummyClassRepositoryServiceProvider extends ServiceProvider implements Def
*
* @return void
*/
public function boot(): void {
public function boot(): void
{
}
/**
* @return array
*/
public function provides() {
public function provides()
{
return [DummyClassRepository::class];
}
}
......@@ -3,6 +3,6 @@
namespace DummyNamespace;
interface DummyClassRepository {
interface DummyClassRepository
{
}
......@@ -4,14 +4,16 @@ namespace App\Console\Commands\UseCaseCommands;
use Illuminate\Console\GeneratorCommand;
abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
abstract class BaseUseCaseFileGenerator extends GeneratorCommand
{
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace) {
protected function getDefaultNamespace($rootNamespace)
{
$namespace = $rootNamespace . '\\UseCases';
foreach (explode('/', $this->getNameInput()) as $folder) {
$namespace .= '\\' . $folder;
......@@ -25,7 +27,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
* @param string $name
* @return string
*/
protected function getNamespace($name) {
protected function getNamespace($name)
{
return $this->getDefaultNamespace($this->rootNamespace());
}
......@@ -36,7 +39,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name) {
protected function replaceClass($stub, $name)
{
$name = last(explode('\\', $name));
return parent::replaceClass($stub, $name);
}
......@@ -46,7 +50,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
*
* @return string
*/
public function rootNamespace() {
public function rootNamespace()
{
return 'Source';
}
}
......@@ -4,7 +4,8 @@ namespace App\Console\Commands\UseCaseCommands;
use Illuminate\Console\Command;
class CreateUseCase extends Command {
class CreateUseCase extends Command
{
/**
* The name and signature of the console command.
*
......@@ -22,7 +23,8 @@ class CreateUseCase extends Command {
/**
* Execute the console command.
*/
public function handle(): void {
public function handle(): void
{
$name = $this->argument('name');
$this->call(
'use-case:create-use-case',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment