Skip to content

Commit 19bbfbb

Browse files
committed
use new style for note and warning
1 parent 82f0ee5 commit 19bbfbb

17 files changed

Lines changed: 120 additions & 95 deletions

docs/addons/jwt.md

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

3-
> **Note**
4-
> Shield now supports only JWS (Singed JWT). JWE (Encrypted JWT) is not supported.
3+
!!! note
4+
5+
Shield now supports only JWS (Singed JWT). JWE (Encrypted JWT) is not supported.
56

67
## What is JWT?
78

@@ -87,9 +88,10 @@ Configure **app/Config/AuthJWT.php** for your needs.
8788

8889
### Set the Default Claims
8990

90-
> **Note**
91-
> A payload contains the actual data being transmitted, such as user ID, role,
92-
> or expiration time. Items in a payload is called *claims*.
91+
!!! note
92+
93+
A payload contains the actual data being transmitted, such as user ID, role,
94+
or expiration time. Items in a payload is called *claims*.
9395

9496
Set the default payload items to the property `$defaultClaims`.
9597

@@ -121,8 +123,9 @@ with the following command:
121123
php -r 'echo base64_encode(random_bytes(32));'
122124
```
123125

124-
> **Note**
125-
> The secret key is used for signing and validating tokens.
126+
!!! note
127+
128+
The secret key is used for signing and validating tokens.
126129

127130
## Issuing JWTs
128131

docs/customization/login_identifier.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ This only works with the Session authenticator.
2121
'employee_id'
2222
];
2323
```
24-
> **Warning**
25-
> It is very important for security that if you add a new column for identifier, you must write a new **Validation Rules** and then set it using the [Customizing Validation Rules](./validation_rules.md) description.
24+
!!! warning
25+
26+
It is very important for security that if you add a new column for identifier, you must write a new **Validation Rules** and then set it using the [Customizing Validation Rules](./validation_rules.md) description.
2627

2728
3. Edit the login form to change the name of the default `email` input to the new field name.
2829

docs/customization/table_names.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ public array $tables = [
1717

1818
Set the table names that you want in the array values.
1919

20-
> **Note**
21-
> You must change the table names before running database migrations.
20+
!!! note
21+
22+
You must change the table names before running database migrations.

docs/customization/validation_rules.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ Shield has the following rules for registration by default:
3939
];
4040
```
4141

42-
> **Note**
43-
> If you customize the table names, the table names
44-
> (`users` and `auth_identities`) in the above rules will be automatically
45-
> changed. The rules are implemented in
46-
> `RegisterController::getValidationRules()`.
42+
!!! note
43+
44+
If you customize the table names, the table names(`users` and `auth_identities`) in the above rules will be automatically changed.
45+
The rules are implemented in `RegisterController::getValidationRules()`.
4746

4847
If you need a different set of rules for registration, you can specify them in your `Validation` configuration (**app/Config/Validation.php**) like:
4948

@@ -85,9 +84,9 @@ If you need a different set of rules for registration, you can specify them in y
8584
];
8685
```
8786

88-
> **Note**
89-
> If you customize the table names, set the correct table names in the
90-
> rules.
87+
!!! note
88+
89+
If you customize the table names, set the correct table names in the rules.
9190

9291
## Login
9392

docs/getting_started/install.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ Require it with an explicit version constraint allowing its desired stability.
6262
php spark shield:setup
6363
```
6464

65-
> **Note**
66-
> If you want to customize table names, you must change the table names
67-
> before running database migrations.
68-
> See [Customizing Table Names](../customization/table_names.md).
65+
!!! note
66+
67+
If you want to customize table names, you must change the table names before running database migrations.
68+
See [Customizing Table Names](../customization/table_names.md).
6969

7070
2. Configure **app/Config/Email.php** to allow Shield to send emails with the [Email Class](https://codeigniter.com/user_guide/libraries/email.html).
7171

@@ -140,10 +140,10 @@ your project.
140140

141141
5. **Migration** Run the migrations.
142142

143-
> **Note**
144-
> If you want to customize table names, you must change the table names
145-
> before running database migrations.
146-
> See [Customizing Table Names](../customization/table_names.md).
143+
!!! note
144+
145+
If you want to customize table names, you must change the table names before running database migrations.
146+
See [Customizing Table Names](../customization/table_names.md).
147147

148148
```console
149149
php spark migrate --all

