Skip to content

Commit b5fbc78

Browse files
authored
Merge pull request #716 from codeigniter4/develop
1.0.0-beta.6 Ready code
2 parents 062d66b + deff49b commit b5fbc78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2846
-179
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,29 @@ The primary goals for Shield are:
1515

1616
## Authentication Methods
1717

18-
Shield provides two primary methods of authentication out of the box:
18+
Shield provides two primary methods **Session-based** and **Personal Access Codes**
19+
of authentication out of the box.
1920

20-
**Session-based**
21+
It also provides **JSON Web Tokens** authentication.
22+
23+
### Session-based
2124

2225
This is your typical email/username/password system you see everywhere. It includes a secure "remember me" functionality.
2326
This can be used for standard web applications, as well as for single page applications. Includes full controllers and
2427
basic views for all standard functionality, like registration, login, forgot password, etc.
2528

26-
**Personal Access Codes**
29+
### Personal Access Codes
2730

2831
These are much like the access codes that GitHub uses, where they are unique to a single user, and a single user
2932
can have more than one. This can be used for API authentication of third-party users, and even for allowing
3033
access for a mobile application that you build.
3134

35+
### JSON Web Tokens
36+
37+
JWT or JSON Web Token is a compact and self-contained way of securely transmitting
38+
information between parties as a JSON object. It is commonly used for authentication
39+
and authorization purposes in web applications.
40+
3241
## Some Important Features
3342

3443
* Session-based authentication (traditional email/password with remember me)

