Overview

Namespaces

  • None
  • PHP

Classes

  • RESTian
  • RESTian_Application_Json_Parser
  • RESTian_Application_Serialized_Php_Parser
  • RESTian_Application_Xml_Parser
  • RESTian_Auth_Provider_Base
  • RESTian_Base
  • RESTian_Basic_Http_Auth_Provider
  • RESTian_Client
  • RESTian_Http_Agent_Base
  • RESTian_Not_Applicable_Provider
  • RESTian_Parser_Base
  • RESTian_Php_Curl_Http_Agent
  • RESTian_Request
  • RESTian_Response
  • RESTian_Service
  • RESTian_Settings
  • RESTian_Text_Csv_Parser
  • RESTian_Text_Html_Parser
  • RESTian_Text_Plain_Parser
  • RESTian_Var
  • RESTian_WordPress_Http_Agent
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: class RESTian_Basic_Http_Auth_Provider extends RESTian_Auth_Provider_Base {
 4: 
 5:   /**
 6:    * @return array
 7:    */
 8:   function get_new_credentials() {
 9:     return array(
10:       'username' => '',
11:       'password' => '',
12:     );
13:   }
14: 
15:   /**
16:    * @return array
17:    */
18:   function get_new_grant() {
19:     return array(
20:       'authenticated' => false,
21:     );
22:   }
23: 
24:   /**
25:    * @param array $credentials
26:    * @return bool
27:    */
28:   function is_credentials( $credentials ) {
29:     return ! empty( $credentials['username'] ) && ( ! empty( $credentials['password'] ) );
30:   }
31: 
32:   /**
33:    * @param array $grant
34:    * @return bool
35:    */
36:   function is_grant( $grant ) {
37:     return ! empty( $grant['authenticated'] );
38:   }
39: 
40:   /**
41:    * @param RESTian_Request $request
42:    */
43:   function prepare_request( $request ) {
44:     $credentials = $request->get_credentials();
45:     $auth = base64_encode( "{$credentials['username']}:{$credentials['password']}" );
46:     $request->add_header( 'Authorization', "Basic {$auth}" );
47:   }
48: 
49: }
50: 
API documentation generated by ApiGen 2.8.0