Loading .gitignore +6 −1 Original line number Original line Diff line number Diff line composer.lock composer.lock config.php config.php config.json logs/ logs/ vendor/ vendor/ nbproject/ client-icons/ /nbproject/ *.pem /build/ .phpunit.result.cache .htaccess +9 −0 Original line number Original line Diff line number Diff line Loading @@ -3,3 +3,12 @@ RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [QSA,L] RewriteRule ^(.*)$ index.php [QSA,L] # mod_rewrite changes some Shibboleth headers # this restores them: SetEnvIf REDIRECT_Shib-Session-ID (.+) Shib-Session-ID=$1 SetEnvIf REDIRECT_eppn (.+) eppn=$1 SetEnvIf REDIRECT_mail (.+) mail=$1 SetEnvIf REDIRECT_givenName (.+) givenName=$1 SetEnvIf REDIRECT_sn (.+) sn=$1 Dockerfile 0 → 100644 +57 −0 Original line number Original line Diff line number Diff line FROM ubuntu:18.10 # To fix "configuring tzdata" interactive input during apt install ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -yq --no-install-recommends \ apache2 \ libapache2-mod-php7.2 \ php7.2-xml \ php7.2-mbstring \ php-mysql \ php-curl \ libapache2-mod-shib2 \ make \ wget \ ca-certificates \ ssl-cert \ vim # Copying Shibboleth SP configuration COPY docker/shibboleth/shibboleth2.xml /etc/shibboleth/ COPY docker/shibboleth/sp-key.pem /etc/shibboleth/ COPY docker/shibboleth/sp-cert.pem /etc/shibboleth/ # Installing Embedded Discovery Service WORKDIR /usr/local/src RUN wget https://shibboleth.net/downloads/embedded-discovery-service/1.2.1/shibboleth-embedded-ds-1.2.1.tar.gz -O shibboleth-eds.tar.gz RUN tar xzf shibboleth-eds.tar.gz WORKDIR shibboleth-embedded-ds-1.2.1 RUN make install RUN mv /etc/shibboleth-ds/shibboleth-ds.conf /etc/apache2/conf-available/shibboleth-ds.conf RUN sed -i 's/Allow from All/Require all granted/g' /etc/apache2/conf-available/shibboleth-ds.conf RUN a2enconf shibboleth-ds.conf # Adding RAP Apache configuration COPY docker/rap.conf /etc/apache2/conf-available/ RUN a2enconf rap.conf # Enable mod_rewrite (for Flight framework) RUN a2enmod rewrite RUN a2enmod ssl RUN a2ensite default-ssl # Copying RAP php files WORKDIR /var/www/html COPY . rap-ia2 WORKDIR /var/www/html/rap-ia2 RUN mkdir -p logs RUN chown -R www-data logs # Starting shibd & Apache CMD service shibd start && apachectl -D FOREGROUND README.md +21 −1 Original line number Original line Diff line number Diff line Loading @@ -11,7 +11,7 @@ Requirements: On Ubuntu: On Ubuntu: sudo apt install apache2 mariadb-server libapache2-mod-php mariadb-server sudo apt install apache2 mariadb-server libapache2-mod-php mariadb-server php7.2-xml php7.2-mbstring php-mysql php-curl ### PHP ### PHP Loading Loading @@ -108,6 +108,10 @@ Before using social API it is necessary to register an application on each socia Copy the `config-example.php` into `config.php` and edit it for matching your needs. Copy the `config-example.php` into `config.php` and edit it for matching your needs. ### Generate keypair php exec/generate-keypair.php ### Logs directory ### Logs directory Create the logs directory and assign ownership to the Apache user (usually www-data or apache) Create the logs directory and assign ownership to the Apache user (usually www-data or apache) Loading @@ -115,6 +119,22 @@ Create the logs directory and assign ownership to the Apache user (usually www-d mkdir logs mkdir logs sudo chown www-data logs sudo chown www-data logs ### Run Unit Tests and build code coverage report (XDebug or another code coverage driver needs to be installed; e.g. `sudo apt install php-xdebug`) ./vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-html build/coverage-report tests/ ## Additional information and developer guide ## Additional information and developer guide See the wiki: https://www.ict.inaf.it/gitlab/zorba/rap-ia2/wikis/home See the wiki: https://www.ict.inaf.it/gitlab/zorba/rap-ia2/wikis/home ## Troubleshooting ### Class not found while developing If you see a message like this: PHP Fatal error: Uncaught Error: Class 'RAP\\[...]' not found probably you have to regenerate the PHP autoload calling `composer dumpautoload` in RAP root directory. auth/oauth2/facebook_login.phpdeleted 100755 → 0 +0 −46 Original line number Original line Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This page uses the Facebook API for generating the redirect URL to use for Facebook login */ include '../../include/init.php'; startSession(); // Retrieve Facebook configuration $Facebook = $AUTHENTICATION_METHODS['Facebook']; $fb = new Facebook\Facebook([ 'app_id' => $Facebook['id'], 'app_secret' => $Facebook['secret'], 'default_graph_version' => $Facebook['version'], ]); $helper = $fb->getRedirectLoginHelper(); $permissions = ['email']; // Optional permissions: we need user email $loginUrl = $helper->getLoginUrl($Facebook['callback'], $permissions); header("Location: $loginUrl"); ?> Loading
.gitignore +6 −1 Original line number Original line Diff line number Diff line composer.lock composer.lock config.php config.php config.json logs/ logs/ vendor/ vendor/ nbproject/ client-icons/ /nbproject/ *.pem /build/ .phpunit.result.cache
.htaccess +9 −0 Original line number Original line Diff line number Diff line Loading @@ -3,3 +3,12 @@ RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [QSA,L] RewriteRule ^(.*)$ index.php [QSA,L] # mod_rewrite changes some Shibboleth headers # this restores them: SetEnvIf REDIRECT_Shib-Session-ID (.+) Shib-Session-ID=$1 SetEnvIf REDIRECT_eppn (.+) eppn=$1 SetEnvIf REDIRECT_mail (.+) mail=$1 SetEnvIf REDIRECT_givenName (.+) givenName=$1 SetEnvIf REDIRECT_sn (.+) sn=$1
Dockerfile 0 → 100644 +57 −0 Original line number Original line Diff line number Diff line FROM ubuntu:18.10 # To fix "configuring tzdata" interactive input during apt install ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -yq --no-install-recommends \ apache2 \ libapache2-mod-php7.2 \ php7.2-xml \ php7.2-mbstring \ php-mysql \ php-curl \ libapache2-mod-shib2 \ make \ wget \ ca-certificates \ ssl-cert \ vim # Copying Shibboleth SP configuration COPY docker/shibboleth/shibboleth2.xml /etc/shibboleth/ COPY docker/shibboleth/sp-key.pem /etc/shibboleth/ COPY docker/shibboleth/sp-cert.pem /etc/shibboleth/ # Installing Embedded Discovery Service WORKDIR /usr/local/src RUN wget https://shibboleth.net/downloads/embedded-discovery-service/1.2.1/shibboleth-embedded-ds-1.2.1.tar.gz -O shibboleth-eds.tar.gz RUN tar xzf shibboleth-eds.tar.gz WORKDIR shibboleth-embedded-ds-1.2.1 RUN make install RUN mv /etc/shibboleth-ds/shibboleth-ds.conf /etc/apache2/conf-available/shibboleth-ds.conf RUN sed -i 's/Allow from All/Require all granted/g' /etc/apache2/conf-available/shibboleth-ds.conf RUN a2enconf shibboleth-ds.conf # Adding RAP Apache configuration COPY docker/rap.conf /etc/apache2/conf-available/ RUN a2enconf rap.conf # Enable mod_rewrite (for Flight framework) RUN a2enmod rewrite RUN a2enmod ssl RUN a2ensite default-ssl # Copying RAP php files WORKDIR /var/www/html COPY . rap-ia2 WORKDIR /var/www/html/rap-ia2 RUN mkdir -p logs RUN chown -R www-data logs # Starting shibd & Apache CMD service shibd start && apachectl -D FOREGROUND
README.md +21 −1 Original line number Original line Diff line number Diff line Loading @@ -11,7 +11,7 @@ Requirements: On Ubuntu: On Ubuntu: sudo apt install apache2 mariadb-server libapache2-mod-php mariadb-server sudo apt install apache2 mariadb-server libapache2-mod-php mariadb-server php7.2-xml php7.2-mbstring php-mysql php-curl ### PHP ### PHP Loading Loading @@ -108,6 +108,10 @@ Before using social API it is necessary to register an application on each socia Copy the `config-example.php` into `config.php` and edit it for matching your needs. Copy the `config-example.php` into `config.php` and edit it for matching your needs. ### Generate keypair php exec/generate-keypair.php ### Logs directory ### Logs directory Create the logs directory and assign ownership to the Apache user (usually www-data or apache) Create the logs directory and assign ownership to the Apache user (usually www-data or apache) Loading @@ -115,6 +119,22 @@ Create the logs directory and assign ownership to the Apache user (usually www-d mkdir logs mkdir logs sudo chown www-data logs sudo chown www-data logs ### Run Unit Tests and build code coverage report (XDebug or another code coverage driver needs to be installed; e.g. `sudo apt install php-xdebug`) ./vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-html build/coverage-report tests/ ## Additional information and developer guide ## Additional information and developer guide See the wiki: https://www.ict.inaf.it/gitlab/zorba/rap-ia2/wikis/home See the wiki: https://www.ict.inaf.it/gitlab/zorba/rap-ia2/wikis/home ## Troubleshooting ### Class not found while developing If you see a message like this: PHP Fatal error: Uncaught Error: Class 'RAP\\[...]' not found probably you have to regenerate the PHP autoload calling `composer dumpautoload` in RAP root directory.
auth/oauth2/facebook_login.phpdeleted 100755 → 0 +0 −46 Original line number Original line Diff line number Diff line <?php /* ---------------------------------------------------------------------------- * INAF - National Institute for Astrophysics * IRA - Radioastronomical Institute - Bologna * OATS - Astronomical Observatory - Trieste * ---------------------------------------------------------------------------- * * Copyright (C) 2016 Istituto Nazionale di Astrofisica * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 3 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This page uses the Facebook API for generating the redirect URL to use for Facebook login */ include '../../include/init.php'; startSession(); // Retrieve Facebook configuration $Facebook = $AUTHENTICATION_METHODS['Facebook']; $fb = new Facebook\Facebook([ 'app_id' => $Facebook['id'], 'app_secret' => $Facebook['secret'], 'default_graph_version' => $Facebook['version'], ]); $helper = $fb->getRedirectLoginHelper(); $permissions = ['email']; // Optional permissions: we need user email $loginUrl = $helper->getLoginUrl($Facebook['callback'], $permissions); header("Location: $loginUrl"); ?>