Changeset 64

Show
Ignore:
Timestamp:
06/10/07 23:01:26 (2 years ago)
Author:
pdingle
Message:

xhtml form now makes claims out of the claimlist variable - also added a schemaURI to the ppid field

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard/pwlib/login/login.pwlib.php

    r63 r64  
    1515                        case 'xhtml': 
    1616                                $debug = "XHTML"; 
    17                                 echo pw_login::printXHTMLSelectorTrigger( $prettyprint ); 
     17                                echo pw_login::getXHTMLSelectorTrigger( $prettyprint ); 
     18 
    1819                        break; 
    1920                        default: 
     
    124125        } 
    125126 
    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>'; 
    135140 
    136141                if ($prettyprint) 
     
    140145                        $objectstart = htmlspecialchars($objectstart); 
    141146                        $objectend = htmlspecialchars($objectend); 
    142                         $objectclaims = htmlspecialchars($objectclaims); 
    143147                } 
    144148                else 
     
    150154                //$output .= ($objectclaims ? $tab.$objectclaims.$linefeed : ""); 
    151155                //$output .= $objectend . $linefeed; 
    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 .= "&nbsp; &nbsp; &nbsp;"  
     204                                . htmlspecialchars( $newclaim ) 
     205                                . "<br />"; 
     206                        } 
     207                        else 
     208                        { 
     209                                $output .= "\t"  
     210                                . $newclaim . "\n"; 
     211                        } 
     212                } 
     213                return $output; 
     214        }//end function getXHTMLClaims 
    160215} // end class pw_login 
    161216 
  • trunk/wp-infocard/wp/pw-claimtypes.php

    r56 r64  
    22include_once( dirname(__FILE__) . "/../pwlib/claimtypes.pwlib.php"); 
    33$claimslist['privatepersonalidentifier'] = new pw_claimtype( 
    4         '', 
     4        'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier', 
    55        'privatepersonalidentifier', 
    66        TRUE,