Add simplesaml setup

This commit is contained in:
Peder Bergebakken Sundt 2017-10-22 15:37:03 +02:00
parent 473cd000d0
commit d047a99fd3
7 changed files with 58 additions and 6 deletions

8
.gitignore vendored
View File

@ -1,5 +1,5 @@
sql_config.php
/sql_config.php
*.sqlite
php.ini
test.sql
vendor/
/test.sql
/vendor/
/www/simplesaml

14
dev.sh
View File

@ -1,4 +1,14 @@
#!/bin/sh
which sqlite3 > /dev/null 2>&1 && test \! -e pvv.sqlite && sqlite3 pvv.sqlite < pvv.sql
test \! -e sql_config.php && cp sql_config_example.php sql_config.php
which sqlite3 > /dev/null 2>&1 && test \! -e pvv.sqlite && sqlite3 pvv.sqlite < dist/pvv.sql
test \! -e sql_config.php && cp dist/sql_config_example.php sql_config.php
if test \! -d vendor; then
composer install
cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
cp -v dist/saml20-idp-remote.php vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
cp -v vendor/simplesamlphp/simplesamlphp/config-templates/config.php vendor/simplesamlphp/simplesamlphp/config/config.php
ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
fi
php -S [::1]:1080 -t www/

9
dist/authsources_example.php vendored Normal file
View File

@ -0,0 +1,9 @@
<?php
$config = array(
/* This is the name of this authentication source, and will be used to access it later. */
'default-sp' => array(
'saml:SP',
'idp' => 'https://www.pvv.ntnu.no/idp',
),
);

View File

23
dist/saml20-idp-remote.php vendored Normal file
View File

@ -0,0 +1,23 @@
<?php
$metadata['https://www.pvv.ntnu.no/idp'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'https://www.pvv.ntnu.no/idp',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://www.pvv.ntnu.no/idp/saml2/idp/SSOService.php',
),
),
'SingleLogoutService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://www.pvv.ntnu.no/idp/saml2/idp/SingleLogoutService.php',
),
),
'certData' => 'MIICgDCCAemgAwIBAgIJAP13Q5w2R3KgMA0GCSqGSIb3DQEBBQUAMDUxCzAJBgNVBAYTAk5PMRgwFgYDVQQIFA9Tw7hyLVRyw7huZGVsYWcxDDAKBgNVBAoTA1BWVjAeFw0xNDAzMTMxODIzNTVaFw0yNDAzMTIxODIzNTVaMDUxCzAJBgNVBAYTAk5PMRgwFgYDVQQIFA9Tw7hyLVRyw7huZGVsYWcxDDAKBgNVBAoTA1BWVjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAzckfyofefuJr/gDl0vj7gbIGiwXD825c3YidWK2Cg37ZmSycVk3mng4OqZkQbKY8wRaHg/fruqicDhodCPq9dF7/+QmYAG8PMKmpCIvnKaT7EjOGQtCnxv2+17CF0c7IuLjlwNZG8m0xDBZZp8ymj6QK+mJfVEahBPbkMaCBGIsCAwEAAaOBlzCBlDAdBgNVHQ4EFgQUNEuP7yZVDneEA4uTfJv/UFA9gjcwZQYDVR0jBF4wXIAUNEuP7yZVDneEA4uTfJv/UFA9gjehOaQ3MDUxCzAJBgNVBAYTAk5PMRgwFgYDVQQIFA9Tw7hyLVRyw7huZGVsYWcxDDAKBgNVBAoTA1BWVoIJAP13Q5w2R3KgMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAg8hx8aRy/Fz9PK9UckOQ92WSoRCyr/ldQSf0OTRTMyG+zsSrzVsDX3+BFWbMAFrEu7SZAakd9FQajTUw0d930iaDP+ptX1uIxb64OOY0glLOW3Ru/CL309JwUIkDADa8drpRK4IFDvzs5nVpaj75X1pp583e+psuNST8f+mLspw=',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
);

10
www/login/index.php Normal file
View File

@ -0,0 +1,10 @@
<?php
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('default-sp');
$as->requireAuth();
$attributes = $as->getAttributes();
print_r($attributes);
?>
test