admin/RELEASE.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Release Process
2+
3+
> Documentation guide based on the releases of `1.0.0-beta.5` on March 17, 2023.
4+
>
5+
> -kenjis
6+
7+
## Changelog
8+
9+
When generating the changelog each Pull Request to be included must have one of
10+
the following [labels](https://github.com/codeigniter4/shield/labels):
11+
- **bug** ... PRs that fix bugs
12+
- **enhancement** ... PRs to improve existing functionalities
13+
- **new feature** ... PRs for new features
14+
- **refactor** ... PRs to refactor
15+
- **lang** ... PRs for new/update language
16+
17+
PRs with breaking changes must have the following additional label:
18+
- **breaking change** ... PRs that may break existing functionalities
19+
20+
### Check Generated Changelog
21+
22+
This process is checking only. Do not create a release.
23+
24+
To auto-generate, navigate to the
25+
[Releases](https://github.com/codeigniter4/shield/releases) page,
26+
click the "Draft a new release" button.
27+
28+
* Tag: "v1.0.0-beta.5" (Create new tag)
29+
* Target: develop
30+
31+
Click the "Generate release notes" button.
32+
33+
Check the resulting content. If there are items in the *Others* section which
34+
should be included in the changelog, add a label to the PR and regenerate
35+
the changelog.
36+
37+
## Preparation
38+
39+
* Clone **codeigniter4/shield** and resolve any necessary PRs
40+
```console
41+
git clone [email protected]:codeigniter4/shield.git
42+
```
43+
* Merge any Security Advisory PRs in private forks
44+
45+
## Process
46+
47+
> **Note** Most changes that need noting in the User Guide and docs should have
48+
> been included with their PR, so this process assumes you will not be
49+
> generating much new content.
50+
51+
* Create a new branch `release-1.x.x`
52+
* Update **src/Auth.php** with the new version number:
53+
`const SHIELD_VERSION = '1.x.x';`
54+
* Commit the changes with "Prep for 1.x.x release" and push to origin
55+
* Create a new PR from `release-1.x.x` to `develop`:
56+
* Title: "Prep for 1.x.x release"
57+
* Description: "Updates version references for `1.x.x`." (plus checklist)
58+
* Let all tests run, then review and merge the PR
59+
* Create a new PR from `develop` to `master`:
60+
* Title: "1.x.x Ready code"
61+
* Description: blank
62+
* Merge the PR
63+
* Create a new Release:
64+
* Version: "v1.x.x"
65+
* Target: master
66+
* Title: "v1.x.x"
67+
* Click the "Generate release notes" button
68+
* Remove "### Others (Only for checking. Remove this category)" section
69+
* Check "Create a discussion for this release"
70+
* Click the "Publish release" button
71+
* Watch for the "docs" action and verify that the user guide updated:
72+
* [docs](https://github.com/codeigniter4/shield/actions/workflows/docs.yml)
73+
* Fast-forward `develop` branch to catch the merge commit from `master`
74+
(note: pushing to develop is restricted to administrators):
75+
```console
76+
git fetch origin
77+
git checkout develop
78+
git merge origin/develop
79+
git merge origin/master
80+
git push origin HEAD # Only administrators can push to the protected branch.
81+
```
82+
* Publish any Security Advisories that were resolved from private forks
83+
(note: publishing is restricted to administrators)
84+
* Announce the release on the forums and Slack channel
85+
(note: this forum is restricted to administrators):
86+
* Make a new topic in the "News & Discussion" forums:
87+
https://forum.codeigniter.com/forum-2.html
88+
* The content is somewhat organic, but should include any major features and
89+
changes as well as a link to the User Guide's changelog

bin/update-en-comments

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/usr/bin/env php
2+
<?php declare(strict_types=1);
3+
4+
/**
5+
* This file is part of CodeIgniter 4 framework.
6+
*
7+
* (c) CodeIgniter Foundation <[email protected]>
8+
*
9+
* For the full copyright and license information, please view
10+
* the LICENSE file that was distributed with this source code.
11+
*/
12+
13+
require __DIR__ . '/../vendor/codeigniter4/framework/system/Test/bootstrap.php';
14+
15+
use CodeIgniter\CLI\CLI;
16+
17+
helper('filesystem');
18+
19+
if ($argc !== 2) {
20+
CLI::error('Please specify a locale.');
21+
22+
exit(1);
23+
}
24+
25+
$locale = $argv[1];
26+
27+
$langDir = realpath(__DIR__ . '/../src/Language/' . $locale);
28+
29+
if (! is_dir($langDir)) {
30+
CLI::error('No such directory: "' . $langDir . '"');
31+
32+
exit(1);
33+
}
34+
35+
$enDir = realpath(__DIR__ . '/../src/Language/en');
36+
37+
if (! is_dir($enDir)) {
38+
CLI::error('No "Language/en" directory. Please run "composer update".');
39+
40+
exit(1);
41+
}
42+
43+
$files = get_filenames(
44+
$langDir,
45+
true,
46+
false,
47+
false
48+
);
49+
50+
$enFiles = get_filenames(
51+
$enDir,
52+
true,
53+
false,
54+
false
55+
);
56+
57+
foreach ($enFiles as $enFile) {
58+
$temp = $langDir . '/' . substr($enFile, strlen($enDir) + 1);
59+
$langFile = realpath($temp) ?: $temp;
60+
61+
if (! is_file($langFile)) {
62+
CLI::error('No such file: "' . $langFile . '"');
63+
64+
continue;
65+
}
66+
67+
$enFileLines = file($enFile);
68+
69+
$items = [];
70+
71+
$pattern = '/(.*)\'([a-zA-Z0-9_]+?)\'(\s*=>\s*)([\'"].+[\'"]),/u';
72+
73+
foreach ($enFileLines as $line) {
74+
if (preg_match($pattern, $line, $matches)) {
75+
$items[] = [$matches[2] => $matches[4]];
76+
}
77+
}
78+
79+
$langFileLines = file($langFile);
80+
81+
$newLangFile = '';
82+
83+
$itemNo = 0;
84+
85+
foreach ($langFileLines as $line) {
86+
// Remove en value comment.
87+
if (preg_match('!(.*,)(\s*//.*)$!u', $line, $matches)) {
88+
$line = $matches[1] . "\n";
89+
}
90+
91+
if (preg_match($pattern, $line, $matches) === 0) {
92+
$newLangFile .= $line;
93+
} else {
94+
$indent = $matches[1];
95+
$key = $matches[2];
96+
$arrow = $matches[3];
97+
$value = $matches[4];
98+
99+
$newLangFile .= $indent . "'" . $key . "'" . $arrow . $value
100+
. ', // ' . $items[$itemNo][array_key_first($items[$itemNo])] . "\n";
101+
$itemNo++;
102+
}
103+
}
104+
105+
file_put_contents($langFile, $newLangFile);
106+
CLI::write('Updated: ' . $langFile);
107+
}

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
"codeigniter4/devkit": "^1.0",
2626
"codeigniter4/framework": "^4.2.7",
2727
"mikey179/vfsstream": "^1.6.7",
28-
"mockery/mockery": "^1.0"
28+
"mockery/mockery": "^1.0",
29+
"firebase/php-jwt": "^6.4"
2930
},
3031
"provide": {
3132
"codeigniter4/authentication-implementation": "1.0"
3233
},
3334
"suggest": {
34-
"ext-curl": "Required to use the password validation rule via PwnedValidator class."
35+
"ext-curl": "Required to use the password validation rule via PwnedValidator class.",
36+
"ext-openssl": "Required to use the JWT Authenticator."
3537
},
3638
"minimum-stability": "dev",
3739
"prefer-stable": true,

0 commit comments

Comments
 (0)