Beispiel #1
0
 public static function createToken($claimValues, $config, $relatesto)
 {
     $assertionid = uniqid('uuid-');
     $created = gmdate('Y-m-d') . 'T' . gmdate('H:i:s') . 'Z';
     $expires = gmdate('Y-m-d', time() + 3600) . 'T' . gmdate('H:i:s', time() + 3600) . 'Z';
     //SOAP ENVELOPE
     $env = '<?xml version="1.0"?>';
     $env .= '<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing"  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ic="http://schemas.xmlsoap.org/ws/2005/05/identity" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:xenc="http://www.w3.org/2001/04/xmlenc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">';
     $env .= '<S:Header>';
     $env .= '<wsa:Action wsu:Id="_1">';
     $env .= 'http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue';
     $env .= '</wsa:Action>';
     $env .= '<wsa:RelatesTo wsu:Id="_2">';
     $env .= $relatesto;
     $env .= '</wsa:RelatesTo>';
     $env .= '<wsa:To wsu:id="_3">';
     $env .= 'http://www.w3.org/2005/08/addressing/anonymous';
     $env .= '</wsa:To>';
     $env .= '<wsse:Security S:mustUnderstand="1">';
     $env .= '<wsu:Timestamp wsu:Id="_6">';
     $env .= '<wsu:Created>' . $created . '</wsu:Created>';
     $env .= '<wsu:Expires>' . $expires . '</wsu:Expires>';
     $env .= '</wsu:Timestamp>';
     $env .= '</wsse:Security>';
     $env .= '</S:Header>';
     $env .= '<S:Body wsu:Id="_10">';
     //RequestSecurityTokenResponse
     $env .= sspmod_InfoCard_STS::RequestSecurityTokenResponse($claimValues, $config, $assertionid, $created, $expires);
     $env .= '</S:Body>';
     $env .= '</S:Envelope>';
     return $env;
 }