Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Feature/registration #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/web/css/
/web/js/

# Vagrant files #
#################
Expand Down
51 changes: 49 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
language: php

dist: trusty

addons:
hosts:
- gssp.stepup.example.com
apt:
packages:
- cmake
- apache2

php:
- 5.6
- 7.0
Expand All @@ -10,8 +20,45 @@ cache:
- ~/.composer/cache/files

before_script:
- phpenv config-add .travis.php.ini
- composer install --no-interaction
# configure ssl
- sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/certs/gssp.key -out /etc/ssl/certs/gssp.crt -subj "/C=NL/ST=Netherlands/L=Amsterdam/O=TEST/CN=gssp.stepup.example.com"

- sudo apt-get update
- sudo apt-get install apache2 libapache2-mod-fastcgi
- export PHP_VERSION=$(phpenv version-name)
- sudo cp ~/.phpenv/versions/${PHP_VERSION}/etc/php-fpm.conf.default ~/.phpenv/versions/${PHP_VERSION}/etc/php-fpm.conf
- sudo cp ~/.phpenv/versions/${PHP_VERSION}/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/${PHP_VERSION}/etc/php-fpm.d/www.conf || true
- sudo a2enmod rewrite actions fastcgi alias ssl proxy proxy_fcgi
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/${PHP_VERSION}/etc/php.ini
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
- ~/.phpenv/versions/${PHP_VERSION}/sbin/php-fpm

# configure apache virtual hosts
- sudo cp -f ${TRAVIS_BUILD_DIR}/travis-ci-apache.conf /etc/apache2/sites-available/000-default.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo sed -e "s?%PHP_VERSION%?${PHP_VERSION}?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo cat /etc/apache2/sites-available/000-default.conf

# Create apache error log.
- touch $TRAVIS_BUILD_DIR/error.log
- sudo service apache2 restart

# Install dependencies
- composer install

# Check if everything runs properly
- ps aux | grep php-fpm
- netstat -an | grep :9000
- curl --insecure https://gssp.stepup.example.com
- curl --insecure https://gssp.stepup.example.com/bootstrap.min.js

script:
# Test if the website is actually running
- ./bin/bootstrap_phantomjs.sh
- composer test

