<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.studentnet.net/index.php?action=history&amp;feed=atom&amp;title=Generic_PHP_Website</id>
	<title>Generic PHP Website - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.studentnet.net/index.php?action=history&amp;feed=atom&amp;title=Generic_PHP_Website"/>
	<link rel="alternate" type="text/html" href="https://wiki.studentnet.net/index.php?title=Generic_PHP_Website&amp;action=history"/>
	<updated>2026-04-19T19:29:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.studentnet.net/index.php?title=Generic_PHP_Website&amp;diff=601&amp;oldid=prev</id>
		<title>Jls: Created page with &quot;Before we get started, you&#039;ll need to make sure you know what your Cloudwork identity provider&#039;s Entity ID is. To do this, log in to your Cloudwork Dashboard, and go to Single...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.studentnet.net/index.php?title=Generic_PHP_Website&amp;diff=601&amp;oldid=prev"/>
		<updated>2019-05-20T01:51:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Before we get started, you&amp;#039;ll need to make sure you know what your Cloudwork identity provider&amp;#039;s Entity ID is. To do this, log in to your Cloudwork Dashboard, and go to Single...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Before we get started, you&amp;#039;ll need to make sure you know what your Cloudwork identity provider&amp;#039;s Entity ID is. To do this, log in to your Cloudwork Dashboard, and go to Single Sign On &amp;gt; Identity Provider. You&amp;#039;ll need this Entity ID url a few times in the instructions below.&lt;br /&gt;
&lt;br /&gt;
Download SimpleSAMLphp and place it on your server (OUTSIDE of your public_html directory - We recommend /var/simplesaml). You can then add the following snippet to your site config in apache to get SimpleSAMLphp working properly:&lt;br /&gt;
&lt;br /&gt;
  SetEnv SIMPLESAMLPHP_CONFIG_DIR /var/simplesamlphp/config&lt;br /&gt;
  &lt;br /&gt;
        Alias /simplesaml /var/simplesamlphp/www&lt;br /&gt;
  &lt;br /&gt;
        &amp;lt;Directory /var/simplesamlphp/www&amp;gt;&lt;br /&gt;
            &amp;lt;IfModule !mod_authz_core.c&amp;gt;&lt;br /&gt;
            # For Apache 2.2:&lt;br /&gt;
            Order allow,deny&lt;br /&gt;
            Allow from all&lt;br /&gt;
            &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
            &amp;lt;IfModule mod_authz_core.c&amp;gt;&lt;br /&gt;
            # For Apache 2.4:&lt;br /&gt;
            Require all granted&lt;br /&gt;
            &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure to adjust the paths as necessary.&lt;br /&gt;
&lt;br /&gt;
Next up, you&amp;#039;ll need to get SimpleSAML configured. Edit the config/authsources.php file. Find the line &amp;#039;idp&amp;#039; =&amp;gt; null and replace null with your Entity ID, enclosed in quotation marks; for example&lt;br /&gt;
&lt;br /&gt;
  &amp;#039;idp&amp;#039; =&amp;gt; &amp;quot;https://demo-login.cloudworkengine.net/saml2/idp/metadata.php&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now, in a web browser, paste your entity ID into the URL bar and add `?output=xhtml` to the end of the URL. Find the code snippet under &amp;quot;In SimpleSAMLphp flat file format&amp;quot; and copy the code snippet. Edit metadata/saml20-idp-remote.php and and paste the contents of that snippet underneath the existing contents of that file.&lt;br /&gt;
&lt;br /&gt;
Next, you need to get your new service configured in Cloudwork. In your web browser, go to [you_website]/simplesaml/module.php/saml/sp/metadata.php/default-sp and save the XML to a file.&lt;br /&gt;
Log in to Cloudwork and go to Single Sign On &amp;gt; Add New Service &amp;gt; Upload an XML File and fill out the form using the XML file you just saved.&lt;br /&gt;
&lt;br /&gt;
At this point, SSO is configured and you can start using it in your website. &lt;br /&gt;
&lt;br /&gt;
The following code snippet is an example of how this SimpleSAMLphp installation can now be used to force a user to be authenticated via SSO, and also show you what data you have available to you regarding the authenticated user:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  require_once(&amp;#039;/var/simplesamlphp/lib/_autoload.php&amp;#039;);&lt;br /&gt;
  $as = new \SimpleSAML\Auth\Simple(&amp;#039;default-sp&amp;#039;);&lt;br /&gt;
  $as-&amp;gt;requireAuth();&lt;br /&gt;
  $attributes = $as-&amp;gt;getAttributes();&lt;br /&gt;
  print_r($attributes);&lt;/div&gt;</summary>
		<author><name>Jls</name></author>
		
	</entry>
</feed>