|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Service |
|
17 * @subpackage DeveloperGarden |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: SecurityTokenServer.php 20166 2010-01-09 19:00:17Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Service_DeveloperGarden_SecurityTokenServer_Cache |
|
25 */ |
|
26 require_once 'Zend/Service/DeveloperGarden/SecurityTokenServer/Cache.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract |
|
30 */ |
|
31 require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php'; |
|
32 |
|
33 /** |
|
34 * @see Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse |
|
35 */ |
|
36 require_once 'Zend/Service/DeveloperGarden/Response/SecurityTokenServer/SecurityTokenResponse.php'; |
|
37 |
|
38 /** |
|
39 * @see Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse |
|
40 */ |
|
41 require_once 'Zend/Service/DeveloperGarden/Response/SecurityTokenServer/GetTokensResponse.php'; |
|
42 |
|
43 /** |
|
44 * @category Zend |
|
45 * @package Zend_Service |
|
46 * @subpackage DeveloperGarden |
|
47 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
48 * @author Marco Kaiser |
|
49 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
50 */ |
|
51 class Zend_Service_DeveloperGarden_SecurityTokenServer |
|
52 extends Zend_Service_DeveloperGarden_Client_ClientAbstract |
|
53 { |
|
54 /** |
|
55 * wsdl file |
|
56 * |
|
57 * @var string |
|
58 */ |
|
59 protected $_wsdlFile = 'https://sts.idm.telekom.com/TokenService?wsdl'; |
|
60 |
|
61 /** |
|
62 * wsdl file local |
|
63 * |
|
64 * @var string |
|
65 */ |
|
66 protected $_wsdlFileLocal = 'Wsdl/TokenService.wsdl'; |
|
67 |
|
68 /** |
|
69 * Response, Request Classmapping |
|
70 * |
|
71 * @var array |
|
72 * |
|
73 */ |
|
74 protected $_classMap = array( |
|
75 'SecurityTokenResponse' => 'Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse', |
|
76 'getTokensResponse' => 'Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse' |
|
77 ); |
|
78 |
|
79 /** |
|
80 * does the login and return the specific response |
|
81 * |
|
82 * @return Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse |
|
83 */ |
|
84 public function getLoginToken() |
|
85 { |
|
86 $token = Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::getTokenFromCache( |
|
87 'securityToken' |
|
88 ); |
|
89 |
|
90 if ($token === null |
|
91 || !$token->isValid() |
|
92 ) { |
|
93 $token = $this->getSoapClient()->login('login'); |
|
94 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache( |
|
95 'securityToken', |
|
96 $token |
|
97 ); |
|
98 } |
|
99 |
|
100 return $token; |
|
101 } |
|
102 |
|
103 /** |
|
104 * returns the fetched token from token server |
|
105 * |
|
106 * @return Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse |
|
107 */ |
|
108 public function getTokens() |
|
109 { |
|
110 $token = Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::getTokenFromCache( |
|
111 'getTokens' |
|
112 ); |
|
113 |
|
114 if ($token === null |
|
115 || !$token->isValid() |
|
116 ) { |
|
117 $token = $this->getSoapClient()->getTokens(array( |
|
118 'serviceId' => $this->_serviceAuthId |
|
119 )); |
|
120 Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache( |
|
121 'getTokens', |
|
122 $token |
|
123 ); |
|
124 } |
|
125 return $token; |
|
126 } |
|
127 } |