Skip to content

Commit

Permalink
Merge pull request #30 from OpenConext/feature/sympony-4
Browse files Browse the repository at this point in the history
Support sf4. Remove RMT releases.
  • Loading branch information
Eric Pinxteren authored Sep 16, 2019
2 parents aace66a + 102f410 commit b3f0e3e
Show file tree
Hide file tree
Showing 19 changed files with 308 additions and 158 deletions.
38 changes: 0 additions & 38 deletions .rmt.yml

This file was deleted.

11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
language: php

php:
- 5.6
- 7.0
- 7.1
matrix:
include:
- php: 7.2
env: SYMFONY_VERSION="3.4.*"
- php: 7.2
env: SYMFONY_VERSION="4.3.*"

cache:
directories:
- ~/.composer/cache/files

before_script:
- phpenv config-add travis.php.ini
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- composer install --no-interaction

script:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
VERSION 3 Support sf4
===========================================
Support symfony 4, set min php req to php 7.2

Version 3.0 - Support sf4

VERSION 2 Don't do error handling
===========================================
Expand Down
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,7 @@ Every part can be run separately. Check "scripts" section of the composer.json f
Release instructions
=====================

The projects follow semantic versioning. To create a new release perform the following steps:

1. Merge feature branch in development branch.

2. Merge development branch in master branch.

3. Checkout and update (pull) master branch

4. Create version with RMT

```bash
./RMT release
```

5. Release the new version on github [Releases](https://github.com/OpenConext/Stepup-gssp-bundle/releases)
Please read: https://github.com/OpenConext/Stepup-Deploy/wiki/Release-Management for more information on the release strategy used in Stepup projects.

Other resources
======================
Expand Down
4 changes: 0 additions & 4 deletions RMT

This file was deleted.

2 changes: 1 addition & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ default:
bundle:
contexts:
- Surfnet\GsspBundle\Features\Context\GsspContext:
paths: [ %paths.base%/src/Features ]
paths: [ '%paths.base%/src/Features' ]
166 changes: 83 additions & 83 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
{
"name": "surfnet/stepup-gssp-bundle",
"license": "Apache-2.0",
"description": "Generic SAML Stepup Provider bundle.",
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Surfnet\\GsspBundle\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Surfnet\\GsspBundle\\": "tests/"
},
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"require": {
"php": ">=5.5.9",
"ext-openssl": "*",
"beberlei/assert": "^2.7",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"surfnet/stepup-saml-bundle": "^4.0",
"symfony-bundles/bundle-dependency": "^1.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.3.10",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"behat/behat": "^3.4",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"liip/rmt": "^1.2",
"malukenho/docheader": "^0.1.6",
"mockery/mockery": "^1.0",
"phpmd/phpmd": "^2.6",
"phpunit/phpcov": "^3.1",
"phpunit/phpunit": "^5.7",
"sebastian/phpcpd": "^3.0",
"sensio/generator-bundle": "^3.0",
"squizlabs/php_codesniffer": "^3.1",
"symfony/phpunit-bridge": "^3.3",
"symfony/symfony": "^3.3"
},
"scripts": {
"test": [
"@lint",
"@static-analysis",
"@phpunit",
"@behat"
],

"lint": ["@lint-php", "@lint-composer"],
"lint-php": "vendor/bin/parallel-lint src tests",
"lint-composer": "composer validate",

"static-analysis": ["@license-headers", "@phpmd", "@phpcs", "@phpcpd"],
"license-headers": "vendor/bin/docheader check src/ tests/",
"phpmd": "vendor/bin/docheader check src/ tests/",
"phpcs": [
"vendor/bin/phpcs --standard=phpcs.xml --report=full --warning-severity=0 ./src",
"vendor/bin/phpcs --standard=phpcs_tests.xml --report=full --warning-severity=0 ./tests"
],
"phpcbf": [
"vendor/bin/phpcbf --standard=phpcs.xml ./src",
"vendor/bin/phpcbf --standard=phpcs_tests.xml ./tests"
],
"phpcpd": ["vendor/bin/phpcpd ./src", "vendor/bin/phpcpd ./tests"],

"phpunit": "vendor/bin/phpunit tests",
"behat": "vendor/bin/behat --config behat.yml",

"coverage": [
"@phpunit-coverage",
"mkdir -p coverage/reports",
"vendor/bin/phpcov merge coverage/reports --html coverage"
],
"phpunit-coverage": "vendor/bin/phpunit tests --coverage-php coverage/reports/unit.cov"
},
"config": {
"sort-packages": true
"name": "surfnet/stepup-gssp-bundle",
"license": "Apache-2.0",
"description": "Generic SAML Stepup Provider bundle.",
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Surfnet\\GsspBundle\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Surfnet\\GsspBundle\\": "tests/"
},
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"require": {
"php": ">=7.2",
"ext-openssl": "*",
"beberlei/assert": "^3",
"sensio/framework-extra-bundle": "^5.4",
"symfony/monolog-bundle": "^3.4",
"surfnet/stepup-saml-bundle": "^4.1.7",
"symfony/dependency-injection": ">=2.7,<4 || ~4.3",
"symfony/framework-bundle": ">=2.7,<4 || ~4.3"
},
"require-dev": {
"behat/behat": "^3.5",
"jakub-onderka/php-parallel-lint": "^1",
"malukenho/docheader": "^0",
"mockery/mockery": "^1",
"phpmd/phpmd": "^2",
"phpunit/phpcov": "^6",
"phpunit/phpunit": "^8",
"sebastian/phpcpd": "^4",
"squizlabs/php_codesniffer": "^3",
"symfony/phpunit-bridge": "~4"
},
"scripts": {
"test": [
"@lint",
"@static-analysis",
"@phpunit",
"@behat"
],
"lint": [
"@lint-php",
"@lint-composer"
],
"lint-php": "vendor/bin/parallel-lint src tests",
"lint-composer": "composer validate",
"static-analysis": [
"@license-headers",
"@phpmd",
"@phpcs",
"@phpcpd"
],
"license-headers": "vendor/bin/docheader check src/ tests/",
"phpmd": "vendor/bin/docheader check src/ tests/",
"phpcs": [
"vendor/bin/phpcs --standard=phpcs.xml --report=full --warning-severity=0 ./src",
"vendor/bin/phpcs --standard=phpcs_tests.xml --report=full --warning-severity=0 ./tests"
],
"phpcbf": [
"vendor/bin/phpcbf --standard=phpcs.xml ./src",
"vendor/bin/phpcbf --standard=phpcs_tests.xml ./tests"
],
"phpcpd": [
"vendor/bin/phpcpd ./src",
"vendor/bin/phpcpd ./tests"
],
"phpunit": "vendor/bin/phpunit tests",
"behat": "vendor/bin/behat --config behat.yml",
"coverage": [
"@phpunit-coverage",
"mkdir -p coverage/reports",
"vendor/bin/phpcov merge coverage/reports --html coverage"
],
"phpunit-coverage": "vendor/bin/phpunit tests --coverage-php coverage/reports/unit.cov"
},
"config": {
"sort-packages": true
}
}
2 changes: 1 addition & 1 deletion homestead/Homestead.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ memory: 4096
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
php: 5.6
php: 7.2
keys:
- ~/.ssh/id_rsa
folders:
Expand Down
4 changes: 2 additions & 2 deletions homestead/after.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
cd /home/vagrant/code

