@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Symfony\Component\Dotenv\Dotenv; |
| 4 | 4 | |
| 5 | -require dirname(__DIR__).'/vendor/autoload.php'; |
|
| 5 | +require dirname(__DIR__) . '/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | if (!class_exists(Dotenv::class)) { |
| 8 | 8 | throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | // Load cached env vars if the .env.local.php file exists |
| 12 | 12 | // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) |
| 13 | -if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) { |
|
| 13 | +if (is_array($env = @include dirname(__DIR__) . '/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) { |
|
| 14 | 14 | (new Dotenv(false))->populate($env); |
| 15 | 15 | } else { |
| 16 | 16 | // load all the .env files |
| 17 | - (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); |
|
| 17 | + (new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | $_SERVER += $_ENV; |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Symfony\Component\ErrorHandler\Debug; |
| 5 | 5 | use Symfony\Component\HttpFoundation\Request; |
| 6 | 6 | |
| 7 | -require dirname(__DIR__).'/config/bootstrap.php'; |
|
| 7 | +require dirname(__DIR__) . '/config/bootstrap.php'; |
|
| 8 | 8 | |
| 9 | 9 | if ($_SERVER['APP_DEBUG']) { |
| 10 | 10 | umask(0000); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $request = Saml2AuthnRequest::createNew($authnRequest); |
| 201 | 201 | $query = $request->buildRequestQuery(); |
| 202 | 202 | |
| 203 | - $this->getSession()->visit($request->getDestination().'?'.$query); |
|
| 203 | + $this->getSession()->visit($request->getDestination() . '?' . $query); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | $request = Saml2AuthnRequest::createNew($authnRequest); |
| 258 | 258 | $query = $request->buildRequestQuery(); |
| 259 | - $this->getSession()->visit($authnRequest->getDestination().'?'.$query); |
|
| 259 | + $this->getSession()->visit($authnRequest->getDestination() . '?' . $query); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $request = Saml2AuthnRequest::createNew($authnRequest); |
| 299 | 299 | $query = $request->buildRequestQuery(); |
| 300 | - $this->getSession()->visit($request->getDestination().'?'.$query); |
|
| 300 | + $this->getSession()->visit($request->getDestination() . '?' . $query); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -186,20 +186,20 @@ discard block |
||
| 186 | 186 | $this->loadPrivateKey(new PrivateKey('/var/www/html/ci/certificates/sp.key', 'default')) |
| 187 | 187 | ); |
| 188 | 188 | switch ($loa) { |
| 189 | - case "1": |
|
| 190 | - case "2": |
|
| 191 | - case "3": |
|
| 192 | - $authnRequest->setRequestedAuthnContext( |
|
| 193 | - ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/sfo-level' . $loa]] |
|
| 194 | - ); |
|
| 195 | - break; |
|
| 196 | - case "self-asserted": |
|
| 197 | - $authnRequest->setRequestedAuthnContext( |
|
| 198 | - ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/loa-self-asserted']] |
|
| 199 | - ); |
|
| 200 | - break; |
|
| 201 | - default: |
|
| 202 | - throw new RuntimeException(sprintf('The specified LoA-%s is not supported', $loa)); |
|
| 189 | + case "1": |
|
| 190 | + case "2": |
|
| 191 | + case "3": |
|
| 192 | + $authnRequest->setRequestedAuthnContext( |
|
| 193 | + ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/sfo-level' . $loa]] |
|
| 194 | + ); |
|
| 195 | + break; |
|
| 196 | + case "self-asserted": |
|
| 197 | + $authnRequest->setRequestedAuthnContext( |
|
| 198 | + ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/loa-self-asserted']] |
|
| 199 | + ); |
|
| 200 | + break; |
|
| 201 | + default: |
|
| 202 | + throw new RuntimeException(sprintf('The specified LoA-%s is not supported', $loa)); |
|
| 203 | 203 | } |
| 204 | 204 | $request = Saml2AuthnRequest::createNew($authnRequest); |
| 205 | 205 | $query = $request->buildRequestQuery(); |
@@ -284,19 +284,19 @@ discard block |
||
| 284 | 284 | ); |
| 285 | 285 | |
| 286 | 286 | switch ($loa) { |
| 287 | - case "1": |
|
| 288 | - case "2": |
|
| 289 | - case "3": |
|
| 290 | - $authnRequest->setRequestedAuthnContext( |
|
| 291 | - ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/level' . $loa]] |
|
| 292 | - ); |
|
| 293 | - break; |
|
| 294 | - case "self-asserted": |
|
| 295 | - $authnRequest->setRequestedAuthnContext( |
|
| 296 | - ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/loa-self-asserted']] |
|
| 297 | - ); |
|
| 298 | - default: |
|
| 299 | - throw new RuntimeException(sprintf('The specified LoA-%s is not supported', $loa)); |
|
| 287 | + case "1": |
|
| 288 | + case "2": |
|
| 289 | + case "3": |
|
| 290 | + $authnRequest->setRequestedAuthnContext( |
|
| 291 | + ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/level' . $loa]] |
|
| 292 | + ); |
|
| 293 | + break; |
|
| 294 | + case "self-asserted": |
|
| 295 | + $authnRequest->setRequestedAuthnContext( |
|
| 296 | + ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/loa-self-asserted']] |
|
| 297 | + ); |
|
| 298 | + default: |
|
| 299 | + throw new RuntimeException(sprintf('The specified LoA-%s is not supported', $loa)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $request = Saml2AuthnRequest::createNew($authnRequest); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | { |
| 105 | 105 | $newAssertion = new Assertion(); |
| 106 | 106 | $newAssertion->setNotBefore(time()); |
| 107 | - $newAssertion->setNotOnOrAfter(time() + (60 * 5));// |
|
| 107 | + $newAssertion->setNotOnOrAfter(time() + (60 * 5)); // |
|
| 108 | 108 | $newAssertion->setAttributes(['urn:mace:dir:attribute-def:eduPersonTargetedID' => [NameID::fromArray($nameId)]]); |
| 109 | 109 | $newAssertion->setIssuer('https://idp.stepup.example.com/'); |
| 110 | 110 | $newAssertion->setIssueInstant(time()); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | use App\Kernel; |
| 4 | 4 | use Symfony\Component\HttpFoundation\Request; |
| 5 | 5 | |
| 6 | -require dirname(__DIR__).'/config/bootstrap.php'; |
|
| 6 | +require dirname(__DIR__) . '/config/bootstrap.php'; |
|
| 7 | 7 | |
| 8 | 8 | $kernel = new Kernel('test', false); |
| 9 | 9 | $request = Request::createFromGlobals(); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $this->hostedIdentityProvider = $hostedIdentityProvider; |
| 67 | 67 | $this->proxyStateHandler = $proxyStateHandler; |
| 68 | 68 | $this->assertionSigningService = $assertionSigningService; |
| 69 | - $this->currentTime = is_null($now) ? new DateTime('now', new DateTimeZone('UTC')): $now; |
|
| 69 | + $this->currentTime = is_null($now) ? new DateTime('now', new DateTimeZone('UTC')) : $now; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | ->scalarNode('http_basic_realm') |
| 34 | 34 | ->defaultValue('Secure Gateway API') |
| 35 | 35 | ->validate() |
| 36 | - ->ifTrue(function ($realm) { |
|
| 36 | + ->ifTrue(function($realm) { |
|
| 37 | 37 | return !is_string($realm) || empty($realm); |
| 38 | 38 | }) |
| 39 | 39 | ->thenInvalid("Invalid HTTP Basic realm '%s'. Must be string and non-empty.") |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | return new JsonResponse(['status' => 'OK']); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $errors = array_map(function ($error) { |
|
| 50 | + $errors = array_map(function($error) { |
|
| 51 | 51 | return sprintf('%s (#%d)', $error['description'], $error['code']); |
| 52 | 52 | }, $result->getRawErrors()); |
| 53 | 53 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $configuration = new Configuration(); |
| 42 | 42 | $config = $this->processConfiguration($configuration, $configs); |
| 43 | 43 | |
| 44 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 44 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 45 | 45 | $loader->load('services.yml'); |
| 46 | 46 | |
| 47 | 47 | $connectedServiceProviders = $container->getDefinition('gssp.allowed_sps'); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $hostedDefinition = $this->buildHostedEntityDefinition($provider, $configuration, $routes); |
| 137 | 137 | $container->setDefinition('gssp.provider.' . $provider . '.hosted_entities', $hostedDefinition); |
| 138 | 138 | |
| 139 | - $hostedSpDefinition = (new Definition()) |
|
| 139 | + $hostedSpDefinition = (new Definition()) |
|
| 140 | 140 | ->setClass('Surfnet\SamlBundle\Entity\ServiceProvider') |
| 141 | 141 | ->setFactory([new Reference('gssp.provider.' . $provider . '.hosted_entities'), 'getServiceProvider']) |
| 142 | 142 | ->setPublic(false); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | private function createRemoteDefinition($provider, array $configuration, ContainerBuilder $container) |
| 191 | 191 | { |
| 192 | - $definition = new Definition('Surfnet\SamlBundle\Entity\IdentityProvider', [ |
|
| 192 | + $definition = new Definition('Surfnet\SamlBundle\Entity\IdentityProvider', [ |
|
| 193 | 193 | [ |
| 194 | 194 | 'entityId' => $configuration['entity_id'], |
| 195 | 195 | 'ssoUrl' => $configuration['sso_url'], |