Skip to content

Commit ee2ca79

Browse files
authored
Merge pull request #30 from dotkernel/arhimede
typos
2 parents 5f3a3e8 + 46287f7 commit ee2ca79

4 files changed

Lines changed: 28 additions & 26 deletions

File tree

docs/book/v4/core-features/authentication.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
Authentication is the process by which an identity is presented to the application. It ensures that the entity
44
making the request has the proper credentials to access the API.
55

6-
**DotKernel API** identities are delivered to the application from the client through the `Authorization` request
6+
**DotKernel API** identities are delivered to the application from the client through the `Authorization` request.
77
If it is present, the application tries to find and assign the identity to the application. If it is not presented,
88
DotKernel API assigns a default `guest` identity, represented by an instance of the class
99
`Mezzio\Authentication\UserInterface`.
1010

1111
## Configuration
1212

13-
Authentication in DotKernel API is built around `mezzio/mezzio-authentication-oauth2` component and is already
14-
configured with what is necessary in order to work. But if you want to dig more, the configuration is stored in
13+
Authentication in DotKernel API is built around the `mezzio/mezzio-authentication-oauth2` component and is already
14+
configured out of the box. But if you want to dig more, the configuration is stored in
1515
`config/autoload/local.php` under the `authentication` key.
1616

1717
> You can check the
@@ -27,17 +27,17 @@ The authentication happens through the middleware in the `Api\App\Middleware\Aut
2727

2828
## Database
2929

30-
When **DotKernel API** is installed for the first time, and you run the migrations and seeders, all the tables
31-
needed for authentication are automatically created and populated with the data needed for authentication.
30+
When you install **DotKernel API** for the first time, you need to run the migrations and seeders. All the tables
31+
required for authentication are automatically created and populated.
3232

33-
In DotKernel API, authenticated users come from either the `admin` or the `users` table. We choose to keep the admin
33+
In DotKernel API, authenticated users come from either the `admin` or the `user` table. We choose to keep the admin
3434
table separated from the users to prevent users of the application from accessing sensitive data, which only the
3535
administrators of the application should access.
3636

37-
Knowing this, upon migrations, the `oauth_clients` table is pre-populated with the default `admin` and `frontend`
38-
clients with the same password as their names (you can change those passwords).
37+
The `oauth_clients` table is pre-populated with the default `admin` and `frontend` clients with the same password as
38+
their names (**we recommend you change the default passwords**).
3939

40-
As you guessed each client serves to authenticate `admin` or `users`.
40+
As you guessed each client serves to authenticate `admin` or `user`.
4141

4242
Another table that is pre-populated is the `oauth_scopes` table, with the `api` scope.
4343

@@ -91,8 +91,7 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...
9191

9292
### Refreshing tokens
9393

94-
DotKernel API provides the ability to refresh the access token, by generating a new one using the expired access
95-
token's `refresh_token`.
94+
DotKernel API can refresh the access token, based on the expired access token's `refresh_token`.
9695

9796
The clients need to send a `POST` request to the `/security/refresh-token` with the following request
9897

docs/book/v4/core-features/authorization.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Authorization
22

3-
Authorization is the process by which a system take a validated identity and checks if that identity has access to a
3+
Authorization is the process by which a system takes a validated identity and checks if that identity has access to a
44
given resource.
55

6-
DotKernel APIs implementation of authorization uses `Mezzio\Authorization\Rbac\LaminasRbac` as a model of
6+
**DotKernel API**'s implementation of authorization uses `Mezzio\Authorization\Rbac\LaminasRbac` as a model of
77
Role-Based Access Control (RBAC).
88

99
## How it works
@@ -16,8 +16,7 @@ The authorization happens through the `Api\App\Middleware\AuthorizationMiddlewar
1616

1717
## Configuration
1818

19-
DotKernel API makes use of `mezzio-authorization-rbac` and upon installation all the configuration is already made
20-
in order for the authorization to work.
19+
DotKernel API makes use of `mezzio-authorization-rbac` and includes the full configuration.
2120

2221
The configuration file for the role and permission definitions is `config/autoload/authorization.global.php`.
2322

@@ -65,15 +64,14 @@ roles (`user`, `guest`).
6564
Roles inherit the permissions from their parents:
6665

6766
- `superuser` has no parent
68-
- `admin` has `superuser` as a parent which means `superuser` will inherit `admin` permissions
67+
- `admin` has `superuser` as a parent which means `superuser` also has `admin` permissions
6968
- `user` has no parent
70-
- `guest` has `user` as a parent which means `user` will inherit `guest` permissions
69+
- `guest` has `user` as a parent which means `user` also has `guest` permissions
7170

7271
For each role we defined an array of permissions. A permission in DotKernel API is basically a route name.
7372

74-
As you can see, the `superuser` does not have its own permissions, because it inherits all the permissions
75-
from `admin`,
76-
no need to define permissions for it unless necessary.
73+
As you can see, the `superuser` does not have its own permissions, because it gains all the permissions
74+
from `admin`, no need to define explicit permissions.
7775

78-
The `user` role, inherits all the permission from `guest` so no need to define that `user` can access `home` route, but
76+
The `user` role, gains all the permission from `guest` so no need to define that `user` can access `home` route, but
7977
`guest` cannot access user-specific routes.

docs/book/v4/core-features/cors.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ When integrating an API, most developers have encountered the following error me
1212
> Access to fetch at _RESOURCE_URL_ from origin _ORIGIN_URL_ has been blocked by CORS policy:
1313
> No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
1414
15-
This happens because the API (_RESOURCE_URL_) is not configured to accept requests from the client (_RESOURCE_URL_).
15+
This happens because the API (_RESOURCE_URL_) is not configured to accept requests from the client (_ORIGIN_URL_).
1616

1717
## How to fix?
1818

@@ -75,13 +75,13 @@ return [
7575
];
7676
```
7777

78-
See below list that explains the above configuration values:
78+
This list explains the above configuration values:
7979

8080
- `allowed_origins`: an array of domains that are allowed to interact with the API
8181
(default `ConfigurationInterface::ANY_ORIGIN` which means that any domain can make requests to the API)
82-
- `allowed_headers`: an array of custom headers allowed
83-
- `allowed_max_age`: the maximum age, the preflight response may be cached by a client
84-
- `credentials_allowed`: if a request is allowed to pass cookies
82+
- `allowed_headers`: an array of allowed custom headers
83+
- `allowed_max_age`: the maximum duration, since the preflight response may be cached by a client
84+
- `credentials_allowed`: allows a request to pass cookies
8585
- `exposed_headers`: an array of headers which are being exposed by the endpoint
8686

8787
Save and close the file.

mkdocs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ nav:
3030
- "Content Validation": v4/core-features/content-validation.md
3131
- "Exceptions": v4/core-features/exceptions.md
3232
- "CORS": v4/core-features/cors.md
33+
- Commands:
34+
- "Create admin account": v4/commands/create-admin-account.md
35+
- "Generate database migrations": v4/commands/generate-database-migrations.md
36+
- "Display available endpoints": v4/commands/display-available-endpoints.md
37+
- "Generate tokens": v4/commands/generate-tokens.md
3338
- Tutorials:
3439
- "Creating a book module": v4/tutorials/create-book-module.md
3540
- Transition from API Tools:

0 commit comments

Comments
 (0)