Skip to content

Commit

Permalink
Merge pull request #716 from codeigniter4/develop
Browse files Browse the repository at this point in the history
1.0.0-beta.6 Ready code
  • Loading branch information
kenjis committed Apr 26, 2023
2 parents 062d66b + deff49b commit b5fbc78
Show file tree
Hide file tree
Showing 53 changed files with 2,846 additions and 179 deletions.
15 changes: 12 additions & 3 deletions README.md
Expand Up @@ -15,20 +15,29 @@ The primary goals for Shield are:

## Authentication Methods

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

**Session-based**
It also provides **JSON Web Tokens** authentication.

### Session-based

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

**Personal Access Codes**
### Personal Access Codes

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

### JSON Web Tokens

JWT or JSON Web Token is a compact and self-contained way of securely transmitting
information between parties as a JSON object. It is commonly used for authentication
and authorization purposes in web applications.

## Some Important Features

* Session-based authentication (traditional email/password with remember me)
Expand Down
89 changes: 89 additions & 0 deletions admin/RELEASE.md
@@ -0,0 +1,89 @@
# Release Process

> Documentation guide based on the releases of `1.0.0-beta.5` on March 17, 2023.
>
> -kenjis
## Changelog

When generating the changelog each Pull Request to be included must have one of
the following [labels](https://github.com/codeigniter4/shield/labels):
- **bug** ... PRs that fix bugs
- **enhancement** ... PRs to improve existing functionalities
- **new feature** ... PRs for new features
- **refactor** ... PRs to refactor
- **lang** ... PRs for new/update language

PRs with breaking changes must have the following additional label:
- **breaking change** ... PRs that may break existing functionalities

### Check Generated Changelog

This process is checking only. Do not create a release.

To auto-generate, navigate to the
[Releases](https://github.com/codeigniter4/shield/releases) page,
click the "Draft a new release" button.

* Tag: "v1.0.0-beta.5" (Create new tag)
* Target: develop

Click the "Generate release notes" button.

Check the resulting content. If there are items in the *Others* section which
should be included in the changelog, add a label to the PR and regenerate
the changelog.

## Preparation

* Clone **codeigniter4/shield** and resolve any necessary PRs
```console
git clone git@github.com:codeigniter4/shield.git
```
* Merge any Security Advisory PRs in private forks

## Process

> **Note** Most changes that need noting in the User Guide and docs should have
> been included with their PR, so this process assumes you will not be
> generating much new content.

* Create a new branch `release-1.x.x`
* Update **src/Auth.php** with the new version number:
`const SHIELD_VERSION = '1.x.x';`
* Commit the changes with "Prep for 1.x.x release" and push to origin
* Create a new PR from `release-1.x.x` to `develop`:
* Title: "Prep for 1.x.x release"
* Description: "Updates version references for `1.x.x`." (plus checklist)
* Let all tests run, then review and merge the PR
* Create a new PR from `develop` to `master`:
* Title: "1.x.x Ready code"
* Description: blank
* Merge the PR
* Create a new Release:
* Version: "v1.x.x"
* Target: master
* Title: "v1.x.x"
* Click the "Generate release notes" button
* Remove "### Others (Only for checking. Remove this category)" section
* Check "Create a discussion for this release"
* Click the "Publish release" button
* Watch for the "docs" action and verify that the user guide updated:
* [docs](https://github.com/codeigniter4/shield/actions/workflows/docs.yml)
* Fast-forward `develop` branch to catch the merge commit from `master`
(note: pushing to develop is restricted to administrators):
```console
git fetch origin
git checkout develop
git merge origin/develop
git merge origin/master
git push origin HEAD # Only administrators can push to the protected branch.
```
* Publish any Security Advisories that were resolved from private forks
(note: publishing is restricted to administrators)
* Announce the release on the forums and Slack channel
(note: this forum is restricted to administrators):
* Make a new topic in the "News & Discussion" forums:
https://forum.codeigniter.com/forum-2.html
* The content is somewhat organic, but should include any major features and
changes as well as a link to the User Guide's changelog
107 changes: 107 additions & 0 deletions bin/update-en-comments
@@ -0,0 +1,107 @@
#!/usr/bin/env php
<?php declare(strict_types=1);

/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

require __DIR__ . '/../vendor/codeigniter4/framework/system/Test/bootstrap.php';

use CodeIgniter\CLI\CLI;

helper('filesystem');

if ($argc !== 2) {
CLI::error('Please specify a locale.');

exit(1);
}

$locale = $argv[1];

$langDir = realpath(__DIR__ . '/../src/Language/' . $locale);

if (! is_dir($langDir)) {
CLI::error('No such directory: "' . $langDir . '"');

exit(1);
}

$enDir = realpath(__DIR__ . '/../src/Language/en');

if (! is_dir($enDir)) {
CLI::error('No "Language/en" directory. Please run "composer update".');

exit(1);
}

$files = get_filenames(
$langDir,
true,
false,
false
);

$enFiles = get_filenames(
$enDir,
true,
false,
false
);

foreach ($enFiles as $enFile) {
$temp = $langDir . '/' . substr($enFile, strlen($enDir) + 1);
$langFile = realpath($temp) ?: $temp;

if (! is_file($langFile)) {
CLI::error('No such file: "' . $langFile . '"');

continue;
}

$enFileLines = file($enFile);

$items = [];

$pattern = '/(.*)\'([a-zA-Z0-9_]+?)\'(\s*=>\s*)([\'"].+[\'"]),/u';

foreach ($enFileLines as $line) {
if (preg_match($pattern, $line, $matches)) {
$items[] = [$matches[2] => $matches[4]];
}
}

$langFileLines = file($langFile);

$newLangFile = '';

$itemNo = 0;

foreach ($langFileLines as $line) {
// Remove en value comment.
if (preg_match('!(.*,)(\s*//.*)$!u', $line, $matches)) {
$line = $matches[1] . "\n";
}

if (preg_match($pattern, $line, $matches) === 0) {
$newLangFile .= $line;
} else {
$indent = $matches[1];
$key = $matches[2];
$arrow = $matches[3];
$value = $matches[4];

$newLangFile .= $indent . "'" . $key . "'" . $arrow . $value
. ', // ' . $items[$itemNo][array_key_first($items[$itemNo])] . "\n";
$itemNo++;
}
}

file_put_contents($langFile, $newLangFile);
CLI::write('Updated: ' . $langFile);
}
6 changes: 4 additions & 2 deletions composer.json
Expand Up @@ -25,13 +25,15 @@
"codeigniter4/devkit": "^1.0",
"codeigniter4/framework": "^4.2.7",
"mikey179/vfsstream": "^1.6.7",
"mockery/mockery": "^1.0"
"mockery/mockery": "^1.0",
"firebase/php-jwt": "^6.4"
},
"provide": {
"codeigniter4/authentication-implementation": "1.0"
},
"suggest": {
"ext-curl": "Required to use the password validation rule via PwnedValidator class."
"ext-curl": "Required to use the password validation rule via PwnedValidator class.",
"ext-openssl": "Required to use the JWT Authenticator."
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down

0 comments on commit b5fbc78

Please sign in to comment.