diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bf41b5f..b2c58e7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,16 +2,9 @@ Describe what you have changed in this PR and why. -### Tasks - -- [ ] Add a list of tasks here that need to done to implement the change -- [ ] All tasks must be checked before a (final) review is requested on the PR - ### Definition of Done -- [ ] Ensure feature branch has latest development code integrated - [ ] Ensure there are no formatting errors - - ⚠️ PR titles **AND** merge commit messages should adhere to the [Commitzen](https://github.com/commitizen/cz-cli) conventions, please ensure they are correctly formatted. - - For example `fields: Added rich text & feature image` +- [ ] Ensure feature branch has latest development code integrated +- [ ] Version number in `composer.json` is updated +- [ ] New entry added in `CHANGELOG.md` documenting changes made diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a87b74..638741f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,77 @@ -# Craft JWT Auth Changelog +# Changelog -All notable changes to this project will be documented in this file. +All notable changes to this project will be documented in this file, in reverse chronological order by release. -The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 0.1.2 - 2019-10-05 + +### Added + +- Additional instructions to the PR template + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Deleted some unneeded asset files + +- Cleaned up various files of unneeded cruft + +### Fixed + +- Nothing. ## 0.1.1 - 2019-10-04 +### Added + +- Nothing. + ### Changed - Changed the name of the package to edenspiekermann/craft-jwt-auth +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + ## 0.1.0 - 2019-10-04 ### Added - Initial release + - Validate incoming requests with a JWT present in the Authentication headers. + - Match a validated JWT to a user account in Craft CMS and login as that user. + - Optionally create a new account if no existing account can be found. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/composer.json b/composer.json index 2ee560c..06c6c5b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "edenspiekermann/craft-jwt-auth", "description": "Enable authentication to Craft through the use of JSON Web Tokens (JWT)", "type": "craft-plugin", - "version": "0.1.1", + "version": "0.1.2", "keywords": [ "craft", "cms", diff --git a/src/assetbundles/craftjwtauth/CraftJwtAuthAsset.php b/src/assetbundles/craftjwtauth/CraftJwtAuthAsset.php deleted file mode 100644 index 48a72ff..0000000 --- a/src/assetbundles/craftjwtauth/CraftJwtAuthAsset.php +++ /dev/null @@ -1,49 +0,0 @@ -sourcePath = "@edenspiekermann/craftjwtauth/assetbundles/craftjwtauth/dist"; - - $this->depends = [ - CpAsset::class, - ]; - - $this->js = [ - 'js/CraftJwtAuth.js', - ]; - - $this->css = [ - 'css/CraftJwtAuth.css', - ]; - - parent::init(); - } -} diff --git a/src/assetbundles/craftjwtauth/dist/css/CraftJwtAuth.css b/src/assetbundles/craftjwtauth/dist/css/CraftJwtAuth.css deleted file mode 100644 index a889c36..0000000 --- a/src/assetbundles/craftjwtauth/dist/css/CraftJwtAuth.css +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Craft JWT Auth plugin for Craft CMS - * - * Craft JWT Auth CSS - * - * @author Mike Pierce - * @copyright Copyright (c) 2019 Mike Pierce - * @link https://edenspiekermann.com - * @package CraftJwtAuth - * @since 0.1.0 - */ diff --git a/src/assetbundles/craftjwtauth/dist/img/CraftJwtAuth-icon.svg b/src/assetbundles/craftjwtauth/dist/img/CraftJwtAuth-icon.svg deleted file mode 100644 index 4f93bbd..0000000 --- a/src/assetbundles/craftjwtauth/dist/img/CraftJwtAuth-icon.svg +++ /dev/null @@ -1 +0,0 @@ -Group 2Created with Sketch. \ No newline at end of file diff --git a/src/assetbundles/craftjwtauth/dist/js/CraftJwtAuth.js b/src/assetbundles/craftjwtauth/dist/js/CraftJwtAuth.js deleted file mode 100644 index e9c140e..0000000 --- a/src/assetbundles/craftjwtauth/dist/js/CraftJwtAuth.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Craft JWT Auth plugin for Craft CMS - * - * Craft JWT Auth JS - * - * @author Mike Pierce - * @copyright Copyright (c) 2019 Mike Pierce - * @link https://edenspiekermann.com - * @package CraftJwtAuth - * @since 0.1.0 - */ diff --git a/src/config.php b/src/config.php index f9b0a68..df35e09 100644 --- a/src/config.php +++ b/src/config.php @@ -24,8 +24,11 @@ */ return [ + // TODO: Make these actually do something... - // This controls blah blah blah - "someAttribute" => true, + // Your secrete ket used for signing generated and verifying incoming JWTs + "secretKey" => '', + // Whether to automatically create a user for verified JWTs that don't match an account + "autoCreateUser" => true, ]; diff --git a/src/controllers/JWTController.php b/src/controllers/JWTController.php index 37b6bfb..284725d 100644 --- a/src/controllers/JWTController.php +++ b/src/controllers/JWTController.php @@ -11,9 +11,6 @@ namespace edenspiekermann\craftjwtauth\controllers; -use edenspiekermann\craftjwtauth\CraftJwtAuth; - -use Craft; use craft\web\Controller; /** @@ -32,7 +29,7 @@ class JWTController extends Controller * The actions must be in 'kebab-case' * @access protected */ - protected $allowAnonymous = ['index', 'do-something']; + protected $allowAnonymous = []; // Public Methods // ========================================================================= @@ -40,20 +37,11 @@ class JWTController extends Controller /** * @return mixed */ - public function actionIndex() - { - $result = 'Welcome to the JWTController actionIndex() method'; - - return $result; - } - - /** - * @return mixed - */ - public function actionDoSomething() - { - $result = 'Welcome to the JWTController actionDoSomething() method'; + // TODO: Add an action to generate a JWT for a specific or the logged in user. + // public function actionGenerate() + // { + // $result = 'Welcome to the JWTController actionGenerate() method'; - return $result; - } + // return $result; + // } } diff --git a/src/models/Settings.php b/src/models/Settings.php index abe53c9..009375b 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -11,9 +11,6 @@ namespace edenspiekermann\craftjwtauth\models; -use edenspiekermann\craftjwtauth\CraftJwtAuth; - -use Craft; use craft\base\Model; /** diff --git a/src/services/JWT.php b/src/services/JWT.php index 8cc3e75..d36443b 100644 --- a/src/services/JWT.php +++ b/src/services/JWT.php @@ -11,7 +11,6 @@ namespace edenspiekermann\craftjwtauth\services; -use Craft; use craft\base\Component; use craft\helpers\ArrayHelper; diff --git a/src/templates/settings.twig b/src/templates/settings.twig index 70e4687..423f385 100644 --- a/src/templates/settings.twig +++ b/src/templates/settings.twig @@ -15,8 +15,6 @@ {% import "_includes/forms" as forms %} -{% do view.registerAssetBundle("edenspiekermann\\craftjwtauth\\assetbundles\\craftjwtauth\\CraftJwtAuthAsset") %} - {{ forms.autosuggestField({ label: 'Secret Key', instructions: 'Enter your secret key for JWT token signing and verifying',