mainwp.dev/source-code/dashboard/classes/MainWP-REST-Authentication.html
2025-03-17 19:02:54 -04:00

2531 lines
126 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MainWP Dashboard Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@100;200;300;400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/template.js"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">MainWP Dashboard Documentation</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -three phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category -namespaces">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/mainwp.html" class="">MainWP</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/mainwp-dashboard.html" class="">Dashboard</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category -packages">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPDashboard.html" class="">MainWPDashboard</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPAPIManagerKeyHandler.html" class="">MainWPAPIManagerKeyHandler</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPMainWP.html" class="">MainWPMainWP</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPMainWP-API.html" class="">API</a>
</li>
<li>
<a href="packages/MainWPMainWP-Keys.html" class="">Keys</a>
</li>
<li>
<a href="packages/MainWPMainWP-Client.html" class="">Client</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPAPIManagerUpdateHandler.html" class="">MainWPAPIManagerUpdateHandler</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPMainWPAPIManager.html" class="">MainWPMainWPAPIManager</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWP.html" class="">MainWP</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWP-Dashboard.html" class="">Dashboard</a>
</li>
<li>
<a href="packages/MainWP-DashboardMainWPsitesclientlist.html" class="">DashboardMainWPsitesclientlist</a>
</li>
<li>
<a href="packages/MainWP-DashboardThisclasshandlesthe.html" class="">DashboardThisclasshandlesthe</a>
</li>
<li>
<a href="packages/MainWP-DashboardMainWPsitesmonitoringlist.html" class="">DashboardMainWPsitesmonitoringlist</a>
</li>
<li>
<a href="packages/MainWP-DashboardCheckforpremiumpluginupdates.html" class="">DashboardCheckforpremiumpluginupdates</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPSettings.html" class="">MainWPSettings</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPBackups.html" class="">MainWPBackups</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPBackups-Continue.html" class="">Continue</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPBootstrap.html" class="">MainWPBootstrap</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPUpdates.html" class="">MainWPUpdates</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPUpdates-Check.html" class="">Check</a>
</li>
<li>
<a href="packages/MainWPUpdates-Overview.html" class="">Overview</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPPingChilds.html" class="">MainWPPingChilds</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPStats.html" class="">MainWPStats</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPExtensions.html" class="">MainWPExtensions</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPSecurtiy.html" class="">MainWPSecurtiy</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPSecurtiy-Issues.html" class="">Issues</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPSetup.html" class="">MainWPSetup</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPSetup-Wizard.html" class="">Wizard</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPSite.html" class="">MainWPSite</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPSite-Open.html" class="">Open</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPThemes.html" class="">MainWPThemes</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPUser.html" class="">MainWPUser</a>
</h4>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPWidget.html" class="">MainWPWidget</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="packages/MainWPWidget-Mainwp.html" class="">Mainwp</a>
</li>
<li>
<a href="packages/MainWPWidget-Recent.html" class="">Recent</a>
</li>
</ul>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/MainWPPlugins.html" class="">MainWPPlugins</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category -reports">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="graphs/classes.html">Class Diagram</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category -indices">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -nine phpdocumentor-content">
<section>
<ul class="phpdocumentor-breadcrumbs">
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
MainWP_REST_Authentication
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/MainWP.html">MainWP</a></li>
<li class="phpdocumentor-breadcrumb"><a href="packages/MainWP-Dashboard.html">Dashboard</a></li>
</ul>
</div>
</h2>
<div class="phpdocumentor-label-line">
</div>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">17</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.17" class="phpdocumentor-element-found-in__source" data-line="17" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">REST API authentication class.</p>
<h3 id="toc">
Table of Contents
<a href="classes/MainWP-REST-Authentication.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<h4 id="toc-properties">
Properties
<a href="classes/MainWP-REST-Authentication.html#toc-properties" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -property -public">
<a class="" href="classes/MainWP-REST-Authentication.html#property_instance">$instance</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Static variable to hold the single instance of the class.</dd>
<dt class="phpdocumentor-table-of-contents__entry -property -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#property_auth_method">$auth_method</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Current auth method.</dd>
<dt class="phpdocumentor-table-of-contents__entry -property -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#property_error">$error</a>
<span>
&nbsp;: <abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Authentication error.</dd>
<dt class="phpdocumentor-table-of-contents__entry -property -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#property_user">$user</a>
<span>
&nbsp;: <abbr title="\stdClass">stdClass</abbr> </span>
</dt>
<dd>Logged in user data.</dd>
</dl>
<h4 id="toc-methods">
Methods
<a href="classes/MainWP-REST-Authentication.html#toc-methods" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Initialize authentication actions.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_authenticate">authenticate()</a>
<span>
&nbsp;: int|false </span>
</dt>
<dd>Authenticate user.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_authentication_fallback">authentication_fallback()</a>
<span>
&nbsp;: <abbr title="\WP_Error">WP_Error</abbr>|null|bool </span>
</dt>
<dd>Authenticate the user if authentication wasn&#039;t performed during the
determine_current_user action.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_check_authentication_error">check_authentication_error()</a>
<span>
&nbsp;: <abbr title="\WP_Error">WP_Error</abbr>|null|bool </span>
</dt>
<dd>Check for authentication error.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_check_user_permissions">check_user_permissions()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Check for user permissions and register last access.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_authorization_header">get_authorization_header()</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Get the authorization header.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_instance">get_instance()</a>
<span>
&nbsp;: <abbr title="\class">class</abbr> </span>
</dt>
<dd>Get Instance</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_oauth_parameters">get_oauth_parameters()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Get oAuth parameters from $_GET, $_POST or request header.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_rest_valid_user">get_rest_valid_user()</a>
<span>
&nbsp;: mixed|object </span>
</dt>
<dd>Method get_rest_valid_user().</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_init">init()</a>
<span>
&nbsp;: <abbr title="\class">class</abbr> </span>
</dt>
<dd>Init method.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_is_valid_permissions">is_valid_permissions()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Valid REST permissions.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_parse_auth_header">parse_auth_header()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Parse the Authorization header into parameters.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_parse_header">parse_header()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Parse the Authorization header into parameters.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a class="" href="classes/MainWP-REST-Authentication.html#method_send_unauthorized_headers">send_unauthorized_headers()</a>
<span>
&nbsp;: <abbr title="\WP_REST_Response">WP_REST_Response</abbr> </span>
</dt>
<dd>If the consumer_key and consumer_secret $_GET parameters are NOT provided
and the Basic auth headers are either not present or the consumer secret does not match the consumer
key provided, then return the correct Basic headers and an error message.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_error">get_error()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Get authentication error.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#method_is_request_to_rest_api">is_request_to_rest_api()</a>
<span>
&nbsp;: bool </span>
</dt>
<dd>Check if is request to our REST API.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a class="" href="classes/MainWP-REST-Authentication.html#method_set_error">set_error()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Set authentication error.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_check_oauth_signature">check_oauth_signature()</a>
<span>
&nbsp;: true|<abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Verify that the consumer-provided request signature matches our generated signature,
this ensures the consumer has a valid key/secret.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_check_oauth_timestamp_and_nonce">check_oauth_timestamp_and_nonce()</a>
<span>
&nbsp;: bool|<abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Verify that the timestamp and nonce provided with the request are valid. This prevents replay attacks where
an attacker could attempt to re-send an intercepted request at a later time.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_check_permissions">check_permissions()</a>
<span>
&nbsp;: bool|<abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Check that the API keys provided have the proper key-specific permissions to either read or write API resources.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_oauth_token_parameters">get_oauth_token_parameters()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>Get oAuth parameters from $_GET, $_POST or request header.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_get_user_data_by_consumer_key">get_user_data_by_consumer_key()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Return the user data for the given consumer_key.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_join_with_equals_sign">join_with_equals_sign()</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Creates an array of urlencoded strings out of each array key/value pairs.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_normalize_parameters">normalize_parameters()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Normalize each parameter by assuming each parameter may have already been
encoded, so attempt to decode, and then re-encode according to RFC 3986.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_perform_basic_authentication">perform_basic_authentication()</a>
<span>
&nbsp;: int|bool </span>
</dt>
<dd>Basic Authentication.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_perform_basic_token_authentication">perform_basic_token_authentication()</a>
<span>
&nbsp;: int|bool </span>
</dt>
<dd>Perform OAuth 1.0a &quot;one-legged&quot; (http://oauthbible.com/#oauth-10a-one-legged) authentication for non-SSL requests.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_perform_oauth_authentication">perform_oauth_authentication()</a>
<span>
&nbsp;: int|bool </span>
</dt>
<dd>Perform OAuth 1.0a &quot;one-legged&quot; (http://oauthbible.com/#oauth-10a-one-legged) authentication for non-SSL requests.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -private">
<a class="" href="classes/MainWP-REST-Authentication.html#method_update_last_access">update_last_access()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Updated API Key last access datetime.</dd>
</dl>
<section class="phpdocumentor-properties">
<h3 class="phpdocumentor-elements__header" id="properties">
Properties
<a href="classes/MainWP-REST-Authentication.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="
phpdocumentor-element
-property
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="property_instance">
$instance
<a href="classes/MainWP-REST-Authentication.html#property_instance" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">49</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.49" class="phpdocumentor-element-found-in__source" data-line="49" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Static variable to hold the single instance of the class.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">$instance</span>
= <span class="phpdocumentor-signature__default-value">\null</span></code>
<section class="phpdocumentor-description"><p>Default null</p>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#property_instance#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">static</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
</article>
<article
class="
phpdocumentor-element
-property
-protected
"
>
<h4 class="phpdocumentor-element__name" id="property_auth_method">
$auth_method
<a href="classes/MainWP-REST-Authentication.html#property_auth_method" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">40</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.40" class="phpdocumentor-element-found-in__source" data-line="40" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Current auth method.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__type">string</span>
<span class="phpdocumentor-signature__name">$auth_method</span>
= <span class="phpdocumentor-signature__default-value">&#039;&#039;</span></code>
</article>
<article
class="
phpdocumentor-element
-property
-protected
"
>
<h4 class="phpdocumentor-element__name" id="property_error">
$error
<a href="classes/MainWP-REST-Authentication.html#property_error" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">26</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.26" class="phpdocumentor-element-found-in__source" data-line="26" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Authentication error.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__type"><abbr title="\WP_Error">WP_Error</abbr></span>
<span class="phpdocumentor-signature__name">$error</span>
= <span class="phpdocumentor-signature__default-value">\null</span></code>
</article>
<article
class="
phpdocumentor-element
-property
-protected
"
>
<h4 class="phpdocumentor-element__name" id="property_user">
$user
<a href="classes/MainWP-REST-Authentication.html#property_user" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">33</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.33" class="phpdocumentor-element-found-in__source" data-line="33" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Logged in user data.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__type"><abbr title="\stdClass">stdClass</abbr></span>
<span class="phpdocumentor-signature__name">$user</span>
= <span class="phpdocumentor-signature__default-value">\null</span></code>
</article>
</section>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/MainWP-REST-Authentication.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/MainWP-REST-Authentication.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">81</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.81" class="phpdocumentor-element-found-in__source" data-line="81" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Initialize authentication actions.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_authenticate">
authenticate()
<a href="classes/MainWP-REST-Authentication.html#method_authenticate" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">117</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.117" class="phpdocumentor-element-found-in__source" data-line="117" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Authenticate user.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">authenticate</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int|false&nbsp;</span><span class="phpdocumentor-signature__argument__name">$user_id</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int|false</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$user_id</span>
: <span class="phpdocumentor-signature__argument__return-type">int|false</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>User ID if one has been determined, false otherwise.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int|false</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_authentication_fallback">
authentication_fallback()
<a href="classes/MainWP-REST-Authentication.html#method_authentication_fallback" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">152</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.152" class="phpdocumentor-element-found-in__source" data-line="152" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Authenticate the user if authentication wasn&#039;t performed during the
determine_current_user action.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">authentication_fallback</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool&nbsp;</span><span class="phpdocumentor-signature__argument__name">$error</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>Necessary in cases where wp_get_current_user() is called before the plugin is loaded.</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$error</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Error data.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_authentication_fallback#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="https://github.com/woocommerce/woocommerce/issues/26847">https://github.com/woocommerce/woocommerce/issues/26847</a></span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_check_authentication_error">
check_authentication_error()
<a href="classes/MainWP-REST-Authentication.html#method_check_authentication_error" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">174</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.174" class="phpdocumentor-element-found-in__source" data-line="174" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Check for authentication error.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">check_authentication_error</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool&nbsp;</span><span class="phpdocumentor-signature__argument__name">$error</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$error</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Error data.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\WP_Error">WP_Error</abbr>|null|bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_check_user_permissions">
check_user_permissions()
<a href="classes/MainWP-REST-Authentication.html#method_check_user_permissions" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">837</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.837" class="phpdocumentor-element-found-in__source" data-line="837" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Check for user permissions and register last access.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">check_user_permissions</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$result</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Server">WP_REST_Server</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$server</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Request">WP_REST_Request</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$request</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$result</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Response to replace the requested version with.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$server</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Server">WP_REST_Server</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Server instance.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$request</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Request">WP_REST_Request</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Request used to generate the response.</p>
</section>
</dd>
</dl>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_authorization_header">
get_authorization_header()
<a href="classes/MainWP-REST-Authentication.html#method_get_authorization_header" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">318</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.318" class="phpdocumentor-element-found-in__source" data-line="318" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Get the authorization header.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_authorization_header</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>On certain systems and configurations, the Authorization header will be
stripped out by the server or PHP. Typically this is then used to
generate <code class="prettyprint">PHP_AUTH_USER</code>/<code class="prettyprint">PHP_AUTH_PASS</code> but not passed on. We use
<code class="prettyprint">getallheaders</code> here to try and grab it out instead.</p>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_get_authorization_header#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">3.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">string</span>
&mdash;
<section class="phpdocumentor-description"><p>Authorization header if set.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_get_instance">
get_instance()
<a href="classes/MainWP-REST-Authentication.html#method_get_instance" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">60</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.60" class="phpdocumentor-element-found-in__source" data-line="60" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Get Instance</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">get_instance</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\class">class</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>Creates public static instance.</p>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_get_instance#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">static</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\class">class</abbr></span>
&mdash;
<section class="phpdocumentor-description"><p>instance.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_oauth_parameters">
get_oauth_parameters()
<a href="classes/MainWP-REST-Authentication.html#method_get_oauth_parameters" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">343</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.343" class="phpdocumentor-element-found-in__source" data-line="343" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Get oAuth parameters from $_GET, $_POST or request header.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_oauth_parameters</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_get_oauth_parameters#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">3.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_rest_valid_user">
get_rest_valid_user()
<a href="classes/MainWP-REST-Authentication.html#method_get_rest_valid_user" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">862</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.862" class="phpdocumentor-element-found-in__source" data-line="862" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Method get_rest_valid_user().</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_rest_valid_user</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed|object</span></code>
<div class="phpdocumentor-label-line">
</div>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed|object</span>
&mdash;
<section class="phpdocumentor-description"><p>User api key object.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_init">
init()
<a href="classes/MainWP-REST-Authentication.html#method_init" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">74</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.74" class="phpdocumentor-element-found-in__source" data-line="74" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Init method.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">init</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\class">class</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_init#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">static</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\class">class</abbr></span>
&mdash;
<section class="phpdocumentor-description"><p>instance.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_is_valid_permissions">
is_valid_permissions()
<a href="classes/MainWP-REST-Authentication.html#method_is_valid_permissions" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">873</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.873" class="phpdocumentor-element-found-in__source" data-line="873" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Valid REST permissions.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">is_valid_permissions</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Request">WP_REST_Request</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$request</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$request</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Request">WP_REST_Request</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Request used to generate the response.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
<section class="phpdocumentor-description"><p>user rest data.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_parse_auth_header">
parse_auth_header()
<a href="classes/MainWP-REST-Authentication.html#method_parse_auth_header" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">292</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.292" class="phpdocumentor-element-found-in__source" data-line="292" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Parse the Authorization header into parameters.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">parse_auth_header</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$header</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$header</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Authorization header value (not including &quot;Authorization: &quot; prefix).</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_parse_auth_header#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">3.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
<section class="phpdocumentor-description"><p>Map of parameter values.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_parse_header">
parse_header()
<a href="classes/MainWP-REST-Authentication.html#method_parse_header" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">264</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.264" class="phpdocumentor-element-found-in__source" data-line="264" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Parse the Authorization header into parameters.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">parse_header</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$header</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$header</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Authorization header value (not including &quot;Authorization: &quot; prefix).</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_parse_header#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">3.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
<section class="phpdocumentor-description"><p>Map of parameter values.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_send_unauthorized_headers">
send_unauthorized_headers()
<a href="classes/MainWP-REST-Authentication.html#method_send_unauthorized_headers" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">820</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.820" class="phpdocumentor-element-found-in__source" data-line="820" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">If the consumer_key and consumer_secret $_GET parameters are NOT provided
and the Basic auth headers are either not present or the consumer secret does not match the consumer
key provided, then return the correct Basic headers and an error message.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">send_unauthorized_headers</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Response">WP_REST_Response</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$response</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><abbr title="\WP_REST_Response">WP_REST_Response</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$response</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_REST_Response">WP_REST_Response</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Current response being served.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><abbr title="\WP_REST_Response">WP_REST_Response</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method_get_error">
get_error()
<a href="classes/MainWP-REST-Authentication.html#method_get_error" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">200</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.200" class="phpdocumentor-element-found-in__source" data-line="200" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Get authentication error.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">get_error</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_get_error#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">@return</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<section class="phpdocumentor-description"><p>WP_Error|null.</p>
</section>
</dd>
</dl>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method_is_request_to_rest_api">
is_request_to_rest_api()
<a href="classes/MainWP-REST-Authentication.html#method_is_request_to_rest_api" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">94</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.94" class="phpdocumentor-element-found-in__source" data-line="94" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Check if is request to our REST API.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">is_request_to_rest_api</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method_set_error">
set_error()
<a href="classes/MainWP-REST-Authentication.html#method_set_error" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">188</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.188" class="phpdocumentor-element-found-in__source" data-line="188" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Set authentication error.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">set_error</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$error</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$error</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\WP_Error">WP_Error</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Authentication error data.</p>
</section>
</dd>
</dl>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_check_oauth_signature">
check_oauth_signature()
<a href="classes/MainWP-REST-Authentication.html#method_check_oauth_signature" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">569</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.569" class="phpdocumentor-element-found-in__source" data-line="569" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Verify that the consumer-provided request signature matches our generated signature,
this ensures the consumer has a valid key/secret.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">check_oauth_signature</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\stdClass">stdClass</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$user</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$params</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">true|<abbr title="\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$user</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\stdClass">stdClass</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>User data.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$params</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The request parameters.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">true|<abbr title="\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_check_oauth_timestamp_and_nonce">
check_oauth_timestamp_and_nonce()
<a href="classes/MainWP-REST-Authentication.html#method_check_oauth_timestamp_and_nonce" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">667</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.667" class="phpdocumentor-element-found-in__source" data-line="667" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Verify that the timestamp and nonce provided with the request are valid. This prevents replay attacks where
an attacker could attempt to re-send an intercepted request at a later time.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">check_oauth_timestamp_and_nonce</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><abbr title="\stdClass">stdClass</abbr>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$user</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">int&nbsp;</span><span class="phpdocumentor-signature__argument__name">$timestamp</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$nonce</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool|<abbr title="\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><ul>
<li>A timestamp is valid if it is within 15 minutes of now.</li>
<li>A nonce is valid if it has not been used within the last 15 minutes.</li>
</ul>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$user</span>
: <span class="phpdocumentor-signature__argument__return-type"><abbr title="\stdClass">stdClass</abbr></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>User data.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$timestamp</span>
: <span class="phpdocumentor-signature__argument__return-type">int</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The unix timestamp for when the request was made.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$nonce</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>A unique (for the given user) 32 alphanumeric string, consumer-generated.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool|<abbr title="\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_check_permissions">
check_permissions()
<a href="classes/MainWP-REST-Authentication.html#method_check_permissions" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">750</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.750" class="phpdocumentor-element-found-in__source" data-line="750" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Check that the API keys provided have the proper key-specific permissions to either read or write API resources.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">check_permissions</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$method</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool|<abbr title="\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$method</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Request method.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool|<abbr title="\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_get_oauth_token_parameters">
get_oauth_token_parameters()
<a href="classes/MainWP-REST-Authentication.html#method_get_oauth_token_parameters" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">505</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.505" class="phpdocumentor-element-found-in__source" data-line="505" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Get oAuth parameters from $_GET, $_POST or request header.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">get_oauth_token_parameters</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_get_oauth_token_parameters#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">3.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;|<abbr title="\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_get_user_data_by_consumer_key">
get_user_data_by_consumer_key()
<a href="classes/MainWP-REST-Authentication.html#method_get_user_data_by_consumer_key" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">714</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.714" class="phpdocumentor-element-found-in__source" data-line="714" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Return the user data for the given consumer_key.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">get_user_data_by_consumer_key</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$consumer_key</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$consumer_key</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Consumer key.</p>
</section>
</dd>
</dl>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_join_with_equals_sign">
join_with_equals_sign()
<a href="classes/MainWP-REST-Authentication.html#method_join_with_equals_sign" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">614</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.614" class="phpdocumentor-element-found-in__source" data-line="614" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Creates an array of urlencoded strings out of each array key/value pairs.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">join_with_equals_sign</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$params</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$query_params</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">array()</span><span> ]</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$key</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">&#039;&#039;</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$params</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Array of parameters to convert.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$query_params</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
= <span class="phpdocumentor-signature__argument__default-value">array()</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Array to extend.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$key</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
= <span class="phpdocumentor-signature__argument__default-value">&#039;&#039;</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Optional Array key to append.</p>
</section>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">string</span>
&mdash;
<section class="phpdocumentor-description"><p>Array of urlencoded strings.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_normalize_parameters">
normalize_parameters()
<a href="classes/MainWP-REST-Authentication.html#method_normalize_parameters" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">649</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.649" class="phpdocumentor-element-found-in__source" data-line="649" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Normalize each parameter by assuming each parameter may have already been
encoded, so attempt to decode, and then re-encode according to RFC 3986.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">normalize_parameters</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$parameters</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>Note both the key and value is normalized so a filter param like:</p>
<p>'filter[period]' =&gt; 'week'</p>
<p>is encoded to:</p>
<p>'filter%255Bperiod%255D' =&gt; 'week'</p>
<p>This conforms to the OAuth 1.0a spec which indicates the entire query string
should be URL encoded.</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$parameters</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Un-normalized parameters.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_normalize_parameters#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><abbr title="\rawurlencode()">rawurlencode()</abbr></span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
<section class="phpdocumentor-description"><p>Normalized parameters.</p>
</section>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_perform_basic_authentication">
perform_basic_authentication()
<a href="classes/MainWP-REST-Authentication.html#method_perform_basic_authentication" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">214</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.214" class="phpdocumentor-element-found-in__source" data-line="214" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Basic Authentication.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">perform_basic_authentication</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int|bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>SSL-encrypted requests are not subject to sniffing or man-in-the-middle
attacks, so the request can be authenticated by simply looking up the user
associated with the given consumer key and confirming the consumer secret
provided is valid.</p>
</section>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int|bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_perform_basic_token_authentication">
perform_basic_token_authentication()
<a href="classes/MainWP-REST-Authentication.html#method_perform_basic_token_authentication" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">466</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.466" class="phpdocumentor-element-found-in__source" data-line="466" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Perform OAuth 1.0a &quot;one-legged&quot; (http://oauthbible.com/#oauth-10a-one-legged) authentication for non-SSL requests.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">perform_basic_token_authentication</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int|bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>This is required so API credentials cannot be sniffed or intercepted when making API requests over plain HTTP.</p>
<p>This follows the spec for simple OAuth 1.0a authentication (RFC 5849) as closely as possible, with two exceptions:</p>
<ol>
<li>
<p>There is no token associated with request/responses, only consumer keys/secrets are used.</p>
</li>
<li>
<p>The OAuth parameters are included as part of the request query string instead of part of the Authorization header,
This is because there is no cross-OS function within PHP to get the raw Authorization header.</p>
</li>
</ol>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_perform_basic_token_authentication#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">link</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<a class="phpdocumentor-tag-link" href="http://tools.ietf.org/html/rfc5849"> <p>for the full spec.</p>
</a>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int|bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_perform_oauth_authentication">
perform_oauth_authentication()
<a href="classes/MainWP-REST-Authentication.html#method_perform_oauth_authentication" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">416</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.416" class="phpdocumentor-element-found-in__source" data-line="416" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Perform OAuth 1.0a &quot;one-legged&quot; (http://oauthbible.com/#oauth-10a-one-legged) authentication for non-SSL requests.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">perform_oauth_authentication</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">int|bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>This is required so API credentials cannot be sniffed or intercepted when making API requests over plain HTTP.</p>
<p>This follows the spec for simple OAuth 1.0a authentication (RFC 5849) as closely as possible, with two exceptions:</p>
<ol>
<li>
<p>There is no token associated with request/responses, only consumer keys/secrets are used.</p>
</li>
<li>
<p>The OAuth parameters are included as part of the request query string instead of part of the Authorization header,
This is because there is no cross-OS function within PHP to get the raw Authorization header.</p>
</li>
</ol>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/MainWP-REST-Authentication.html#method_perform_oauth_authentication#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">link</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<a class="phpdocumentor-tag-link" href="http://tools.ietf.org/html/rfc5849"> <p>for the full spec.</p>
</a>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">int|bool</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-private
"
>
<h4 class="phpdocumentor-element__name" id="method_update_last_access">
update_last_access()
<a href="classes/MainWP-REST-Authentication.html#method_update_last_access" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/rest-api/class-mainwp-rest-authentication.php"><a href="files/includes-rest-api-class-mainwp-rest-authentication.html"><abbr title="includes/rest-api/class-mainwp-rest-authentication.php">class-mainwp-rest-authentication.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">787</span>
<a href="classes/MainWP-REST-Authentication.html#source-view.787" class="phpdocumentor-element-found-in__source" data-line="787" data-modal="source-view" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt"></a>
</aside>
<p class="phpdocumentor-summary">Updated API Key last access datetime.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">private</span>
<span class="phpdocumentor-signature__name">update_last_access</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<div class="phpdocumentor-label-line">
</div>
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/includes/rest-api/class-mainwp-rest-authentication.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">&times;</button>
</div>
</div>
<script type="text/javascript">
(function () {
function loadExternalCodeSnippet(el, url, line) {
Array.prototype.slice.call(el.querySelectorAll('pre[data-src]')).forEach((pre) => {
const src = url || pre.getAttribute('data-src').replace(/\\/g, '/');
const language = 'php';
const code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) {
return;
}
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
return;
}
if (xhr.status === 404) {
code.textContent = '✖ Error: File could not be found';
return;
}
if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
return;
}
code.textContent = '✖ Error: An unknown error occurred';
};
xhr.send(null);
});
}
const modalButtons = document.querySelectorAll("[data-modal]");
const openedAsLocalFile = window.location.protocol === 'file:';
if (modalButtons.length > 0 && openedAsLocalFile) {
console.warn(
'Viewing the source code is unavailable because you are opening this page from the file:// scheme; ' +
'browsers block XHR requests when a page is opened this way'
);
}
modalButtons.forEach(function (trigger) {
if (openedAsLocalFile) {
trigger.setAttribute("hidden", "hidden");
}
trigger.addEventListener("click", function (event) {
event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
if (!modal) {
console.error(`Modal with id "${trigger.dataset.modal}" could not be found`);
return;
}
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippet(modal, trigger.dataset.src || null, trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
})();
</script>
</article>
</section>
<section class="phpdocumentor-on-this-page__sidebar">
<section class="phpdocumentor-on-this-page__content">
<strong class="phpdocumentor-on-this-page__title">On this page</strong>
<ul class="phpdocumentor-list -clean">
<li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/MainWP-REST-Authentication.html#toc-properties">Properties</a></li>
<li><a href="classes/MainWP-REST-Authentication.html#toc-methods">Methods</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Properties</li>
<li>
<ul class="phpdocumentor-list -clean">
<li class=""><a href="classes/MainWP-REST-Authentication.html#property_instance">$instance</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#property_auth_method">$auth_method</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#property_error">$error</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#property_user">$user</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Methods</li>
<li>
<ul class="phpdocumentor-list -clean">
<li class=""><a href="classes/MainWP-REST-Authentication.html#method___construct">__construct()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_authenticate">authenticate()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_authentication_fallback">authentication_fallback()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_check_authentication_error">check_authentication_error()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_check_user_permissions">check_user_permissions()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_authorization_header">get_authorization_header()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_instance">get_instance()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_oauth_parameters">get_oauth_parameters()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_rest_valid_user">get_rest_valid_user()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_init">init()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_is_valid_permissions">is_valid_permissions()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_parse_auth_header">parse_auth_header()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_parse_header">parse_header()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_send_unauthorized_headers">send_unauthorized_headers()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_error">get_error()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_is_request_to_rest_api">is_request_to_rest_api()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_set_error">set_error()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_check_oauth_signature">check_oauth_signature()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_check_oauth_timestamp_and_nonce">check_oauth_timestamp_and_nonce()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_check_permissions">check_permissions()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_oauth_token_parameters">get_oauth_token_parameters()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_get_user_data_by_consumer_key">get_user_data_by_consumer_key()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_join_with_equals_sign">join_with_equals_sign()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_normalize_parameters">normalize_parameters()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_perform_basic_authentication">perform_basic_authentication()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_perform_basic_token_authentication">perform_basic_token_authentication()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_perform_oauth_authentication">perform_oauth_authentication()</a></li>
<li class=""><a href="classes/MainWP-REST-Authentication.html#method_update_last_access">update_last_access()</a></li>
</ul>
</li>
</ul>
</section>
</section>
</div>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
<a href="classes/MainWP-REST-Authentication.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>