-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest_sso.php
49 lines (34 loc) · 1.07 KB
/
test_sso.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
# Test SAP Single Sign On (SSO2)
# $Id: test_sso.php,v 1.1 2005/12/18 16:26:23 koucky Exp $
# Prerequisite:
# Profile parameters: login/create_sso2_ticket = 1
# login/accept_sso2_ticket = 1
# Transaction SSO2 - Administration logon ticket
#
# The first logon to SAP using username and password, request for ticket GETOSS2 = 1
# Please change logon parameters for your system
$login = array (
"ASHOST"=>"<hostname>",
"SYSNR"=>"00",
"CLIENT"=>"<client>",
"USER"=>"<username>",
"PASSWD"=>"<password>",
"GETSSO2"=>"1");
$rfc = saprfc_open ($login );
if (! $rfc ) { echo "RFC connection failed"; exit; }
# Get SSO ticket
$ticket = saprfc_get_ticket($rfc);
saprfc_close ($rfc);
if ($ticket)
echo "SSO2 ticket = ".$ticket. "<br>";
# The second logon to SAP using SSO2 ticket
unset ($login["PASSWD"]);
unset ($login["USER"]);
unset ($login["GETSS02"]);
$login["MYSAPSSO2"] = $ticket;
$rfc = saprfc_open ($login );
if (! $rfc ) { echo "SSO2 RFC connection failed"; exit; }
echo "SSO2 OK<br>";
saprfc_close ($rfc);
?>