OAuth

目次

OAuth クラス

はじめに

OAuth 拡張モジュールは、データプロバイダとやりとりするためのシンプルなインターフェイスを提供します。 OAuth HTTP 仕様を用いることで、プライベートなリソースを保護します。

クラス概要

OAuth
class OAuth {
/* プロパティ */
public $debug;
public $sslChecks;
public $debugInfo;
/* メソッド */
public __construct(
    string $consumer_key,
    string $consumer_secret,
    string $signature_method = OAUTH_SIG_METHOD_HMACSHA1,
    int $auth_type = 0
)
public void __destruct()
public bool disableDebug()
public bool disableRedirects()
public bool disableSSLChecks()
public bool enableDebug()
public bool enableRedirects()
public bool enableSSLChecks()
public mixed fetch(
    string $protected_resource_url,
    array $extra_parameters = ?,
    string $http_method = ?,
    array $http_headers = ?
)
public stringfalse generateSignature(string $http_method, string $url, mixed $extra_parameters = ?)
public array getAccessToken(string $access_token_url, string $verifier_token = ?, string $http_method = ?)
public array getCAPath()
public string getLastResponse()
public stringfalse getLastResponseHeaders()
public array getLastResponseInfo()
public stringfalse getRequestHeader(string $http_method, string $url, mixed $extra_parameters = ?)
public array getRequestToken(string $request_token_url, string $callback_url = ?, string $http_method = ?)
public bool setAuthType(int $auth_type)
public mixed setCAPath(string $ca_path = ?, string $ca_info = ?)
public mixed setNonce(string $nonce)
public void setRequestEngine(int $reqengine)
public mixed setRSACertificate(string $cert)
public bool setSSLChecks(int $sslcheck)
public mixed setTimestamp(string $timestamp)
public bool setToken(string $token, string $token_secret)
public bool setVersion(string $version)
}

プロパティ

debug

sslChecks

debugInfo

OAuthProvider クラス

はじめに

OAuth プロバイダを管理するクラスです。

別のサイトで公開されている詳細なチュートリアル » Writing an OAuth Provider Service には、このサービスを作成する方法がハンズオン形式で公開されています。 OAuth 拡張モジュールのソースの中には » OAuth プロバイダのサンプル もあります。

クラス概要

OAuthProvider
class OAuthProvider {
/* メソッド */
final public bool addRequiredParameter(string $req_params)
public void callconsumerHandler()
public void callTimestampNonceHandler()
public void calltokenHandler()
public void checkOAuthRequest(string $uri = ?, string $method = ?)
public __construct(array $params_array = ?)
public void consumerHandler(callable $callback_function)
final public static string generateToken(int $size, bool $strong = false)
public void is2LeggedEndpoint(mixed $params_array)
public void isRequestTokenEndpoint(bool $will_issue_request_token)
final public bool removeRequiredParameter(string $req_params)
final public static string reportProblem(string $oauthexception, bool $send_headers = true)
final public bool setParam(string $param_key, mixed $param_val = ?)
final public bool setRequestTokenPath(string $path)
public void timestampNonceHandler(callable $callback_function)
public void tokenHandler(callable $callback_function)
}

OAuthException クラス

はじめに

この例外は、OAuth 拡張モジュールの使用中に例外エラーが発生したときにスローされます。 デバッグに有用な情報が含まれています。

クラス概要

OAuthException
class OAuthException extends Exception {
/* プロパティ */
public $lastResponse;
public $debugInfo;
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private Throwablenull $previous = null;
/* 継承したメソッド */
final public string Exception::getMessage()
final public Throwablenull Exception::getPrevious()
final public int Exception::getCode()
final public string Exception::getFile()
final public int Exception::getLine()
final public array Exception::getTrace()
final public string Exception::getTraceAsString()
public string Exception::__toString()
private void Exception::__clone()
}

プロパティ

lastResponse

発生した例外のレスポンス (存在する場合)。

debugInfo