From d047a99fd31977baf3c64614a01d1c0fdb5c63c2 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 22 Oct 2017 15:37:03 +0200 Subject: [PATCH] Add simplesaml setup --- .gitignore | 8 +++---- dev.sh | 14 +++++++++-- dist/authsources_example.php | 9 ++++++++ pvv.sql => dist/pvv.sql | 0 dist/saml20-idp-remote.php | 23 +++++++++++++++++++ .../sql_config_example.php | 0 www/login/index.php | 10 ++++++++ 7 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 dist/authsources_example.php rename pvv.sql => dist/pvv.sql (100%) create mode 100644 dist/saml20-idp-remote.php rename sql_config_example.php => dist/sql_config_example.php (100%) create mode 100644 www/login/index.php diff --git a/.gitignore b/.gitignore index 39de558..9c8cecf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -sql_config.php +/sql_config.php *.sqlite -php.ini -test.sql -vendor/ +/test.sql +/vendor/ +/www/simplesaml \ No newline at end of file diff --git a/dev.sh b/dev.sh index f8f4506..554450f 100755 --- a/dev.sh +++ b/dev.sh @@ -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/ diff --git a/dist/authsources_example.php b/dist/authsources_example.php new file mode 100644 index 0000000..88e8d6a --- /dev/null +++ b/dist/authsources_example.php @@ -0,0 +1,9 @@ + array( + 'saml:SP', + 'idp' => 'https://www.pvv.ntnu.no/idp', + ), +); diff --git a/pvv.sql b/dist/pvv.sql similarity index 100% rename from pvv.sql rename to dist/pvv.sql diff --git a/dist/saml20-idp-remote.php b/dist/saml20-idp-remote.php new file mode 100644 index 0000000..3d5a77d --- /dev/null +++ b/dist/saml20-idp-remote.php @@ -0,0 +1,23 @@ + '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', +); diff --git a/sql_config_example.php b/dist/sql_config_example.php similarity index 100% rename from sql_config_example.php rename to dist/sql_config_example.php diff --git a/www/login/index.php b/www/login/index.php new file mode 100644 index 0000000..3cd8b45 --- /dev/null +++ b/www/login/index.php @@ -0,0 +1,10 @@ +requireAuth(); + +$attributes = $as->getAttributes(); +print_r($attributes); +?> + +test