Changeset 42

Show
Ignore:
Timestamp:
05/18/07 16:19:22 (2 years ago)
Author:
pdingle
Message:

Update from plane-ride: further adapted the WP plugin for use with pwlib

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard/pw-claimtypes.php

    r37 r42  
    3131        'Email'); 
    3232 
    33 $datamap['name'] = new pw_mapping(  
    34         'name', 
    35         'name', 
     33$datamap['displayname'] = new pw_mapping(  
     34        'displayname', 
     35        'Display Name', 
    3636        PW_TABLE_PREFIX . 'users', 
    3737        'return $claimslist[\'givenname\']->token_value . \' \' . $claimslist[\'surname\']->token_value;', 
    3838        'concatenation of first & last name' ); 
    3939 
    40 $datamap['email'] = new pw_mapping( 
    41         'email', 
    42         'email', 
    43         PW_TABLE_PREFIX . 'users', 
     40$datamap['user_email'] = new pw_mapping( 
     41        'user_email', 
     42        'Email Address', 
     43        PW_TABLE_PREFIX . '_users', 
    4444        'return $claimslist[\'emailaddress\']->token_value;' ); 
    4545         
     
    4747        'modulusHash', 
    4848        'modulusHash', 
    49         PW_TABLE_PREFIX . 'infocard_identities', 
     49        PW_TABLE_PREFIX . '_infocard_identities', 
    5050        'return $' . 'claimslist[\'modulusHash\']->token_value;' ); 
    5151 
     
    5353        'privatepersonalidentifier', 
    5454        'ppid', 
    55         PW_TABLE_PREFIX . 'infocard_identities', 
     55        PW_TABLE_PREFIX . '_infocard_identities', 
    5656        'return $' . 'claimslist[\'privatepersonalidentifier\']->token_value;' ); 
    5757         
    58 $datamap['loginid'] = new pw_mapping( 
    59         'loginid', 
    60         'username', 
    61         PW_TABLE_PREFIX . 'users', 
     58$datamap['user_login'] = new pw_mapping( 
     59        'user_login', 
     60        'Login ID', 
     61        PW_TABLE_PREFIX . '_users', 
    6262        'return pw_userdata::getLoginID();', 
    6363        'Calls out to the getLoginID function in pw_userdata' ); 
  • trunk/wp-infocard/pw-config-wp.php

    r36 r42  
    1313 
    1414define ('PW_DEBUG_ON', get_settings('pw_debug_on') ); 
     15define ('PW_TIMEVALIDATION_ON', true ); 
    1516define ('PW_PATH', ABSPATH . PW_PLUGINPATH); 
    1617define ('PW_IMGPATH', PW_PATH . '/pwlib/images'); 
  • trunk/wp-infocard/pw-config.php

    r33 r42  
    44define ('PW_CLICKBACK_LENGTH', 16); 
    55define ('PW_PLUGINPATH', 'wp-content/plugins/wp-infocard'); 
     6define ('PW_VERSION', 'b2'); 
     7define ('PW_VERSION_DATE', '17May07'); 
     8define ('PW_SELECTORTRIGGER', 'html'); 
    69 
    710require( dirname(__FILE__) . '/../../../wp-config.php' ); 
     11define ('PW_TABLE_PREFIX', $table_prefix); 
     12include_once( dirname(__FILE__) . '/pw-claimtypes.php'); // this file uses the TABLE_PREFIX define. 
    813define ('PW_DEBUG_ON', get_settings('pw_debug_on')); 
     14define ('PW_TIMEVALIDATION_ON', false); 
    915define ('PW_PATH', ABSPATH . PW_PLUGINPATH); 
    1016define ('PW_IMGPATH', PW_PATH . '/pwlib/images'); 
  • trunk/wp-infocard/pwlib/login/infocard-clickback.php

    r34 r42  
    1313include_once( dirname(__FILE__) . '/../../' . 'pw-config.php'); 
    1414include_once( dirname(__FILE__) . '/../../class.infocard-basic.php'); 
    15 include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . 'utils.pw.php'); 
     15include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . '/utils.pw.php'); 
    1616include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . '/login/class.infocard-login.php');  
    1717 
  • trunk/wp-infocard/pwlib/login/infocard-submit.php

    r35 r42  
    3737 
    3838pw_utils::printDebug("Plugin: " . PW_PLUGIN . "<br/>\n"); 
     39pw_utils::printDebug("Table Prefix: " . PW_TABLE_PREFIX . "<br/>\n"); 
    3940pw_utils::printDebug("User Agent: $userAgent<br/>\n"); 
    4041 
  • trunk/wp-infocard/pwlib/processing/infocard-post-get-claims.php

    r39 r42  
    140140        // Verify that the token is being processed within the time window 
    141141        // specified by the Identity Provider (we could further restrict this) 
     142 
    142143        $error_detail = pw_utils::checkTimeAhead( $NotBefore ); 
    143144 
  • trunk/wp-infocard/pwlib/utils.pwlib.php

    r35 r42  
    3939 
    4040        function checkTimeAhead ( $NotBefore ){ 
    41  
    42                 $currentTime = mktime() + PW_VALIDITY_WINDOW; 
    43                 $adjustedTimeText = substr(gmdate("c",$currentTime), 0, 19)."Z"; 
    44                 if ($adjustedTimeText < $NotBefore) 
     41                if (PW_TIMEVALIDATION_ON) 
    4542                { 
    46                         return "Adjusted current time ($adjustedTimeText) is too far ahead of the start of the validity window ($NotBefore)"; 
    47                 } 
    48  
     43                        $currentTime = mktime() + PW_VALIDITY_WINDOW; 
     44                        $adjustedTimeText = substr(gmdate("c",$currentTime), 0, 19)."Z"; 
     45                        if ($adjustedTimeText < $NotBefore) 
     46                        { 
     47                                return "Adjusted current time ($adjustedTimeText) is too far ahead of the start of the validity window ($NotBefore)"; 
     48                        } 
     49                } 
    4950                return false; 
    5051 
     
    5960 
    6061        function checkTimeBehind ( $NotOnOrAfter){ 
    61  
    62                 $currentTime = mktime() - PW_VALIDITY_WINDOW; 
    63                 $adjustedTimeText = substr(gmdate("c",$currentTime), 0, 19)."Z"; 
    64                 if ($adjustedTimeText > $NotOnOrAfter) 
     62                if (PW_TIMEVALIDATION_ON) 
    6563                { 
    66                         return "Adjusted current time ($adjustedTimeText) is after the end of validity window ($NotOnOrAfter)"; 
    67                 } 
    68                  
     64                        $currentTime = mktime() - PW_VALIDITY_WINDOW; 
     65                        $adjustedTimeText = substr(gmdate("c",$currentTime), 0, 19)."Z"; 
     66                        if ($adjustedTimeText > $NotOnOrAfter) 
     67                        { 
     68                                return "Adjusted current time ($adjustedTimeText) is after the end of validity window ($NotOnOrAfter)"; 
     69                        } 
     70                } 
    6971                return false; 
    70  
    7172        } // end function checkTimeBehind 
    7273 
  • trunk/wp-infocard/wp-infocard.php

    r33 r42  
    44Plugin URI: http://pamelaproject.com/wp-infocard 
    55Description: This plugin adds functionality to register and login with "information cards", part of the Identity Metasystem web services framework.  Once it is activated, go to the "Options" menu and click on "Information Card Options" to see what to do next. 
    6 Version: Beta Rev: 2
     6Version: b
    77Author: K. Cameron, P. Dingle 
    88Author URI: http://www.pamelaproject.com/wp-infocard/contributors 
  • trunk/wp-infocard/wp/admin.pw.php

    r33 r42  
    367367?> 
    368368                                <code><br/>&nbsp; 
    369                                         wp_redirect( get_settings('siteurl')."/wp-content/plugins/wp-infocard/login/infocard-login.php"); 
     369                                        wp_redirect( get_settings('siteurl')."/wp-content/plugins/wp-infocard/wp/login/infocard-login.php"); 
    370370                                </code> 
    371371                        </li> 
  • trunk/wp-infocard/wp/login/class.infocard-login.php

    r40 r42  
    123123 
    124124                print PW_SECUREPLUGINURL    
    125                         . "/processing/infocard-post.php"; 
     125                        . "/pwlib/processing/infocard-post.php"; 
    126126        } 
    127127  
     
    142142        } 
    143143 
     144        function printIdentitySelectorTrigger() 
     145        { 
     146                switch ( PW_SELECTORTRIGGER ) 
     147                { 
     148                        case 'html': 
     149                                pw_utils::printDebug('Selector Trigger: HTML<br/>'); 
     150                                InfocardLogin::printHTMLSelectorTrigger(); 
     151                        break; 
     152                        case 'xhtml': 
     153                                pw_utils::printDebug('Selector Trigger: XHTML<br/>'); 
     154                                InfocardLogin::printXHTMLSelectorTrigger(); 
     155                        break; 
    144156 
     157                        default: 
     158                                pw_utils::printDebug('ERROR:  PW_SELECTORTRIGGER set to unknown value - using HTML as fallback'); 
     159                                InfocardLogin::printHTMLSelectorTrigger(); 
     160                } 
     161        } // end function printIdentitySelectorTrigger 
     162 
     163                //<PARAM Name="issuer" Value= 
     164                //      "https://cards.pamelaproject.com/TokenService/services/Trust"> 
     165                //      "https://cards.pamelaproject.com/TokenService/services/Trust https://www.identityblog.com/sts"> 
     166        function printHTMLSelectorTrigger() 
     167        { 
     168?> 
     169                <OBJECT type="application/x-informationCard" name="xmlToken"> 
     170                        <PARAM  Name="tokenType" 
     171                                Value="urn:oasis:names:tc:SAML:1.0:assertion"> 
     172                        <PARAM  Name="requiredClaims" 
     173                                Value="<?php InfocardLogin::printRequiredClaims('septemberAgent'); ?>"> 
     174<?php 
     175                InfocardLogin::printOptionalClaims(); 
     176?> 
     177                </OBJECT> 
     178<?php 
     179        } // end function printHTMLSelectorTrigger 
     180 
     181        function printXHTMLSelectorTrigger() 
     182        { 
     183?> 
     184                <ic:informationCard id='xmlToken' 
     185                        style='behavior:url(#default#informationCard)' 
     186                        issuer="http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/se lf" 
     187                        issuer="http://identityblog.com/sts" tokenType="urn:oasis:names:tc:SAML:1.0:assertion"> 
     188 
     189                        <ic:add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="false" /> 
     190                        <ic:add claimType= "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="false" /> 
     191                        <ic:add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="false" /> 
     192                        <ic:add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" optional="false" /> 
     193                </ic:informationCard> 
     194<?php 
     195        } // end function printXHTMLSelectorTrigger 
    145196} // end class Infocard-Login 
    146197 
  • trunk/wp-infocard/wp/userdata.pw.php

    r33 r42  
    120120                } 
    121121 
    122                 InfocardUtils::printDebug( "&nbsp;&nbsp;Email_user_id: $mail_user_id <br/>" ); 
     122                pw_utils::printDebug( "&nbsp;&nbsp;Email_user_id: $mail_user_id <br/>" ); 
    123123                InfocardUtils::printDebug( "&nbsp;&nbsp;Status: " . $incominguser['status'] . "<br/>" ); 
    124124 
     
    126126        } // end function evaluateIncomingRequest 
    127127 
     128 
     129        function mapTokenData() 
     130        { 
     131                global $claimslist, $datamap; 
     132                pw_utils::printDebug('<br/>Mapped Data:<br/>'); 
     133                foreach(array_keys($datamap) as $key) 
     134                { 
     135                        $datamap[$key]->new_value = eval($datamap[$key]->mappingfunction); 
     136                        //pw_utils::printDebug('&nbsp;Mapping Function: '.$datamap[$key]->mappingfunction.'<br/>'); 
     137                        pw_utils::printDebug('&nbsp;Name: '.$datamap[$key]->handle.'&nbsp;Value: '.$datamap[$key]->new_value.'<br/>'); 
     138                } 
     139        } // end function mapTokenData 
    128140 
    129141        // Function: updateIdentityData 
     
    186198        } // end function updateIdentityData 
    187199 
     200        // Function: getLoginID 
     201        // Description:  always returns existing value if it exists 
     202        //               otherwise for now takes the email address. 
     203        function getLoginID() 
     204        { 
     205                global $datamap; 
     206                $loginid = $datamap['loginid']->db_value; 
     207 
     208                if ($loginid) 
     209                        return $loginid; 
     210                 
     211                $loginid = $datamap['email']->new_value; 
     212                return $loginid;         
     213        } 
     214 
    188215} // end class pw_userdata 
    189216?>