You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Developers define web API resources and their permissions in a <code>webapi.xml</code> configuration file. For details, see <ahref="{{ site.gdeurl }}extension-dev-guide/service-contracts/service-to-web-service.html#sample-webapi">Sample webapi.xml file</a>.</p>
15
-
16
-
<p>Before you can make web API calls, you must authenticate your identity and have requisite permissions (authorization) to access the API resource. Authentication allows Magento to identify the caller's user type. Based on the user's (admin, integration, customer or guest) access rights, resource acessibility is determined.
12
+
<h2id="overview-authenticate">Web API Authentication overview</h2>
13
+
<p>
14
+
Magento allows developers to define web API resources and their permissions in a configuration file <code>webapi.xml</code>.
15
+
Here are more details on exposing <ahref="http://devdocs.magento.com/guides/v1.0/extension-dev-guide/service-contracts/service-to-web-service.html">services as Web APIs.</a>
17
16
17
+
Before you can make web API calls, you must authenticate your identity and have requisite permissions (authorization) to access the API resource. Authentication allows Magento to identify the caller's user type. Based on the user's (admin, integration, customer or guest) access rights, API calls' resource acessibility is determined.
<p>The resources that you can access depend on your user type and the configured permission of the resource in the <code>webapi.xml</code> file. This table lists the resources that each user type can access:</p>
21
22
<tablestyle="width:100%">
22
23
<trbgcolor="lightgray">
23
24
<th>User type</th>
24
-
<th>Accessible resources</th>
25
+
<th>Accessible resources (defined in webapi.xml)</th>
25
26
</tr>
26
27
<tr>
27
28
<td>
@@ -37,7 +38,6 @@ Developers define web API resources and their permissions in a <code>webapi.xml<
37
38
</td>
38
39
<td>
39
40
<p>Resources for which admins or integrations are authorized. For example, if admins are authorized for the <code>Magento_Customer::group</code> resource, they can make a <code>GET /V1/customerGroups/:id</code> call.</p>
40
-
<p>The <code>acl.xml</code> file for the module defines the access control list (ACL) for resources. See <a href="#acl-xml-file">Sample acl.xml file</a>.</p>
41
41
</td>
42
42
</tr>
43
43
<tr>
@@ -49,18 +49,90 @@ Developers define web API resources and their permissions in a <code>webapi.xml<
49
49
</td>
50
50
</tr>
51
51
</table>
52
-
<divclass="bs-callout bs-callout-info"id="info">
53
-
<p>A guest user is one that the Magento web API framework cannot authenticate through existing authentication mechanisms.</p>
54
-
</div>
55
-
<h3id="acl-xml-file">Sample acl.xml file</h3>
56
-
<p>The following <code>acl.xml</code> file defines the access control list (ACL) for the Customer module. It defines available set of permissions to access the customer resources. Ex: account, customer configuration, and customer group resources:</p>
acl.xml files across all Magento modules are consolidated to build the ACL tree which is used to select allowed Admin role resources or third party Integration's access (System > Extension > Integration > Add New Integration > Available APIs).
59
52
60
-
When a developer creates the Web API configuration file : webapi.xml, the permissions defined in acl.xml are referenced to create access rights for each API.
53
+
<h3id="acl-webapi-relation">Relation between acl.xml and webapi.xml</h3>
54
+
<p>The acl.xml file defines the access control list (ACL) for a given module. It defines available set of permissions to access the resources. acl.xml files across all Magento modules are consolidated to build an ACL tree which is used to select allowed Admin role resources or third party Integration's access (System > Extension > Integration > Add New Integration > Available APIs).
When a developer creates the Web API configuration file : webapi.xml, the permissions defined in acl.xml are referenced to create access rights for each API.
In the above webapi.xml, for the "<routeurl="/V1/customerGroups/:id"method="GET">" API, only a user with a "Magento_Customer::group" can access the API. The user can be an admin (or an Integration) defined in the backend with the customer group selected as one of the resource in the ACL tree.
130
+
In the above sample webapi.xml, for the customerGroups resource, only a user with a "Magento_Customer::group" can access the GET /V1/customerGroups/:id API. On the other hand, POST /V1/customers (customer creation) can be accessed anonymously (or by a guest) without a need for presenting the identity.
131
+
132
+
The user here can be an admin (or an Integration) defined in the backend with the customer group selected as one of the resource in the ACL tree.
133
+
<divclass="bs-callout bs-callout-info"id="info">
134
+
<p>A guest or anonymous is a special permission that doesn't need to be defined in acl.xml (and will not show up in the acl tree in the backend). It just indicates that the current resource in webapi.xml can be accessed without the need for authentication. Similarly self is a special access if you already have an authenticated session with the system and allows the user to access resources they own. ex GET /V1/customers/me will fetch the logged in customer's details. This is typically useful for javascript based widgets. </p>
135
+
</div>
64
136
65
137
<h3id="webapi-clients">Web API clients and authentication methods</h3>
66
138
<p>You use a client, such as a mobile application or an external batch job, to access Magento services through web APIs.</p>
0 commit comments