Changeset 366470
- Timestamp:
- 03/29/2011 06:39:46 PM (15 years ago)
- File:
-
- 1 edited
-
wpcas-server/trunk/wpcas-server.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpcas-server/trunk/wpcas-server.php
r344653 r366470 66 66 case '/cas/logout/': 67 67 case '/cas/logout' : self::logout(); break; 68 case '/cas/validate/': 69 case '/cas/validate' : self::validate(); break; 68 70 case '/cas/proxyValidate/': 69 71 case '/cas/proxyValidate' : 70 case '/cas/ validate/':71 case '/cas/ validate' : self::validate(); break;72 case '/cas/serviceValidate/': 73 case '/cas/serviceValidate' : self::serviceValidate(); break; 72 74 default : self::fail(); break; 73 75 }//end switch … … 122 124 /** 123 125 * validate a given ticket 126 * @return string user id 124 127 */ 125 public function validate()128 public function _validate() 126 129 { 127 130 self::session_start(); 128 129 131 130 132 $path = self::get_path(); … … 133 135 $decrypted_ticket = str_rot13($ticket); 134 136 137 if( isset( $_GET['ticket'] ) && $user_id = wp_validate_auth_cookie( $decrypted_ticket, 'auth' ) ) { 138 return $user_id; 139 } 140 }//end _validate 141 142 /** 143 * CAS 2.0 serviceValidate. 144 */ 145 public function serviceValidate() { 135 146 $response = '<cas:serviceResponse xmlns:cas="'.get_bloginfo('url').'/cas">'."\n"; 136 if( isset( $_GET['ticket'] ) && $user_id = wp_validate_auth_cookie( $decrypted_ticket, 'auth' )) 137 {147 148 if( $user_id = self::_validate() ) { 138 149 $auth_value = apply_filters('wpcas_server_auth_value', $user_id); 139 150 … … 148 159 $response .= '</cas:serviceResponse>'; 149 160 150 die($response); 161 die( $response ); 162 }//end serviceValidate 163 164 /** 165 * CAS 1.0 validate. 166 */ 167 public function validate() { 168 if( $user_id = self::_validate() ) { 169 $auth_value = apply_filters('wpcas_server_auth_value', $user_id); 170 $response = "yes\n{$auth_value}\n"; 171 } else { 172 $response = "no\n\n"; 173 } 174 175 die( $response ); 151 176 }//end validate 152 177 }//end class wpCAS_server
Note: See TracChangeset
for help on using the changeset viewer.