Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0-beta.6 Ready code #716

Merged
merged 160 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
16d140a
docs: add RELEASE.md
kenjis Mar 22, 2023
92b9359
docs: add about label lang
kenjis Mar 22, 2023
426fecf
docs: add about "Create a discussion for this release"
kenjis Mar 22, 2023
7d62c89
docs: indent git commands
kenjis Mar 22, 2023
86e9957
Language file for native portuguese language
mpmont Mar 23, 2023
993b7d0
unit testing for portuguese language
mpmont Mar 23, 2023
3e8ea21
coding standards fix on the AbstractTranslationTestCase class
mpmont Mar 23, 2023
e7fc185
coding standards fix on the AbstractTranslationTestCase class
mpmont Mar 23, 2023
c090835
docs: add note for permissions
kenjis Mar 23, 2023
917bade
Merge pull request #689 from mpmont/develop
datamweb Mar 24, 2023
d4b5e58
docs: replace command with function
kenjis Mar 25, 2023
da1666f
docs: add auth()->getProvider()
kenjis Mar 25, 2023
9e4f5c0
docs: remplace model('UserModel') with auth()->getProvider()
kenjis Mar 25, 2023
da6e3cc
docs: add comments in sample code
kenjis Mar 25, 2023
9d1f6ed
Merge pull request #692 from kenjis/docs-add-getProvider
kenjis Mar 25, 2023
afe8c9c
Update Auth.php
celiomarcos Mar 28, 2023
fe3bb3a
Update Auth.php
celiomarcos Mar 28, 2023
fabc9ae
cs-fix: removed withespace in blankline
celiomarcos Apr 6, 2023
333f273
cs-fix: trailing_comma_in_multiline line_ending
celiomarcos Apr 6, 2023
e45ecf7
Merge pull request #693 from celiomarcos/patch-1
datamweb Apr 7, 2023
a5096be
Merge pull request #687 from kenjis/docs-RELEASE.md
kenjis Apr 7, 2023
60105c7
fix: accept only valid data from POST
miguel-rn Apr 10, 2023
a96ccdf
fix: only validate data from POST request body
miguel-rn Apr 10, 2023
eed24a4
fix: only validate data from POST request body
miguel-rn Apr 10, 2023
799c647
Merge pull request #695 from miguel-rn/develop
datamweb Apr 10, 2023
75ec7e5
Update mobile_apps.md
miguel-rn Apr 10, 2023
9c7aacb
get credentials for login
sammyskills Apr 11, 2023
52126e4
Merge pull request #696 from miguel-rn/develop
datamweb Apr 11, 2023
613d62e
Merge remote-tracking branch 'upstream/develop' into mobile-docs
sammyskills Apr 11, 2023
daa0da5
add device_name to validation rules
sammyskills Apr 11, 2023
e6e6931
Merge pull request #698 from sammyskills/mobile-docs
kenjis Apr 13, 2023
2c8f488
docs: remove unneeded "of"
kenjis Apr 14, 2023
7091912
docs: update sample config file
kenjis Apr 14, 2023
281ea87
Merge pull request #700 from kenjis/fix-docs-install.md
kenjis Apr 14, 2023
541d399
fix: incorrect base class for exceptions
kenjis Apr 18, 2023
779bb12
Merge pull request #703 from kenjis/fix-exception-base-class
kenjis Apr 18, 2023
7716ee0
chore: add firebase/php-jwt
kenjis May 31, 2022
9ec8cc7
feat: add Authenticators\JWT
kenjis Jun 1, 2022
0c8bdc7
feat: add Filters\JWTAuth
kenjis Jun 1, 2022
7a95425
feat: remove `Bearer` in token at the first time
kenjis Jun 1, 2022
3ce9ed9
config: fix typo
kenjis Jun 2, 2022
62404b5
refactor: rename classname
kenjis Jun 2, 2022
adbc5e5
refactor: combine JWT interfaces into one
kenjis Jun 2, 2022
99f71d5
style: remove line breaks
kenjis Jun 2, 2022
62355e6
refactor: rename propery name
kenjis Jun 2, 2022
79b9be3
refactor: rename property names
kenjis Jun 2, 2022
55255cc
feat: add JWTGenerator::generate()
kenjis Jun 2, 2022
39c3cd4
feat: update logout() return type
kenjis Jun 3, 2022
f23f51f
feat: change JWTAdapterInterface::decode() signature
kenjis Jun 3, 2022
d0d52ed
fix: broken test
kenjis Jun 3, 2022
1bd81ca
feat: change Config\Auth::jwtConfig
kenjis Jun 3, 2022
1dd31e4
docs: remove @phpstan-ignore-line
kenjis Aug 31, 2022
dab58b6
fix: add logic to check if $request is IncomingRequest
kenjis Aug 31, 2022
ded0ae7
refactor: composer cs-fix
kenjis Aug 31, 2022
da7f887
fix: $userAgent type
kenjis Aug 31, 2022
965df73
refactor: run rector
kenjis Aug 31, 2022
02a17bf
refactor: create AuthJWT config file
kenjis Oct 21, 2022
7a8278c
refactor: change config array to class properties
kenjis Oct 21, 2022
61228d6
refactor: remove unneeded auth helper loading
kenjis Oct 21, 2022
adf04e3
feat: you can configure whether to record login attempts
kenjis Oct 21, 2022
9c3346c
refactor: move JWT authenticatorHeader setting to Config\AuthJWT
kenjis Oct 21, 2022
a98936e
chore: update php-jwt to ^6.4
kenjis Apr 13, 2023
58f5e79
docs: fix @return type
kenjis Apr 13, 2023
1257532
config: remove "aud" in $claims
kenjis Apr 14, 2023
5e3eb43
docs: add docs
kenjis Apr 14, 2023
2230319
docs: fix @param
kenjis Apr 14, 2023
0575a53
fix: when generating JWT, the real current time is not used for "iat"
kenjis Apr 14, 2023
a85374d
feat: change $claims to $defaultClaims, and all generated JWTs have t…
kenjis Apr 16, 2023
5b828d7
feat: change $secretKey to $keys and set $algorithm in them
kenjis Apr 16, 2023
3849c6f
refactor: use ::class in config()
kenjis Apr 16, 2023
ac23566
feat: change JWTGenerator::generate() signature
kenjis Apr 16, 2023
dde79d8
docs: add PHPDoc
kenjis Apr 16, 2023
a66123c
refactor: remove unused `use`
kenjis Apr 16, 2023
91b14ff
fix: JWTAdapterInterface APIs
kenjis Apr 16, 2023
a6e3ac7
feat: use multiple keys for docoding JWT
kenjis Apr 16, 2023
3d1b334
docs: remove out of dated comment
kenjis Apr 16, 2023
fce67b7
test: add test for specifiying key to decodeJWT()
kenjis Apr 16, 2023
c58ac36
test: fix incorrect tests
kenjis Apr 16, 2023
a37ef77
refactor: change JWTAdapterInterface method name
kenjis Apr 16, 2023
af50ece
docs: add @return
kenjis Apr 16, 2023
73a1d4d
feat: add parameters to JWTGenerator::generateAccessToken()
kenjis Apr 16, 2023
a93f254
docs: small fixes
kenjis Apr 16, 2023
c041d85
feat: support Asymmetric Key
kenjis Apr 16, 2023
f043dad
chore: add ext-openssl to suggest
kenjis Apr 16, 2023
6a8efe6
refactor: change folder structure
kenjis Apr 16, 2023
f71eaa0
refactor: rename $key to $keyset
kenjis Apr 17, 2023
340b144
refactor: rename JWT to JWS in classnames
kenjis Apr 17, 2023
cb1b227
refactor: move JWSGenerator up
kenjis Apr 17, 2023
0c9fc38
refactor: update peremeter/property name
kenjis Apr 17, 2023
79dbac2
refactor: rename JWSGenerator to JWTManager
kenjis Apr 17, 2023
b9fdc66
refactor: extract JWSEncoder class
kenjis Apr 17, 2023
d3cf816
feat: add JWSDecoder
kenjis Apr 17, 2023
7ab3021
feat: add JWTManager::decode()
kenjis Apr 17, 2023
07c346b
refactor: JWT uses JWTManager
kenjis Apr 17, 2023
fd080bf
test: extract method
kenjis Apr 17, 2023
15f11df
fix: add missing keyset argument
kenjis Apr 17, 2023
08dadcc
refactor: change JWTManager method names
kenjis Apr 17, 2023
9e85269
docs: fix doc comment
kenjis Apr 17, 2023
d2cfe31
docs: add "Signed"
kenjis Apr 17, 2023
3ba4dfd
docs: format the comments in the Config file
kenjis Apr 17, 2023
695b0e4
feat: add jwtmanager service and use it
kenjis Apr 17, 2023
f293a49
docs: add setup instruction
kenjis Apr 17, 2023
cb6f92b
fix: add missing argument for lang message
kenjis Apr 17, 2023
7b727af
docs: use service('jwtmanager')
kenjis Apr 17, 2023
cb35a17
fix: change private to protected for properties
kenjis Apr 17, 2023
e8c0e45
docs: change variable names
kenjis Apr 17, 2023
61f06fa
refactor: add comment for each exception
kenjis Apr 18, 2023
2dc1252
feat: improve Exception handling for FirebaseAdapter
kenjis Apr 18, 2023
399ab22
refactor: extract method
kenjis Apr 18, 2023
c9fd280
refactor: early return
kenjis Apr 18, 2023
58eb3dd
refactor: rename generateAccessToken() to generateToken()
kenjis Apr 18, 2023
e824303
refactor: change parameter order
kenjis Apr 18, 2023
2b4d959
docs: add explanation for JWT and terms
kenjis Apr 18, 2023
aa0147d
docs: fix coding style
kenjis Apr 18, 2023
ff1d04a
fix: missing try
kenjis Apr 18, 2023
cfb6263
fix: add missing try/catch
kenjis Apr 18, 2023
9004082
refactor: extract method
kenjis Apr 18, 2023
48f3a51
test: add test for encode
kenjis Apr 18, 2023
9179d8c
refactor: update variable name
kenjis Apr 18, 2023
1acb449
refactor: by rector
kenjis Apr 18, 2023
168aaef
docs: add sample login controller and filter settings
kenjis Apr 18, 2023
ce3e0d0
docs: add sample commands by curl
kenjis Apr 18, 2023
565e81c
refactor: remove `static` from JWSAdapterInterface.php
kenjis Apr 18, 2023
04d6645
refactor: use class constants for exception code
kenjis Apr 19, 2023
47546bb
test: update test method names
kenjis Apr 19, 2023
64b6f00
docs: improve explanation
kenjis Apr 19, 2023
2845356
docs: fix ambiguous descriptions
kenjis Apr 19, 2023
a3efa82
docs: split code block
kenjis Apr 20, 2023
4aa454c
docs: remove spaces at the end of lines
kenjis Apr 20, 2023
63a6fdf
docs: add declare(strict_types=1) to controller
kenjis Apr 20, 2023
37d8c71
docs: fix sample controller code
kenjis Apr 21, 2023
54ee18b
docs: add @TODO in sample code
kenjis Apr 21, 2023
6bf2eef
lang: add translations
kenjis Apr 21, 2023
3117c17
feat: do not login banned users
kenjis Apr 21, 2023
72047b7
docs: use JSON request
kenjis Apr 21, 2023
dcbdb28
config: comment out jwt authenticator
kenjis Apr 21, 2023
1b9fdf9
docs: add JWT in README
kenjis Apr 21, 2023
d1b6700
docs: change 422 to 401
kenjis Apr 21, 2023
392bd48
Merge pull request #195 from kenjis/feat-jwt
kenjis Apr 21, 2023
422e9f7
lang: Add pt-BR translation for JWT auth
robsonpiere Apr 21, 2023
20f8173
docs: remove command prompt $
kenjis Apr 22, 2023
370d6ae
docs: fix sample code to protect routes
kenjis Apr 22, 2023
7d407a7
Merge pull request #708 from kenjis/fix-docs-jwt.md
kenjis Apr 22, 2023
975b233
chore: add script to update en comments
kenjis Apr 22, 2023
4a4e40e
docs: update en comments
kenjis Apr 22, 2023
046c411
lang: translate JWT Exceptions
kenjis Apr 22, 2023
cc9305b
Merge pull request #706 from kenjis/fix-docs-mobile_apps-response-code
datamweb Apr 22, 2023
b5ada46
Merge pull request #707 from robsonpiere/update-pt-br
datamweb Apr 22, 2023
35fcaaa
Merge pull request #709 from kenjis/update-lang-ja
kenjis Apr 24, 2023
b77784f
lang: add ukrainian translation
datamweb Apr 26, 2023
ccec638
fix: add `errorPasswordTooLongBytes`
datamweb Apr 26, 2023
f237d10
fix: translate all string
datamweb Apr 26, 2023
ce68e9f
Merge pull request #713 from datamweb/add-uk-lang
datamweb Apr 26, 2023
6d5965d
docs: add description for user-level and group-level permissions
kenjis Apr 26, 2023
af2e960
Prep for 1.0.0-beta.6 release
kenjis Apr 26, 2023
a3788d4
docs: break long comments
kenjis Apr 26, 2023
9071cf1
docs: remove incomplete sentence
kenjis Apr 26, 2023
387f3b7
docs: add comment
kenjis Apr 26, 2023
94bbfe2
Merge pull request #714 from kenjis/docs-permissions
kenjis Apr 26, 2023
deff49b
Merge pull request #715 from kenjis/release-1.0.0-beta.6
kenjis Apr 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Loading
Loading