Wiki

Version 12 (Ashish Kataria, 11/12/2012 04:29 am)

1 1
Using single sign-on (SSO) will permit a single action of user authentication and authorization to access all computers and systems where he has access permission, without the need to enter multiple passwords. 
2 1
INSTALLATION
3 1
---------------------
4 1
1. Download and extract Single.
5 1
6 12 Ashish Kataria
You can obtain the latest Single Sign-On release from [[http://forge.kayako.com/attachments/download/394/sso.zip]] -- the files are available in .zip formats and can be extracted using most compression tools.
7 1
To download and extract the files, on a typical Unix/Linux command line, use the following commands:
8 1
9 2 Ashish Kataria
<pre>
10 12 Ashish Kataria
wget http://forge.kayako.com/attachments/download/394/samlsso.zip
11 6 Ashish Kataria
tar -zxvf samlsso.zip
12 2 Ashish Kataria
</pre>
13 6 Ashish Kataria
This will create a new directory samlsso/ containing all samlsso files and directories. Then, to move the contents of that directory within your helpdesk app folder, continue with this command:
14 2 Ashish Kataria
15 2 Ashish Kataria
<pre>
16 6 Ashish Kataria
mv samlsso /path/to/your/installation/__apps/
17 2 Ashish Kataria
</pre>
18 1
19 1
2. Go to Admin interface of your helpdesk and click on Apps on left hand side menu
20 1
21 1
!http://forge.kayako.com/attachments/download/309/Screen_Shot_2012-10-12_at_11.27.33_AM.png!
22 1
23 1
3. Now click on Single Sign On and then click on Install button, this will install this app
24 1
25 1
!http://forge.kayako.com/attachments/download/310/Screen_Shot_2012-10-12_at_11.34.35_AM.png!
26 1
27 1
4. Now click on Settings option from left side menu and click on Single Sign On 
28 1
29 1
!http://forge.kayako.com/attachments/download/311/Screen_Shot_2012-10-12_at_11.45.25_AM.png!
30 1
31 1
5. You will see Single Sign On settings page
32 1
33 2 Ashish Kataria
!http://forge.kayako.com/attachments/download/315/Screen_Shot_2012-10-17_at_5.05.30_PM.png!
34 1
35 1
6. First you have to enable the Single Sign On by selecting yes for first option i.e. "Enable Single Sign"
36 1
37 2 Ashish Kataria
7. Next you can enable sign on through twitter or facebook by enabling option “Enable Twitter Authentication” or “Enable Facebook Authentication” correspondingly but if you want to use Twitter or Facebook login then first you have to configure your Apache
38 1
39 4 Ashish Kataria
8. Find the Apache configuration file for the virtual hosts where you run your helpdesk and create an alias in it. The configuration may look like this:
40 2 Ashish Kataria
<pre>
41 2 Ashish Kataria
<VirtualHost *>
42 2 Ashish Kataria
        ServerName service.example.com
43 2 Ashish Kataria
        DocumentRoot /var/www/service.example.com(i.e. path to your helpdesk trunk folder)
44 1
45 2 Ashish Kataria
        Alias /samlidp path to your helpdesk trunk folder/__apps/samlsso/thirdparty/samlidp/www
46 2 Ashish Kataria
</VirtualHost>
47 2 Ashish Kataria
</pre>
48 1
49 2 Ashish Kataria
9. For Twitter integration you need to get an API Consumer key and a Consumer secret (update it in Admin settings), by register the application at: http://twitter.com/oauth_clients
50 1
51 2 Ashish Kataria
10. Set the callback URL to be: http://ky.example.org/samlidp/module.php/authtwitter/linkback.php . Replace ky.example.org with your hostname.
52 1
53 2 Ashish Kataria
11. For Facebook integration you need to get App ID (or API Key) and App Secret (update it in Admin settings), by register the application at: http://www.facebook.com/developers/
54 2 Ashish Kataria
       Please Note :- Facebook needs the CURL and JSON PHP extensions.
55 1
56 2 Ashish Kataria
12. If you want to login from your own Identity Provider then provides your IdP details in next few settings options (for setting up your IdP and adding our Service Provider to your IdP refer to http://simplesamlphp.org/docs/stable/simplesamlphp-idp )
57 1
58 2 Ashish Kataria
13. Entity ID – Specify the index of your IdP metadata array, use these while setting IdP for your help desk
59 1
60 2 Ashish Kataria
14. SingleSignOnService URL – Specify the URL that Kayako will invoke to redirect users to your Identity Provider
61 1
62 2 Ashish Kataria
15. Your IdP should return Email address and Name
63 1
64 2 Ashish Kataria
16. Our Assertion Consumer Service (ACS) URL is http://yourservername.kayako.com/index.php?/Samlsso/Sso/Idp/Login
65 1
66 2 Ashish Kataria
17. Next provide the path for your certificate which you can obtain this from your SAML identity provider
67 1
68 2 Ashish Kataria
18. Once you are done with all the settings then change the template.
69 2 Ashish Kataria
70 2 Ashish Kataria
19. Now click on Templates -> Templates option from left side menu and click on General 
71 2 Ashish Kataria
72 2 Ashish Kataria
20. List of templates will be shown up, click on header template
73 2 Ashish Kataria
74 2 Ashish Kataria
21. Add the below code: -
75 2 Ashish Kataria
76 2 Ashish Kataria
*After*
77 2 Ashish Kataria
<pre>
78 2 Ashish Kataria
<div id="loginsubscribebuttons"><input class="rebutton" value="<{$_language[login]}>" type="submit" /></div>
79 2 Ashish Kataria
</pre>
80 2 Ashish Kataria
*Add code*
81 2 Ashish Kataria
<pre>
82 2 Ashish Kataria
<{if isset($_twitterEnable) || isset($_facebookEnable) || isset($_ssoIdpEnable)}>
83 2 Ashish Kataria
<hr class="vdivider">
84 2 Ashish Kataria
 <{/if}>
85 2 Ashish Kataria
<{if isset($_twitterEnable)}>
86 2 Ashish Kataria
<div id="twitterlogin" class="widgetrow" style="padding-left:5px; " >
87 4 Ashish Kataria
     <span onclick="javascript: window.location.href='<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Twitter/Login';">
88 5 Ashish Kataria
            <a class="widgetrowitem defaultwidget" style="background-repeat: no-repeat; background-position: 5px 5px; width: 139px; font-size: 13px; padding: 14px 10px 15px 50px;background-image: URL('<{$_swiftPath}>__apps/samlsso/themes/client/images/twitter_icon.jpg');" href="<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Twitter/Login">
89 1
                   <span class="widgetitemtitle">Login Using Twitter</span>
90 1
              </a>
91 1
      </span>
92 2 Ashish Kataria
</div>
93 2 Ashish Kataria
<{/if}>
94 2 Ashish Kataria
<{if isset($_facebookEnable)}>
95 2 Ashish Kataria
<div id="facebooklogin" class="widgetrow" style="padding-left:5px;" >
96 4 Ashish Kataria
     <span onclick="javascript: window.location.href='<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Facebook/Login';">
97 5 Ashish Kataria
            <a class="widgetrowitem defaultwidget" style="background-repeat: no-repeat; background-position: 5px 5px; width: 139px; font-size: 13px; padding: 14px 10px 15px 50px;background-image: URL('<{$_swiftPath}>__apps/samlsso/themes/client/images/facebook_icon.jpg');" href="<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Facebook/Login">
98 1
                   <span class="widgetitemtitle">Login Using Facebook</span>
99 1
              </a>
100 1
      </span>
101 2 Ashish Kataria
</div>
102 2 Ashish Kataria
<{/if}>
103 2 Ashish Kataria
<{if isset($_ssoIdpEnable)}>
104 1
<div id="ssoidplogin" class="widgetrow" style="padding-left:5px;" >
105 4 Ashish Kataria
     <span onclick="javascript: window.location.href='<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Idp/Login';">
106 5 Ashish Kataria
            <a class="widgetrowitem defaultwidget" style="background-repeat: no-repeat; background-position: 5px 5px; width: 139px; font-size: 13px; padding: 14px 10px 15px 50px;background-image: URL('<{$_swiftPath}>__apps/samlsso/themes/client/images/saml_icon.jpg');" href="<{$_baseName}><{$_templateGroupPrefix}>/Samlsso/Sso/Idp">
107 2 Ashish Kataria
                   <span class="widgetitemtitle">Login Using Your IdP</span>
108 1
              </a>
109 1
      </span>
110 1
</div>
111 4 Ashish Kataria
<{/if}>
112 4 Ashish Kataria
</pre>
113 4 Ashish Kataria
114 2 Ashish Kataria
22. After changing the template file you can see the login buttons in Support Center corresponding to remote authentications you have enabled
115 1
116 1
!http://forge.kayako.com/attachments/download/313/Screen_Shot_2012-10-12_at_2.41.57_PM.png!
117 1
 
118 2 Ashish Kataria
23. Now you can login with any account
119 7 Ashish Kataria
120 9 Ashish Kataria
*Notes :-* When you use SAML with Nginx you have to configure your SAML as nginx does not directly support PATH_INFO, so please do the following changes as given below :-
121 7 Ashish Kataria
122 7 Ashish Kataria
1) Please add in module.php right after
123 7 Ashish Kataria
124 8 Ashish Kataria
<pre>
125 7 Ashish Kataria
require_once('_include.php');
126 7 Ashish Kataria
127 7 Ashish Kataria
$config = SimpleSAML_Configuration::getInstance();
128 7 Ashish Kataria
if ($config->getBoolean('php.pathinfo_from_requesturi', TRUE)) {
129 7 Ashish Kataria
        SimpleSAML_Logger::debug('!!! ATTENTION: USING REQUEST_URI TO
130 7 Ashish Kataria
GENERATE PATH_INFO !!!');
131 7 Ashish Kataria
132 7 Ashish Kataria
  // helper function to get pathinfo http://php.net/manual/en/function.strstr.php
133 7 Ashish Kataria
  function strstr_after($haystack, $needle, $case_insensitive = false)
134 7 Ashish Kataria
{
135 7 Ashish Kataria
    $strpos = ($case_insensitive) ? 'stripos' : 'strpos';
136 7 Ashish Kataria
    $pos = $strpos($haystack, $needle);
137 7 Ashish Kataria
    if (is_int($pos)) {
138 7 Ashish Kataria
        return substr($haystack, $pos + strlen($needle));
139 7 Ashish Kataria
    }
140 7 Ashish Kataria
    // Most likely false or null
141 7 Ashish Kataria
    return $pos;
142 7 Ashish Kataria
  }
143 7 Ashish Kataria
144 7 Ashish Kataria
  $url_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
145 7 Ashish Kataria
  $pathinfo = strstr_after($url_path,'module.php');
146 7 Ashish Kataria
147 7 Ashish Kataria
  SimpleSAML_Logger::debug('REQUEST_URI: '.$_SERVER['REQUEST_URI']);
148 7 Ashish Kataria
  SimpleSAML_Logger::debug('URL_PATH   : '.$url_path);
149 7 Ashish Kataria
  SimpleSAML_Logger::debug('PATH_INFO  : '.$_SERVER['PATH_INFO']);
150 7 Ashish Kataria
  SimpleSAML_Logger::debug('PATH_INFO_X: '.$pathinfo);
151 7 Ashish Kataria
152 7 Ashish Kataria
  $_SERVER['PATH_INFO'] = $pathinfo;
153 7 Ashish Kataria
154 7 Ashish Kataria
}
155 8 Ashish Kataria
</pre>
156 7 Ashish Kataria
157 7 Ashish Kataria
2) Then append to config.php these lines:
158 1
159 8 Ashish Kataria
<pre>
160 7 Ashish Kataria
  /*
161 7 Ashish Kataria
   * Use $_SERVER['REQUEST_URI'] to generate $_SERVER['PATH_INFO']
162 7 Ashish Kataria
   * This is helpful with a fastcgi deployment, where you might have
163 1
   * problems getting $_SERVER['PATH_INFO'] in en expected way
164 1
   */
165 8 Ashish Kataria
   'php.pathinfo_from_requesturi' => TRUE,
166 1
</pre> 
167 9 Ashish Kataria
168 9 Ashish Kataria
Now set the below configuration if you are using Ngnix :-
169 9 Ashish Kataria
<pre>
170 10 Ashish Kataria
    location ~ ^/samlidp/(.+\.php.*)$ {
171 9 Ashish Kataria
   		alias pathtoyourhelpdeskinstallation/__apps/samlsso/thirdparty/samlidp/www/$1;
172 9 Ashish Kataria
    		fastcgi_split_path_info ^/samlidp((?U).*\.php)(/?.*)$; 
173 9 Ashish Kataria
    		fastcgi_pass    unix:/var/lib/phpfpm.sock; # or  127.0.0.1:9000,  If you have install and configure fastcgi... Start it it up at 127.0.0.1:9000
174 9 Ashish Kataria
    		fastcgi_index   index.php;
175 9 Ashish Kataria
    		fastcgi_param   SCRIPT_FILENAME pathtoyourhelpdeskinstallation/__apps/samlsso/thirdparty/samlidp/www/$fastcgi_script_name;
176 9 Ashish Kataria
    		include	fastcgi_params;
177 9 Ashish Kataria
	}
178 9 Ashish Kataria
 
179 9 Ashish Kataria
	location ~ /samlidp(.*) {
180 9 Ashish Kataria
     		alias pathtoyourhelpdeskinstallation/__apps/samlsso/thirdparty/samlidp/www/$1;
181 9 Ashish Kataria
	}
182 9 Ashish Kataria
 
183 9 Ashish Kataria
	location ~ ^/samlidp/(.*) {
184 9 Ashish Kataria
      		alias pathtoyourhelpdeskinstallation/__apps/samlsso/thirdparty/samlidp/www/$1;
185 9 Ashish Kataria
	}
186 9 Ashish Kataria
187 9 Ashish Kataria
	location /samlidp/$ {
188 9 Ashish Kataria
          alias pathtoyourhelpdeskinstallation/__apps/samlsso/thirdparty/samlidp/www;
189 9 Ashish Kataria
    }
190 9 Ashish Kataria
</pre>