# Use comstom .ini file for xdebug.
sudo cp /home/vagrant/code/homestead/php.ini /etc/php/5.6/mods-available/custom.ini
sudo phpenmod -v 5.6 custom
sudo cp /home/vagrant/code/homestead/php.ini /etc/php/7.2/mods-available/custom.ini
sudo phpenmod -v 7.2 custom

composer install

Expand Down
17 changes: 17 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ services:
class: Surfnet\GsspBundle\Controller\MetadataController
arguments:
- '@surfnet_saml.metadata_factory'
tags: ['controller.service_arguments']
public: true

Surfnet\GsspBundle\Controller\MetadataController:
alias: surfnet_gssp.saml.metadata_controller
public: true

surfnet_gssp.saml.sso_controller:
class: Surfnet\GsspBundle\Controller\SSOController
Expand All @@ -12,6 +18,12 @@ services:
- '@surfnet_gssp.state_handler.service'
- '@surfnet_gssp.saml.reponse_context'
- '@surfnet_gssp.logger'
tags: ['controller.service_arguments']
public: true

Surfnet\GsspBundle\Controller\SSOController:
alias: surfnet_gssp.saml.sso_controller
public: true

surfnet_gssp.saml.sso_return_controller:
class: Surfnet\GsspBundle\Controller\SSOReturnController
Expand All @@ -21,6 +33,11 @@ services:
- '@surfnet_gssp.service.response'
- '@surfnet_gssp.saml.reponse_context'
- '@surfnet_gssp.logger'
tags: ['controller.service_arguments']
public: true
Surfnet\GsspBundle\Controller\SSOReturnController:
alias: surfnet_gssp.saml.sso_return_controller
public: true

surfnet_gssp.value_store.service:
class: Surfnet\GsspBundle\Service\ValueStore\SessionValueStore
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/StepupGssp/ssoReturn.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends '::base.html.twig' %}
{% extends 'base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link href="{{ asset('bundles/surfnetgssp/css/hiddensubmit.css') }}" type="text/css" rel="stylesheet" media="screen"/>
Expand Down
7 changes: 7 additions & 0 deletions src/Service/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public function authenticationRequired();
*/
public function authenticate();

/**
* If the user is authenticated
*
* @return boolean
*/
public function isAuthenticated();

/**
* @param string $message
* The error message.
Expand Down
7 changes: 7 additions & 0 deletions src/Service/RegistrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public function registrationRequired();
*/
public function register($subjectNameId);

/**
* If the user is already registered.
*
* @return boolean
*/
public function isRegistered();

/**
* @param string $message
* The error message.
Expand Down
11 changes: 10 additions & 1 deletion src/Service/StateBasedAuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,22 @@ public function authenticationRequired()
public function authenticate()
{
if (!$this->stateHandler->isRequestTypeAuthentication()) {
$this->logger->critical('Current request does not need a authentication');
$this->logger->critical('Current request does not need an authentication');
throw RuntimeException::shouldNotAuthenticate();
}
$this->logger->notice('Application authenticates the user');
$this->stateHandler->authenticate();
}

public function isAuthenticated()
{
if (!$this->stateHandler->isRequestTypeAuthentication()) {
$this->logger->critical('Current request does not need an authentication');
throw RuntimeException::shouldNotAuthenticate();
}
return $this->stateHandler->isAuthenticated();
}

public function reject($message, $subCode = Constants::STATUS_AUTHN_FAILED)
{
$this->logger->critical($message);
Expand Down
Loading

0 comments on commit b3f0e3e

Please sign in to comment.