docs/guides/api_hmac_keys.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Protecting an API with HMAC Keys
22

3-
> **Note**
4-
> For the purpose of this documentation and to maintain a level of consistency with the Authorization Tokens,
3+
!!! note
4+
5+
For the purpose of this documentation and to maintain a level of consistency with the Authorization Tokens,
56
the term "Token" will be used to represent a set of API Keys (key and secretKey).
67

78
HMAC Keys can be used to authenticate users for your own site, or when allowing third-party developers to access your
89
API. When making requests using HMAC keys, the token should be included in the `Authorization` header as an
910
`HMAC-SHA256` token.
1011

11-
> **Note**
12-
> By default, `$authenticatorHeader['hmac']` is set to `Authorization`. You can change this value by
13-
> setting the `$authenticatorHeader['hmac']` value in the **app/Config/AuthToken.php** config file.
12+
!!! note
13+
14+
By default, `$authenticatorHeader['hmac']` is set to `Authorization`. You can change this value by
15+
setting the `$authenticatorHeader['hmac']` value in the **app/Config/AuthToken.php** config file.
1416

1517
Tokens are issued with the `generateHmacToken()` method on the user. This returns a
1618
`CodeIgniter\Shield\Entities\AccessToken` instance. These shared keys are saved to the database in plain text. The
@@ -63,9 +65,10 @@ $token = $user->generateHmacToken('token-name', ['users-read']);
6365
return json_encode(['key' => $token->secret, 'secretKey' => $token->secret2]);
6466
```
6567

66-
> **Note**
67-
> At this time, scope names should avoid using a colon (`:`) as this causes issues with the route filters being
68-
> correctly recognized.
68+
!!! note
69+
70+
At this time, scope names should avoid using a colon (`:`) as this causes issues with the route filters being
71+
correctly recognized.
6972

7073
When handling incoming requests you can check if the token has been granted access to the scope with the `hmacTokenCan()` method.
7174

@@ -111,5 +114,6 @@ parses the raw token and looks it up the `key` portion in the database. Once fou
111114
to validate the remainder of the Authorization raw token. If it passes the signature test it can determine the correct user,
112115
which will then be available through an `auth()->user()` call.
113116

114-
> **Note**
115-
> Currently only a single scope can be used on a route filter. If multiple scopes are passed in, only the first one is checked.
117+
!!! note
118+
119+
Currently only a single scope can be used on a route filter. If multiple scopes are passed in, only the first one is checked.

docs/guides/api_tokens.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
Access Tokens can be used to authenticate users for your own site, or when allowing third-party developers to access your API. When making requests using access tokens, the token should be included in the `Authorization` header as a `Bearer` token.
44

5-
> **Note**
6-
> By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change this value by setting the `$authenticatorHeader['tokens']` value in the **app/Config/AuthToken.php** config file.
5+
!!! note
6+
7+
By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change this value by setting the `$authenticatorHeader['tokens']` value in the **app/Config/AuthToken.php** config file.
78

89
Tokens are issued with the `generateAccessToken()` method on the user. This returns a `CodeIgniter\Shield\Entities\AccessToken` instance. Tokens are hashed using a SHA-256 algorithm before being saved to the database. The access token returned when you generate it will include a `raw_token` field that contains the plain-text, un-hashed, token. You should display this to your user at once so they have a chance to copy it somewhere safe, as this is the only time this will be available. After this request, there is no way to get the raw token.
910

@@ -34,8 +35,9 @@ Access tokens can be given `scopes`, which are basically permission strings, for
3435
return $user->generateAccessToken('token-name', ['users-read'])->raw_token;
3536
```
3637

