| 126 | | function printXHTMLSelectorTrigger( $prettyprint=false ) |
|---|
| 127 | | { |
|---|
| 128 | | $obj = "<ic:informationCard name='xmlToken'"; |
|---|
| 129 | | $obj .= "style='behavior:url(#default#informationCard)'"; |
|---|
| 130 | | $obj .= 'tokenType="urn:oasis:names:tc:SAML:1.0:assertion">'; |
|---|
| 131 | | $obj .= '<ic:add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="false" />'; |
|---|
| 132 | | $obj .= '<ic:add claimType= "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="false" />'; |
|---|
| 133 | | $obj .= '<ic:add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="false" />'; |
|---|
| 134 | | $obj .= '</ic:informationCard>'; |
|---|
| | 127 | function getXHTMLSelectorTrigger( $prettyprint=false ) |
|---|
| | 128 | { |
|---|
| | 129 | |
|---|
| | 130 | $toktype = pw_login::getTokenType( 'xhtml', $prettyprint ); |
|---|
| | 131 | $issuer = pw_login::getXHTMLIssuer( $prettyprint ); |
|---|
| | 132 | $objectstart = "<ic:informationCard name='xmlToken'" |
|---|
| | 133 | . " style='behavior:url(#default#informationCard)'" |
|---|
| | 134 | . " " . $toktype |
|---|
| | 135 | . " " . $issuer |
|---|
| | 136 | . '>'; |
|---|
| | 137 | |
|---|
| | 138 | $objectclaims = pw_login::getXHTMLClaims( $prettyprint ); |
|---|
| | 139 | $objectend .= '</ic:informationCard>'; |
|---|
| 152 | | //$output = $objectstart . $objectclaims . $objectend; |
|---|
| 153 | | $output = $objectstart . $objectend; |
|---|
| 154 | | if ($prettyprint) |
|---|
| 155 | | return htmlspecialchars($obj); |
|---|
| 156 | | else |
|---|
| 157 | | return $obj; |
|---|
| 158 | | } // end function printXHTMLSelectorTrigger |
|---|
| 159 | | |
|---|
| | 156 | $output = $linefeed . $objectstart . $linefeed |
|---|
| | 157 | //$output = $objectstart |
|---|
| | 158 | . ($objectclaims ? $objectclaims : "") |
|---|
| | 159 | //. $objectend; |
|---|
| | 160 | . $objectend . $linefeed; |
|---|
| | 161 | return $output; |
|---|
| | 162 | } // end function getXHTMLSelectorTrigger |
|---|
| | 163 | |
|---|
| | 164 | function getXHTMLIssuer( $prettyprint=false ) |
|---|
| | 165 | { |
|---|
| | 166 | // this is a placeholder for now |
|---|
| | 167 | return ""; |
|---|
| | 168 | } |
|---|
| | 169 | |
|---|
| | 170 | function getTokenType( $selectortype ) |
|---|
| | 171 | { |
|---|
| | 172 | $token = "urn:oasis:names:tc:SAML:1.0:assertion"; |
|---|
| | 173 | switch ( $selectortype ) |
|---|
| | 174 | { |
|---|
| | 175 | case 'xhtml': |
|---|
| | 176 | $output = 'tokenType="'.$token.'"'; |
|---|
| | 177 | break; |
|---|
| | 178 | case 'html': |
|---|
| | 179 | default: |
|---|
| | 180 | $output = '<PARAM Name="tokenType" Value="'.$token.'urn:oasis:names:tc:SAML:1.0:assertion">'; |
|---|
| | 181 | } |
|---|
| | 182 | return $output; |
|---|
| | 183 | } //end function getTokenType |
|---|
| | 184 | |
|---|
| | 185 | function getXHTMLClaims( $prettyprint=false ) |
|---|
| | 186 | { |
|---|
| | 187 | global $claimslist; |
|---|
| | 188 | $output = ""; |
|---|
| | 189 | foreach ($claimslist as $claim) |
|---|
| | 190 | { |
|---|
| | 191 | if ($output) |
|---|
| | 192 | $output .= " "; |
|---|
| | 193 | |
|---|
| | 194 | if ($claim->schemaURI) |
|---|
| | 195 | $newclaim = '<ic:add claimType="' |
|---|
| | 196 | . $claim->schemaURI |
|---|
| | 197 | . '" optional="' |
|---|
| | 198 | // remember, if required = true, optional = false & vice versa |
|---|
| | 199 | . ($claim->required?"false":"true") |
|---|
| | 200 | . '" />'; |
|---|
| | 201 | if ( $prettyprint ) |
|---|
| | 202 | { |
|---|
| | 203 | $output .= " " |
|---|
| | 204 | . htmlspecialchars( $newclaim ) |
|---|
| | 205 | . "<br />"; |
|---|
| | 206 | } |
|---|
| | 207 | else |
|---|
| | 208 | { |
|---|
| | 209 | $output .= "\t" |
|---|
| | 210 | . $newclaim . "\n"; |
|---|
| | 211 | } |
|---|
| | 212 | } |
|---|
| | 213 | return $output; |
|---|
| | 214 | }//end function getXHTMLClaims |
|---|