after_script:
- cat $TRAVIS_BUILD_DIR/error.log
- cat $TRAVIS_BUILD_DIR/build/*.html
- sudo cat /var/log/syslog
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ It's configured with auto connect IDE_KEY=phpstorm.
Tests and metrics
======================

To run all required test you can run the following command from the dev env:
To run all required test you can run the following commands from the dev env:

```composer test```
```
./bin/bootstrap_phantomjs.sh

composer test
```

Every part can be run separately. Check "scripts" section of the composer.json file for the different options.

Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder ".", "/var/www/gssp.stepup.example.com", type: "nfs"

config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "1024"]
v.customize ["modifyvm", :id, "--memory", "3048"]
end

config.vm.provision "ansible" do |ansible|
Expand Down
1 change: 1 addition & 0 deletions ansible/requirements.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- name: openmicroscopy.nginx-ssl-selfsigned
- name: reallyenglish.ntpd
5 changes: 2 additions & 3 deletions ansible/templates/php.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,8 @@ max_input_time = 60
; http://www.php.net/manual/en/info.configuration.php#ini.max-input-nesting-level
;max_input_nesting_level = 64

; Maximum amount of memory a script may consume (128MB)
; http://www.php.net/manual/en/ini.core.php#ini.memory-limit
memory_limit = 128M
; Set high memory limit for composer install
memory_limit = 2048M

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
Expand Down
3 changes: 3 additions & 0 deletions ansible/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
app_web_root: "{{ app_root }}/web"
vhost_name: gssp.stepup.example.com
nginx_ssl_certificate_subject: "/C=NL/ST=Netherlands/L=Amsterdam/O=TEST/CN={{ ansible_fqdn }}"
ntpd_leap_seconds_url: ''

handlers:
- name: restart php-fpm
Expand All @@ -27,3 +28,5 @@

- include: tasks/main.yml

roles:
- reallyenglish.ntpd
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public function registerBundles()
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Surfnet\SamlBundle\SurfnetSamlBundle(),
new Surfnet\GsspBundle\SurfnetGsspBundle(),
new AppBundle\AppBundle(),
Expand Down
5 changes: 4 additions & 1 deletion app/Resources/views/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
<title>{% block title %}GSSP example project!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="stylesheet" href="{{ asset('bootstrap.min.css') }}">
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}{% endblock %}
<script src="{{ asset('jquery-1.11.3.min.js') }}"></script>
<script src="{{ asset('bootstrap.min.js') }}"></script>
{% block javascripts %}{% endblock %}
</body>
</html>
23 changes: 16 additions & 7 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,34 @@ framework:
php_errors:
log: true

assetic:
debug: "%kernel.debug%"
use_controller: false
bundles:
- SurfnetGsspBundle
filters:
cssrewrite: ~

surfnet_saml:
hosted:
identity_provider:
enabled: true
service_provider_repository: surfnet_gssp.saml.service_provider_repository
sso_route: sso
service_provider_repository: surfnet_saml.remote.service_providers
sso_route: gssp_saml_sso
public_key: "%saml_idp_publickey%"
private_key: "%saml_idp_privatekey%"
metadata:
entity_id_route: gssp_saml_metadata
public_key: "%saml_metadata_publickey%"
private_key: "%saml_metadata_privatekey%"
remote:
identity_provider:
enabled: true
entity_id: "%saml_remote_idp_entity_id%"
sso_url: "%saml_remote_idp_sso_url%"
certificate_file: "%saml_remote_idp_certificate%"
service_providers:
- entity_id: "%saml_remote_sp_entity_id%"
certificate_file: "%saml_remote_sp_certificate%"
assertion_consumer_service_url: "%saml_remote_sp_acs%"

surfnet_gssp:
registration_route: app_identity_registration

# Twig Configuration
twig:
Expand Down
8 changes: 5 additions & 3 deletions app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ parameters:
saml_idp_privatekey: '%kernel.root_dir%/../vendor/surfnet/stepup-saml-bundle/src/Resources/keys/development_privatekey.pem'
saml_metadata_publickey: '%kernel.root_dir%/../vendor/surfnet/stepup-saml-bundle/src/Resources/keys/development_publickey.cer'
saml_metadata_privatekey: '%kernel.root_dir%/../vendor/surfnet/stepup-saml-bundle/src/Resources/keys/development_privatekey.pem'
saml_remote_idp_entity_id: 'https://pieter.aai.surfnet.nl/simplesamlphp/saml2/idp/metadata.php'
saml_remote_idp_sso_url: 'https://pieter.aai.surfnet.nl/simplesamlphp/saml2/idp/SSOService.php'
saml_remote_idp_certificate: '%kernel.root_dir%/../vendor/surfnet/stepup-gssp-bundle/src/Resources/keys/pieter.aai.surfnet.nl.pem'
saml_remote_sp_entity_id: 'https://pieter.aai.surfnet.nl/simplesamlphp/module.php/saml/sp/metadata.php/default-sp'
saml_remote_sp_sso_url: '"https://pieter.aai.surfnet.nl/simplesamlphp/module.php/saml/sp/saml2-acs.php/default-sp"'
saml_remote_sp_certificate: '%kernel.root_dir%/../vendor/surfnet/stepup-gssp-bundle/src/Resources/keys/pieter.aai.surfnet.nl.pem'
saml_remote_sp_acs: 'https://pieter.aai.surfnet.nl/simplesamlphp/module.php/saml/sp/saml2-acs.php/default-sp'

7 changes: 6 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ default:
sessions:
symfony2:
symfony2: ~
selenium2:
wd_host: "http://127.0.0.1:8646/wd/hub"
capabilities: { "browser": "firefox", "version": "14"}
Behatch\Extension: ~
suites:
app_bundle:
type: symfony_bundle
contexts:
- AppBundle\Features\Context\WebContext:
- AppBundle\Features\Context\WebContext
- AppBundle\Features\Context\ErrorReportContext
- Behat\MinkExtension\Context\MinkContext
- behatch:context:xml
bundle: 'AppBundle'

4 changes: 4 additions & 0 deletions bin/bootstrap_phantomjs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

pkill phantomjs
./bin/phantomjs --config=./phantomjs.json >/dev/null 2>&1 < /dev/null &
Binary file added bin/phantomjs
Binary file not shown.
File renamed without changes.
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"license": "Apache-2.0",
"description": "Example Generic SAML Stepup Provider.",
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle"
Expand Down Expand Up @@ -31,20 +33,23 @@
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"surfnet/stepup-gssp-bundle": "dev-master",
"symfony/assetic-bundle": "^2.8",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/symfony": "3.3.*",
"twig/twig": "^1.0||^2.0",
"surfnet/stepup-gssp-bundle": "dev-feature/152798-metadata-endpoint as 1.0.0"
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"behat/behat": "^3.4",
"behat/mink-browserkit-driver": "^1.3",
"behat/mink-extension": "^2.2",
"behat/mink-selenium2-driver": "^1.3",
"behat/symfony2-extension": "^2.1",
"behatch/contexts": "^2.7",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"malukenho/docheader": "^0.1.6",
"mockery/mockery": "^1.0",
"phpmd/phpmd": "^2.6",
"phpunit/phpcov": "^3.1",
"phpunit/phpunit": "^5.7",
Expand Down Expand Up @@ -78,7 +83,7 @@
"phpcpd": ["vendor/bin/phpcpd ./src", "vendor/bin/phpcpd ./tests"],

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

"security-tests": "vendor/bin/security-checker security:check --end-point=http://security.sensiolabs.org/check_lock",

Expand Down
Loading