11<?php 
2-   // these are account wide configuration settings 
3- 
4-   // the URL where to the SAML Response/SAML Assertion will be posted 
5-   $ const_assertion_consumer_service_url  = "http://localhost/php-saml/consume.php " ;
6-   // name of this application 
7-   $ const_issuer                          = "php-saml " ;
8-   // tells the IdP to return the email address of the current user 
9-   $ const_name_identifier_format          = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress " ;
10- 
11-   function  get_user_settings () {
12-     // this function should be modified to return the SAML settings for the current user 
13- 
14-     $ settings                            = new  Settings ();
15-     // when using Service Provider Initiated SSO (starting at index.php), this URL asks the IdP to authenticate the user.  
16-     $ settings ->idp_sso_target_url        = "https://app.onelogin.com/saml/signon/6171 " ;
17-     // the certificate for the users account in the IdP 
18-     $ settings ->x509certificate           = "-----BEGIN CERTIFICATE-----  
2+   /** 
3+    * SAMPLE Code to demonstrate how provide SAML settings. 
4+    * 
5+    * The settings are contained within a SamlSettings object. You need to 
6+    * provide, at a minimum, the following things: 
7+    *  - idp_sso_target_url: This is the URL to forward to for auth requests. 
8+    *    It will be provided by your IdP. 
9+    *  - x509certificate: This is a certificate required to authenticate your 
10+    *    request. This certificate should be provided by your IdP. 
11+    *  - assertion_consumer_service_url: The URL that the IdP should redirect 
12+    *    to once the authorization is complete. You must provide this, and it 
13+    *    should point to the consume.php script or its equivalent. 
14+    */ 
15+ 
16+   /** 
17+    * Return a SamlSettings object with user settings. 
18+    */ 
19+   function  saml_get_settings () {
20+     // This function should be modified to return the SAML settings for the current user 
21+ 
22+     $ settings  = new  SamlSettings ();
23+ 
24+     // When using Service Provider Initiated SSO (starting at index.php), this URL asks the IdP to authenticate the user. 
25+     $ settings ->idp_sso_target_url              = "https://app.onelogin.com/saml/signon/6171 " ;
26+ 
27+     // The certificate for the users account in the IdP 
28+     $ settings ->x509certificate                 = <<<ENDCERTIFICATE 
29+ -----BEGIN CERTIFICATE----- 
1930MIIBrTCCAaGgAwIBAgIBATADBgEAMGcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD 
2031YWxpZm9ybmlhMRUwEwYDVQQHDAxTYW50YSBNb25pY2ExETAPBgNVBAoMCE9uZUxv 
2132Z2luMRkwFwYDVQQDDBBhcHAub25lbG9naW4uY29tMB4XDTEwMDMwOTA5NTgzNFoX 
@@ -26,9 +37,20 @@ function get_user_settings() {
2637kJNHYAAQ9egLGWQ8/1atkPBye5s9fxROtf8VO3uk/x/X5VSRODIrhFISGmKUnVXa 
2738UhLFIXkGSCAIVfoR5S2ggdfpINKUWGsWS/lEzLNYMBkURXuVAgMBAAEwAwYBAAMB 
2839AA== 
29- -----END CERTIFICATE----- " ;
40+ -----END CERTIFICATE----- 
41+ ENDCERTIFICATE ;
42+ 
43+     // The URL where to the SAML Response/SAML Assertion will be posted 
44+     $ settings ->assertion_consumer_service_url  = "http://localhost/php-saml/consume.php " ;
45+ 
46+     // Name of this application 
47+     $ settings ->issuer                          = "php-saml " ;
48+ 
49+     // Tells the IdP to return the email address of the current user 
50+     $ settings ->name_identifier_format          = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress " ;
51+ 
3052
3153    return  $ settings ;
3254  }
33-    
55+ 
3456?> 
0 commit comments