1 | <?php |
||
36 | class ShibError |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * @var array $errorarray Holds the values of the various shibboleth |
||
41 | * error parameters |
||
42 | */ |
||
43 | private $errorarray; |
||
44 | |||
45 | /** |
||
46 | * @var array $errorparams Shibboleth error parameters passed to the |
||
47 | * redirectErrors handler: |
||
48 | * https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPErrors |
||
49 | */ |
||
50 | private static $errorparams = array( |
||
51 | 'requestURL', // The URL associated with the request |
||
52 | 'errorType', // The general type of error |
||
53 | 'errorText', // The actual error message |
||
54 | 'entityID', // Name of identity provider, if known |
||
55 | 'now', // Current date and time |
||
56 | 'statusCode', // SAML status code causing error, sent by IdP |
||
57 | 'statusCode2', // SAML sub-status code causing error, sent by IdP |
||
58 | 'statusMessage', // SAML status message, sent by IdP |
||
59 | 'contactName', // A support contact name for the IdP |
||
60 | // provided by that site's metadata. |
||
61 | 'contactEmail', // A contact email address for the IdP contact |
||
62 | // provided by that site's metadata. |
||
63 | 'errorURL', // The URL of an error handling page for the IdP |
||
64 | // provided by that site's metadata. |
||
65 | ); |
||
66 | |||
67 | /** |
||
68 | * __construct |
||
69 | * |
||
70 | * Default constructor. This method attempts to read in the |
||
71 | * various Shibboleth SP error parameters that would have been |
||
72 | * passed as parameters to the 'redirectErrors' handler URL, i.e. |
||
73 | * in the $_GET global variable. |
||
74 | * |
||
75 | * @param string|null $redirectUrl In case of Shibboleth error, redirect |
||
76 | * to this URL. If null, then print out error to user. |
||
77 | * |
||
78 | * @return ShibError A new ShibError object. |
||
|
|||
79 | */ |
||
80 | public function __construct($redirectUrl = null) |
||
113 | |||
114 | /** |
||
115 | * isError |
||
116 | * |
||
117 | * This method returns true if several Shibboleth error parameters |
||
118 | * were passed in via the $_GET array. These parameters are sent |
||
119 | * by the Shibboleth SP software when there is an error. |
||
120 | * |
||
121 | * @return bool True if several Shibboleth error parameters were |
||
122 | * passed to the handler URL. False otherwise. |
||
123 | */ |
||
124 | public function isError() |
||
135 | |||
136 | /** |
||
137 | * printError |
||
138 | * |
||
139 | * This method prints out text for an error message page. It also |
||
140 | * logs the error and sends an alert email with the shibboleth |
||
141 | * error parameters. You should probably 'exit()' after you call |
||
142 | * this so more HTML doesn't get output. |
||
143 | */ |
||
144 | public function printError() |
||
208 | } |
||
209 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.