37-
> **Note**
38-
> At this time, scope names should avoid using a colon (`:`) as this causes issues with the route filters being correctly recognized.
38+
!!! note
39+
40+
At this time, scope names should avoid using a colon (`:`) as this causes issues with the route filters being correctly recognized.
3941

4042
When handling incoming requests you can check if the token has been granted access to the scope with the `tokenCan()` method.
4143

@@ -77,5 +79,6 @@ $routes->get('users', 'UserController::list', ['filter' => 'tokens:users-read'])
7779

7880
When the filter runs, it checks the `Authorization` header for a `Bearer` value that has the raw token. It then hashes the raw token and looks it up in the database. Once found, it can determine the correct user, which will then be available through an `auth()->user()` call.
7981

80-
> **Note**
81-
> Currently only a single scope can be used on a route filter. If multiple scopes are passed in, only the first one is checked.
82+
!!! note
83+
84+
Currently only a single scope can be used on a route filter. If multiple scopes are passed in, only the first one is checked.

docs/guides/mobile_apps.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class LoginController extends BaseController
6868

6969
When making all future requests to the API, the mobile client should return the raw token in the `Authorization` header as a `Bearer` token.
7070

71-
> **Note**
72-
>
73-
> By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change the header name by setting the `$authenticatorHeader['tokens']` value in the **app/Config/AuthToken.php** config file.
74-
>
75-
> e.g. if `$authenticatorHeader['tokens']` is set to `PersonalAccessCodes` then the mobile client should return the raw token in the `PersonalAccessCodes` header as a `Bearer` token.
71+
!!! note
72+
73+
By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change the header name by setting the `$authenticatorHeader['tokens']` value in the **app/Config/AuthToken.php** config file.
74+
e.g. if `$authenticatorHeader['tokens']` is set to `PersonalAccessCodes` then the mobile client should return the raw token in the `PersonalAccessCodes` header as a `Bearer` token.

docs/guides/strengthen_password.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ It is the recommended minimum value by NIST. However, some organizations recomme
1515

1616
The longer the password, the stronger it is. Consider increasing the value.
1717

18-
> **Note**
19-
>
20-
> This checking works when you validate passwords with the `strong_password[]`
21-
> validation rule.
22-
>
23-
> If you disable `CompositionValidator` (enabled by default) in `$passwordValidators`,
24-
> this checking will not work.
18+
!!! note
19+
20+
This checking works when you validate passwords with the `strong_password[]`
21+
validation rule.
22+
If you disable `CompositionValidator` (enabled by default) in `$passwordValidators`,
23+
this checking will not work.
2524

2625
## Password Hashing Algorithm
2726

@@ -117,6 +116,6 @@ setting for using passwords stored in older versions of Shield that were [vulner
117116
This setting is deprecated. If you have this setting set to `true`, you should change
118117
it to `false` as soon as possible, and remove old hashed password in your database.
119118

120-
> **Note**
121-
>
122-
> This setting will be removed in v1.0.0 official release.
119+
!!! note
120+
121+
This setting will be removed in v1.0.0 official release.

docs/quick_start_guide/using_authorization.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ if (! auth()->user()->can('users.create')) {
7979
}
8080
```
8181

82-
> **Note**
83-
> The example above can also be done through a [controller filter](https://codeigniter.com/user_guide/incoming/filters.html) if you want to apply it to multiple pages of your site.
82+
!!! note
83+
84+
The example above can also be done through a [controller filter](https://codeigniter.com/user_guide/incoming/filters.html) if you want to apply it to multiple pages of your site.
8485

8586
## Adding a Group To a User
8687

0 commit comments

Comments
 (0)