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
Copy file name to clipboardExpand all lines: docs/authorization.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ group elsewhere, like checking if `$user->inGroup('superadmin')`. By default, th
50
50
### Default User Group
51
51
52
52
When a user is first registered on the site, they are assigned to a default user group. This group is defined in
53
-
`app/config/AuthGroups::defaultGroup`, and must match the name of one of the defined groups.
53
+
`Config\AuthGroups::$defaultGroup`, and must match the name of one of the defined groups.
54
54
55
55
```php
56
56
public $defaultGroup = 'users';
@@ -132,7 +132,7 @@ if (! $user->hasPermission('users.create')) {
132
132
133
133
#### Authorizing via Filters
134
134
135
-
You can restrict access to multiple routes through a [Controller Filter](https://codeigniter.com/user_guide/incoming/filters.html). One is provided for both restricting via groups the user belongs to, as well as which permission they need. The filters are automatically registered with the system under the `group` and `permission` aliases, respectively. You can define the protections within `app/Config/Filters.php`:
135
+
You can restrict access to multiple routes through a [Controller Filter](https://codeigniter.com/user_guide/incoming/filters.html). One is provided for both restricting via groups the user belongs to, as well as which permission they need. The filters are automatically registered with the system under the `group` and `permission` aliases, respectively. You can define the protections within **app/Config/Filters.php**:
Copy file name to clipboardExpand all lines: docs/guides/api_tokens.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
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.
4
4
5
-
> **Note** By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change this value by setting the `$authenticatorHeader['tokens']` value in the `Auth.php` config file.
5
+
> **Note** By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change this value by setting the `$authenticatorHeader['tokens']` value in the **app/Config/Auth.php** config file.
6
6
7
7
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.
8
8
@@ -57,7 +57,7 @@ $user->revokeAllAccessTokens();
57
57
58
58
The first way to specify which routes are protected is to use the `tokens` controller filter.
59
59
60
-
For example, to ensure it protects all routes under the `/api` route group, you would use the `$filters` setting on `app/Config/Filters.php`.
60
+
For example, to ensure it protects all routes under the `/api` route group, you would use the `$filters` setting on **app/Config/Filters.php**.
Copy file name to clipboardExpand all lines: docs/guides/mobile_apps.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Mobile Authentication with Access Tokens
2
2
3
-
Access Tokens can be used to authenticate mobile applications that are consuming your API. This is similar to how you would work with [third-party users](api_tokens.md) of your API, but with small differences in how you would issue the tokens.
3
+
Access Tokens can be used to authenticate mobile applications that are consuming your API. This is similar to how you would work with [third-party users](./api_tokens.md) of your API, but with small differences in how you would issue the tokens.
4
4
5
5
## Issuing the Tokens
6
6
@@ -61,6 +61,6 @@ When making all future requests to the API, the mobile client should return the
61
61
62
62
> **Note**
63
63
>
64
-
> By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change the header name by setting the `$authenticatorHeader['tokens']` value in the `Auth.php` config file.
64
+
> By default, `$authenticatorHeader['tokens']` is set to `Authorization`. You can change the header name by setting the `$authenticatorHeader['tokens']` value in the **app/Config/Auth.php** config file.
65
65
>
66
66
> 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.
Copy file name to clipboardExpand all lines: docs/install.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
-[Protect All Pages](#protect-all-pages)
13
13
-[Rate Limiting](#rate-limiting)
14
14
15
-
These instructions assume that you have already [installed the CodeIgniter 4 app starter](https://codeigniter.com/user_guide/installation/installing_composer.html) as the basis for your new project, set up your `.env` file, and created a database that you can access via the Spark CLI script.
15
+
These instructions assume that you have already [installed the CodeIgniter 4 app starter](https://codeigniter.com/user_guide/installation/installing_composer.html) as the basis for your new project, set up your **.env** file, and created a database that you can access via the Spark CLI script.
16
16
17
17
## Requirements
18
18
@@ -54,14 +54,14 @@ Require it with an explicit version constraint allowing its desired stability.
54
54
```
55
55
56
56
The above specifies `develop` branch.
57
-
See https://getcomposer.org/doc/articles/versions.md#branches
57
+
See <https://getcomposer.org/doc/articles/versions.md#branches>
58
58
59
59
```console
60
60
composer require codeigniter4/shield:^1.0.0-beta
61
61
```
62
62
63
63
The above specifies `v1.0.0-beta` or later and before `v2.0.0`.
64
-
See https://getcomposer.org/doc/articles/versions.md#caret-version-range-
64
+
See <https://getcomposer.org/doc/articles/versions.md#caret-version-range->
65
65
66
66
## Initial Setup
67
67
@@ -73,7 +73,7 @@ Require it with an explicit version constraint allowing its desired stability.
73
73
php spark shield:setup
74
74
```
75
75
76
-
2. Configure `app/Config/Email.php` to allow Shield to send emails with the [Email Class](https://codeigniter.com/user_guide/libraries/email.html).
76
+
2. Configure **app/Config/Email.php** to allow Shield to send emails with the [Email Class](https://codeigniter.com/user_guide/libraries/email.html).
77
77
78
78
```php
79
79
<?php
@@ -103,7 +103,7 @@ Require it with an explicit version constraint allowing its desired stability.
103
103
There are a few setup items to do before you can start using Shield in
104
104
your project.
105
105
106
-
1. Copy the `Auth.php` and `AuthGroups.php` from `vendor/codeigniter4/shield/src/Config/` into your project's config folder and update the namespace to `Config`. You will also need to have these classes extend the original classes. See the example below. These files contain all of the settings, group, and permission information for your application and will need to be modified to meet the needs of your site.
106
+
1. Copy the **Auth.php** and **AuthGroups.php** from **vendor/codeigniter4/shield/src/Config/** into your project's config folder and update the namespace to `Config`. You will also need to have these classes extend the original classes. See the example below. These files contain all of the settings, group, and permission information for your application and will need to be modified to meet the needs of your site.
107
107
108
108
```php
109
109
// new file - app/Config/Auth.php
@@ -120,7 +120,7 @@ your project.
120
120
}
121
121
```
122
122
123
-
2. **Helper Setup** The `setting` helper needs to be included in almost every page. The simplest way to do this is to add it to the `BaseController::initController` method:
123
+
2. **Helper Setup** The `setting` helper needs to be included in almost every page. The simplest way to do this is to add it to the `BaseController::initController()` method:
124
124
125
125
```php
126
126
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@@ -134,13 +134,13 @@ your project.
134
134
135
135
This requires that all of your controllers extend the `BaseController`, but that's a good practice anyway.
136
136
137
-
3. **Routes Setup** The default auth routes can be setup with a single call in `app/Config/Routes.php`:
137
+
3. **Routes Setup** The default auth routes can be setup with a single call in **app/Config/Routes.php**:
138
138
139
139
```php
140
140
service('auth')->routes($routes);
141
141
```
142
142
143
-
4. **Security Setup** Set `Config\Security::$csrfProtection` to `'session'` (or set `security.csrfProtection = session` in your `.env` file) for security reasons, if you use Session Authenticator.
143
+
4. **Security Setup** Set `Config\Security::$csrfProtection` to `'session'` (or set `security.csrfProtection = session` in your **.env** file) for security reasons, if you use Session Authenticator.
144
144
145
145
5. **Migration** Run the migrations.
146
146
@@ -152,14 +152,14 @@ your project.
152
152
153
153
When you run `spark migrate --all`, if you get `Class "SQLite3" not found` error:
154
154
155
-
1. Remove sample migration files in `tests/_support/Database/Migrations/`
155
+
1. Remove sample migration files in **tests/_support/Database/Migrations/**
156
156
2. Or install `sqlite3` php extension
157
157
158
158
If you get `Specified key was too long` error:
159
159
160
160
1. Use InnoDB, not MyISAM.
161
161
162
-
6. Configure `app/Config/Email.php` to allow Shield to send emails.
162
+
6. Configure **app/Config/Email.php** to allow Shield to send emails.
163
163
164
164
```php
165
165
<?php
@@ -207,13 +207,13 @@ auth-rates | Provides a good basis for rate limiting of auth-related routes.
207
207
group | Checks if the user is in one of the groups passed in.
208
208
permission | Checks if the user has the passed permissions.
209
209
210
-
These can be used in any of the [normal filter config settings](https://codeigniter.com/user_guide/incoming/filters.html?highlight=filter#globals), or [within the routes file](https://codeigniter.com/user_guide/incoming/routing.html?highlight=routs#applying-filters).
210
+
These can be used in any of the [normal filter config settings](https://codeigniter.com/user_guide/incoming/filters.html#globals), or [within the routes file](https://codeigniter.com/user_guide/incoming/routing.html#applying-filters).
211
211
212
-
> **Note** These filters are already loaded for you by the registrar class located at `src/Config/Registrar.php`.
212
+
> **Note** These filters are already loaded for you by the registrar class located at **src/Config/Registrar.php**.
213
213
214
214
### Protect All Pages
215
215
216
-
If you want to limit all routes (e.g. `localhost:8080/admin`, `localhost:8080/panel` and ...), you need to add the following code in the `app/Config/Filters.php` file.
216
+
If you want to limit all routes (e.g. `localhost:8080/admin`, `localhost:8080/panel` and ...), you need to add the following code in the **app/Config/Filters.php** file.
217
217
218
218
```php
219
219
public $globals = [
@@ -241,7 +241,7 @@ public $filters = [
241
241
];
242
242
```
243
243
244
-
> **Note** If you have grouped or changed the default format of the routes, ensure that your code matches the new format(s) in the `App/Config/Filter.php` file.
244
+
> **Note** If you have grouped or changed the default format of the routes, ensure that your code matches the new format(s) in the **app/Config/Filter.php** file.
245
245
246
246
For example, if you configured your routes like so:
0 commit comments