ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSoapDummyAuthServer.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24
34include_once './webservice/soap/lib/nusoap.php';
35
40{
41 $ret = array(
42 "valid" => false,
43 "firstname" => "",
44 "lastname" => "",
45 "email" => "");
46
47 // generate some dummy values
48 if ($new_user) {
49 $ret["firstname"] = "first " . $ext_uid;
50 $ret["lastname"] = "last " . $ext_uid;
51 $ret["email"] = $ext_uid . "@de.de";
52 }
53
54 // return valid authentication if user id equals soap password
55 if ($ext_uid == $soap_pw) {
56 $ret["valid"] = true;
57 } else {
58 $ret["valid"] = false;
59 }
60
61 return $ret;
62}
63
64
66{
67 /*
68 * @var object Nusoap-Server
69 */
70 public $server = null;
71
72
73 public function __construct($a_use_wsdl = true)
74 {
75 define('SERVICE_NAME', 'ILIAS SOAP Dummy Authentication Server');
76 define('SERVICE_NAMESPACE', 'urn:ilSoapDummyAuthServer');
77 define('SERVICE_STYLE', 'rpc');
78 define('SERVICE_USE', 'encoded');
79
80 $this->server = new soap_server();
81
82 if ($a_use_wsdl) {
83 $this->__enableWSDL();
84 }
85
86 $this->__registerMethods();
87 }
88
89 public function start()
90 {
91 $postdata = file_get_contents("php://input");
92 $this->server->service($postdata);
93 exit();
94 }
95
96 // PRIVATE
97 public function __enableWSDL()
98 {
99 $this->server->configureWSDL(SERVICE_NAME, SERVICE_NAMESPACE);
100
101 return true;
102 }
103
104
105 public function __registerMethods()
106 {
107
108 // Add useful complex types. E.g. array("a","b") or array(1,2)
109 $this->server->wsdl->addComplexType(
110 'intArray',
111 'complexType',
112 'array',
113 '',
114 'SOAP-ENC:Array',
115 array(),
116 array(array('ref' => 'SOAP-ENC:arrayType','wsdl:arrayType' => 'xsd:int[]')),
117 'xsd:int'
118 );
119
120
121 $this->server->wsdl->addComplexType(
122 'stringArray',
123 'complexType',
124 'array',
125 '',
126 'SOAP-ENC:Array',
127 array(),
128 array(array('ref' => 'SOAP-ENC:arrayType','wsdl:arrayType' => 'xsd:string[]')),
129 'xsd:string'
130 );
131
132 // isValidSession()
133 $this->server->register(
134 'isValidSession',
135 array('ext_uid' => 'xsd:string',
136 'soap_pw' => 'xsd:string',
137 'new_user' => 'xsd:boolean'),
138 array('valid' => 'xsd:boolean',
139 'firstname' => 'xsd:string',
140 'lastname' => 'xsd:string',
141 'email' => 'xsd:string'),
142 SERVICE_NAMESPACE,
143 SERVICE_NAMESPACE . '#isValidSession',
144 SERVICE_STYLE,
145 SERVICE_USE,
146 'Dummy Session Validation'
147 );
148
149 return true;
150 }
151}
An exception for terminatinating execution or to throw for unit testing.
isValidSession($ext_uid, $soap_pw, $new_user)
isValidSession
soap_server allows the user to create a SOAP server that is capable of receiving messages and returni...
Definition: nusoap.php:2313
$soap_pw
$ext_uid
$new_user
exit
Definition: login.php:29
$ret
Definition: parser.php:6