WordPress REST API Authentication plugin ger säkerheten från obehörig åtkomst till dina WordPress REST API:er.
Sökresultat :
×WordPress REST API Authentication using Third Party Provider method involves the use of tokens
(access-token/id-token/jwt token) received from third-party providers like Google, Facebook, Firebase, Apple, Azure
AD, Keycloak, Okta, AWS Cognito, Github, Slack, Gitlab, etc. for accessing wordpress rest api securely.
WordPress endpoints are not secure by default and data can be stolen via REST APIs in JSON format. WordPress REST
API Authentication allows you to call REST APIs with multiple security methods like Basic Auth, API KEY, JWT token,
OAuth token . In this guide we will use OAuth token issued by OAuth/OpenID Connect/Firebase providers to validate
the REST API requests which will keep your WordPress website protected and secure.
Each time a request to access the REST API will be made, the authentication will be done against that token issued
by third-party providers like Google, Facebook, Firebase, Apple, okta, etc, and on the basis of the validation of
the API token, the resources for that REST API request will be allowed to access.
So, the single token you obtained on your app after SSO login can be used further for accessing WP REST API
endpoints.
WordPress REST API Authentication plugin ger säkerheten från obehörig åtkomst till dina WordPress REST API:er.
1. The WordPress REST API Endpoint request is made with the access/id token obtained from the OAuth/OpenID Connect Identity providers passed in the Authorization header with the token type as Bearer.
2. The WordPress REST API request is monitored by our plugin and the JWT token validation/authentication request is sent to the OAuth/OpenID Connect Identity provider(Server).
3. The response is returned from the OAuth/OpenID Connect Identity provider(Server) for the request being made earlier to validate the JWT token.
4. If the JWT token validation/authentication is successful then the requested resource is allowed to be accessed which means the requestor is now authorized to access the resource/data and if in case, the token validation is failed then an error response will be returned. So the resource data is now protected and can be accessed on authorization, hence the security is not a concern.
Relaterat användningsfall: How to prevent WordPress REST API endpoints using the JWT token provided by Social Login or OAuth2.0/OpenID Connect Identity Providers?
How to perform authentication and ensure security or perform authorization to grant access to the WordPress REST API endpoints on the basis of the access/id token provided by Social Login/OAuth providers during OAuth/OpenID SSO login flow?
Request: GET https://<domain-name>/wp-json/wp/v2/posts
Header:
access_token : < access_token >
OR
id_token : < id_token >
-H 'app-name:TheAppName'
var client = new RestClient("http://<wp_base_url>/wp-json/wp/v2/posts ");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "< access_token > OR id_token <id_token>");
request.AddHeader = ("app-name", "TheAppName");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://<wp_base_url>/wp-json/wp/v2/posts ")
.method("GET", null)
.addHeader = ("Authorization", "< access_token > OR id_token <id_token>")
.addHeader = ("app-name", "TheAppName");
.build();
Response responseclient.newCall(request).execute();
var settings = {
"url": "http://<wp_base_url>/wp-json/wp/v2/posts ",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "< access_token > OR id_token <id_token>"
"app-name": "TheAppName"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array
(
CURLOPT_URL => 'http://%3Cwp_base_url%3E/wp-json/wp/v2/posts%20',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: < access_token > OR id_token <id_token>'
'app-name: TheAppName'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
conn = http.client.HTTPSConnection("<wp_base_url>")
payload= "
headers = {
'Authorization': '< access_token > OR id_token <id_token>'
'app-name': 'TheAppName',
}
conn.request("GET", "/wp-json/wp/v2/posts ", payload, headers)
res= conn.getresponse()
data = res.read()
print (data.decode("utf-8"))
Följ stegen nedan för att göra REST API-begäran med Postman:
1. Rollbaserad REST API-begränsning:
This feature allows restricting the REST API access based on the user roles. You can whitelist the roles for which you want to allow access to the requested resource for the REST APIs. So whenever a REST API request is made by a user, his role will be fetched and only allowed to access the resource if his role is whitelisted.
Hur konfigurerar man det?
Notera: The Role based restriction feature is valid for Basic authentication(Username: password), JWT method, and OAuth 2.0 (Password grant).
2. Anpassad rubrik
Den här funktionen ger ett alternativ att välja en anpassad rubrik istället för standardhuvudet "Auktorisering".
It will increase the security as you have the header named with your ‘custom name’, so if someone makes the REST API request with a header as ‘Authorization’ then he won’t be able to access the APIs.
Hur konfigurerar man det?
3. Uteslut REST API:er
This feature allows you to whitelist your REST APIs so these can be accessed directly without any authentication. Hence all these whitelisted REST APIs are publicly available.
Hur konfigurerar man det?
4. Anpassad tokens utgång
This feature is applicable for JWT and OAuth 2.0 methods which uses time based tokens to authenticate the WordPress REST API endpoints. This feature allows you to set the custom expiry for the tokens such that the token will no longer be valid once the token expires.
Hur konfigurerar man det?
Därför, med denna anpassade tokens utgångsfunktion, ökar säkerheten ytterligare.
5. Aktivera avancerad kryptering för tokens med HMAC
This feature is available with the Basic Authentication method in which by default the token is encrypted using Base64 encoding technique but with the advanced feature, the token can be encrypted with highly secure HMAC encryption which is very secure.
6. Signaturvalidering för JWT-baserade tokens
This feature allows a secure signing of the JWT signature for the JWT token such that your JWT token is much more secure and the signature can only be decoded using the client secret/certificate. It means your signature is private and can not be seen by others.
We provide the support for 2 Signing algorithms: HS256 and RS256.So, any of the signing algorithms can be chosen from the dropdown as shown in the above image.
Du måste också lägga till din klienthemlighet eller certifikat som används för att signera signaturen för JWT.
7. Skapa användarspecifik API-nyckel/tokens
Så här använder du den här funktionen:
Maila oss vidare apisupport@xecurify.com for quick guidance(via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.
WordPress REST API Authentication plugin ger säkerheten för obehörig åtkomst till dina WordPress REST API:er. Det ger dig en mängd olika autentiseringsmetoder som grundläggande autentisering, API-nyckelautentisering, OAuth 2.0-autentisering, JWT-autentisering.
Denna plugin låter dig skapa anpassade slutpunkter/REST-rutter för att hämta/modifiera/skapa/ta bort data med ett lättanvänt grafiskt gränssnitt och även med anpassade SQL-frågor. Plugin-programmet tillhandahåller också funktionen för att integrera extern API i din WordPress-webbplats med tredjepartsplattformar.
Behövs hjälp? Vi är här!
Tack för din förfrågan.
Om du inte hör från oss inom 24 timmar, skicka gärna ett uppföljningsmail till info@xecurify.com
Denna sekretesspolicy gäller för miniorange webbplatser som beskriver hur vi hanterar personuppgifterna. När du besöker någon webbplats kan den lagra eller hämta informationen i din webbläsare, mestadels i form av cookies. Den här informationen kan handla om dig, dina preferenser eller din enhet och används mest för att webbplatsen ska fungera som du förväntar dig. Informationen identifierar dig inte direkt, men den kan ge dig en mer personlig webbupplevelse. Klicka på kategorirubrikerna för att kontrollera hur vi hanterar cookies. För sekretesspolicyn för våra lösningar kan du se integritetspolicy.
Nödvändiga cookies hjälper till att göra en webbplats fullt användbar genom att aktivera de grundläggande funktionerna som webbplatsnavigering, inloggning, fylla i formulär etc. De cookies som används för funktionaliteten lagrar ingen personlig identifierbar information. Vissa delar av webbplatsen kommer dock inte att fungera korrekt utan cookies.
Dessa cookies samlar endast in samlad information om trafiken på webbplatsen inklusive - besökare, källor, sidklick och visningar etc. Detta gör att vi kan veta mer om våra mest och minst populära sidor tillsammans med användarnas interaktion med de handlingsbara elementen och därmed låta oss veta mer om våra mest och minst populära sidor vi förbättrar prestandan på vår webbplats såväl som våra tjänster.