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

Dev master #2119

Open
wants to merge 94 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
00a5606
Refactor all the things
tymondesigns Mar 10, 2018
5ef16f3
fixes
tymondesigns Mar 15, 2018
bf885e3
php version
tymondesigns Mar 21, 2018
2af55a0
use some optionals
tymondesigns Mar 27, 2018
3e20aad
remove exp if not set
tymondesigns Mar 27, 2018
be8e897
remove 7.0
tymondesigns Mar 28, 2018
52efc6c
update hints
tymondesigns Jun 19, 2018
569500c
macroable
tymondesigns Jun 19, 2018
47e71fd
tweaks
tymondesigns Jun 19, 2018
96042f7
improvements
tymondesigns Sep 7, 2018
eb4e591
remove linter
tymondesigns Sep 8, 2018
fd97b07
Apply fixes from StyleCI (#1662)
tymondesigns Sep 8, 2018
be0b0f9
laravel 5.7
tymondesigns Sep 8, 2018
2123898
revert HO
tymondesigns Sep 8, 2018
d53ca4a
actually l5.4 and above
tymondesigns Sep 8, 2018
f215263
actually l5.4 and above
tymondesigns Sep 8, 2018
2f7d45d
add ability to get carbon and carbon interval instances
tymondesigns Sep 9, 2018
be03e7f
no need for constructor any more
tymondesigns Sep 11, 2018
9a8de68
:art:
tymondesigns Sep 21, 2018
e96aec3
Apply fixes from StyleCI (#1670)
tymondesigns Sep 21, 2018
c670e6a
cs and looser composer requirements
tymondesigns Sep 21, 2018
98785c1
add ability to provider custom claim validators and other bits of cle…
tymondesigns Oct 6, 2018
2a5935e
Apply fixes from StyleCI (#1683)
tymondesigns Oct 6, 2018
a4ab78c
pass value instead of claim
tymondesigns Oct 6, 2018
37be0d7
pass value instead of claim
tymondesigns Oct 6, 2018
6fb0342
fixes
tymondesigns Oct 7, 2018
8397aae
Apply fixes from StyleCI (#1686)
tymondesigns Oct 7, 2018
2421a17
convert to value object
tymondesigns Oct 8, 2018
dde6098
Apply fixes from StyleCI (#1689)
tymondesigns Oct 8, 2018
73a1105
swap to functions
tymondesigns Oct 11, 2018
96a69ae
Apply fixes from StyleCI (#1692)
tymondesigns Oct 11, 2018
ca0f4bb
remove version eye
tymondesigns Oct 11, 2018
417eb8d
rename to verify
tymondesigns Oct 11, 2018
b790865
Merge branch '2.0' of github.com:tymondesigns/jwt-auth into 2.0
tymondesigns Oct 11, 2018
d2d96e5
switch facade
tymondesigns Oct 11, 2018
d4dc398
improvements
tymondesigns Oct 15, 2018
a7e38ff
Apply fixes from StyleCI (#1696)
tymondesigns Oct 15, 2018
a959187
fix composer
tymondesigns Oct 15, 2018
6a7769a
use constants instead
tymondesigns Oct 17, 2018
67a11b4
Apply fixes from StyleCI (#1702)
tymondesigns Oct 21, 2018
a328e1d
use manager facade
tymondesigns Oct 21, 2018
cc5f79c
use constants everywhere
tymondesigns Oct 21, 2018
e7a7405
Apply fixes from StyleCI (#1703)
tymondesigns Oct 21, 2018
087ea90
use constants everywhere
tymondesigns Oct 21, 2018
87baba7
tweaks and improvements
tymondesigns Oct 21, 2018
90bf683
fixes
tymondesigns Oct 22, 2018
036db1b
cleanup
tymondesigns Oct 23, 2018
1876c40
fix tests
tymondesigns Oct 23, 2018
292c938
badges
tymondesigns Nov 20, 2018
43865f2
fix carbon issue
tymondesigns Nov 20, 2018
ed96a29
fixes
tymondesigns Nov 20, 2018
29cad6f
fixes
tymondesigns Nov 22, 2018
ce21451
Apply fixes from StyleCI (#1718)
tymondesigns Nov 22, 2018
5c96db8
fixes
tymondesigns Nov 22, 2018
fffdad2
lots of improvements
tymondesigns Feb 12, 2019
6da1589
Apply fixes from StyleCI (#1752)
tymondesigns Feb 12, 2019
45c5178
remove mkdocs
tymondesigns Feb 12, 2019
277db83
chore(composer): Bump some dependencies
tymondesigns Mar 20, 2019
0794da9
Apply fixes from StyleCI (#1778)
tymondesigns Mar 20, 2019
701044c
chore(composer): Upgrade phpunit
tymondesigns Mar 20, 2019
694313c
fixes
tymondesigns Mar 20, 2019
47d5ee5
refactor: subject hashing
tymondesigns Mar 20, 2019
128070c
Apply fixes from StyleCI (#1779)
tymondesigns Mar 20, 2019
cd75eac
chore: cherry-pick laravel 5.8 cache fix
tymondesigns Mar 4, 2019
719214b
Apply fixes from StyleCI (#1781)
tymondesigns Mar 22, 2019
d8f93a0
chore: cleanup composer
tymondesigns Mar 22, 2019
a8781f3
moving things around
tymondesigns Mar 22, 2019
bc39f5f
moving things around
tymondesigns Mar 22, 2019
1c23560
moving things around
tymondesigns Mar 22, 2019
9119165
Merge branch '2.0' of github.com:tymondesigns/jwt-auth into 2.0
tymondesigns Mar 22, 2019
27ee5ea
Apply fixes from StyleCI (#1782)
tymondesigns Mar 22, 2019
5ef1515
small adjustments
tymondesigns May 12, 2019
a7751aa
Apply fixes from StyleCI (#1807)
tymondesigns May 12, 2019
f12f049
Created events to dispatch in JWTGuard (#1813)
GabrielDeveloper Jul 9, 2019
280978d
Apply fixes from StyleCI (#1845)
tymondesigns Jul 9, 2019
4eb6576
docs
tymondesigns Jul 9, 2019
3efbf19
tweak validator
tymondesigns Sep 4, 2019
290885c
php 7.4
tymondesigns Jan 20, 2020
3f1bd34
merge
tymondesigns Jan 20, 2020
b4fb6dd
Apply fixes from StyleCI (#1924)
tymondesigns Jan 20, 2020
736bf05
ci(gh): Test githib actions
tymondesigns Jan 20, 2020
2fc4a75
fix
tymondesigns Jan 20, 2020
203c556
fix
tymondesigns Jan 20, 2020
225467b
fix
tymondesigns Jan 20, 2020
f6ee0f1
dummy
tymondesigns Jan 20, 2020
1b05498
only php 7.4 and L5.8
tymondesigns Jan 20, 2020
6a6e83c
check without 5.8
tymondesigns Jan 20, 2020
c04fd42
cleanup
tymondesigns Jan 20, 2020
52ac4e8
add coverage
tymondesigns Jan 20, 2020
0946fb4
remove prefer-lowest
tymondesigns Jan 21, 2020
60d5b37
whoops
tymondesigns Jan 21, 2020
0638081
fix windows
tymondesigns Mar 3, 2020
f6f0b32
chore(deps): Testing Laravel 7 support
tymondesigns Mar 3, 2020
ef5e60a
Update composer.json
yuriwf Apr 30, 2021
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
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
* text=auto

/tests export-ignore
/docs export-ignore
/.codecov.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/.github export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
44 changes: 44 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run tests

on:
push:

jobs:
php-tests:
runs-on: ${{ matrix.os }}

strategy:
matrix:
php: [7.4]
laravel: [6.*, 7.*]
os: [ubuntu-latest, windows-latest]
coverage: ['none', 'xdebug']

name: '[P${{ matrix.php }}] [L${{ matrix.laravel }}] [${{ matrix.os }}] [${{ matrix.coverage }}]'

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, gmp, exif, iconv, imagick
coverage: ${{ matrix.coverage }}

- name: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: composer test:ci

- name: Upload coverage
uses: codecov/codecov-action@v1
if: matrix.coverage == 'xdebug'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
yml: ./codecov.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
build
coverage.xml
/.phpunit.*
3 changes: 1 addition & 2 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ enabled:
- phpdoc_order
- phpdoc_separation
- unalign_double_arrow

linting: true
- php_unit_no_expectation_annotation
65 changes: 7 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,14 @@ env:

matrix:
include:
- php: hhvm-3.18
sudo: required
dist: trusty
env: LARAVEL='5.4.*' XDEBUG=1
group: edge
- php: 5.5.9
env: LARAVEL='5.1.*'
- php: 5.5.9
env: LARAVEL='5.2.*'
- php: 5.5
env: LARAVEL='5.1.*'
- php: 5.5
env: LARAVEL='5.2.*'
- php: 5.6
env: LARAVEL='5.1.*'
- php: 5.6
env: LARAVEL='5.2.*'
- php: 5.6
env: LARAVEL='5.3.*'
- php: 5.6
env: LARAVEL='5.4.*'
- php: 7.0
env: LARAVEL='5.1.*'
- php: 7.0
env: LARAVEL='5.2.*'
- php: 7.0
env: LARAVEL='5.3.*'
- php: 7.0
env: LARAVEL='5.4.*'
- php: 7.0
env: LARAVEL='5.5.*'
- php: 7.1
env: LARAVEL='5.1.*'
- php: 7.1
env: LARAVEL='5.2.*'
- php: 7.1
env: LARAVEL='5.3.*'
- php: 7.1
env: LARAVEL='5.4.*'
- php: 7.1
env: LARAVEL='5.5.*'
- php: 7.1
env: LARAVEL='5.6.*'
- php: 7.2
env: LARAVEL='5.1.*' XDEBUG=1
- php: 7.2
env: LARAVEL='5.2.*' XDEBUG=1
- php: 7.2
env: LARAVEL='5.3.*' XDEBUG=1
- php: 7.2
env: LARAVEL='5.4.*' XDEBUG=1
- php: 7.2
env: LARAVEL='5.5.*' XDEBUG=1
- php: 7.2
env: COVERAGE=1 LARAVEL='5.6.*' XDEBUG=1
- php: 7.4
env: LARAVEL='5.7.*' XDEBUG=1
- php: 7.4
env: LARAVEL='5.8.*' XDEBUG=1
- php: 7.4
env: COVERAGE=1 LARAVEL='6.*' XDEBUG=1
fast_finish: true


before_install:
- if [[ $XDEBUG = 0 ]]; then phpenv config-rm xdebug.ini; fi
- travis_retry composer self-update
Expand All @@ -82,8 +32,7 @@ install:
- travis_retry composer install --prefer-dist --no-interaction --no-suggest

script:
- if [[ $LARAVEL = '5.1.*' ]]; then composer test:ci -- --exclude-group laravel-5.2; fi
- if [[ $LARAVEL != '5.1.*' ]]; then composer test:ci; fi
- composer test:ci

after_success:
- if [[ $COVERAGE = 1 ]]; then bash <(curl -s https://codecov.io/bash); fi
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Sean Tymon
Copyright (c) Sean Tymon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
![jwt-auth-banner](https://cloud.githubusercontent.com/assets/1801923/9915273/119b9350-5cae-11e5-850b-c941cac60b32.png)

[![Build Status](http://img.shields.io/travis/tymondesigns/jwt-auth/master.svg?style=flat-square)](https://travis-ci.org/tymondesigns/jwt-auth)
[![Codecov branch](https://img.shields.io/codecov/c/github/tymondesigns/jwt-auth/develop.svg?style=flat-square)](https://codecov.io/github/tymondesigns/jwt-auth)
[![StyleCI](https://styleci.io/repos/23680678/shield?style=flat-square)](https://styleci.io/repos/23680678)
[![Latest Version](http://img.shields.io/packagist/v/tymon/jwt-auth.svg?style=flat-square)](https://packagist.org/packages/tymon/jwt-auth)
[![Latest Dev Version](https://img.shields.io/packagist/vpre/tymon/jwt-auth.svg?style=flat-square)](https://packagist.org/packages/tymon/jwt-auth#dev-develop)
[![Monthly Downloads](https://img.shields.io/packagist/dm/tymon/jwt-auth.svg?style=flat-square)](https://packagist.org/packages/tymon/jwt-auth)
[![Dependency Status](https://www.versioneye.com/php/tymon:jwt-auth/dev-develop/badge?style=flat-square)](https://www.versioneye.com/php/tymon:jwt-auth/dev-develop)
[![PHP-Eye](https://php-eye.com/badge/tymon/jwt-auth/tested.svg?style=flat-square)](https://php-eye.com/package/tymon/jwt-auth)
[![Build Status](http://img.shields.io/travis/tymondesigns/jwt-auth/master.svg?style=flat-square&logo=travis)](https://travis-ci.org/tymondesigns/jwt-auth)
[![Codecov branch](https://img.shields.io/codecov/c/github/tymondesigns/jwt-auth/develop.svg?style=flat-square&logo=codecov)](https://codecov.io/github/tymondesigns/jwt-auth)
[![StyleCI](https://styleci.io/repos/23680678/shield?style=flat-square&logo=styleci)](https://styleci.io/repos/23680678)
[![Latest Version](http://img.shields.io/packagist/v/tymon/jwt-auth.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/tymon/jwt-auth)
[![Latest Dev Version](https://img.shields.io/packagist/vpre/tymon/jwt-auth.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/tymon/jwt-auth#dev-develop)
[![Monthly Downloads](https://img.shields.io/packagist/dm/tymon/jwt-auth.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/tymon/jwt-auth)

## Documentation

Expand Down
40 changes: 24 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,32 @@
}
],
"require": {
"php": "^5.5.9 || ^7.0",
"illuminate/auth": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/contracts": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/http": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"php": "^7.4|^8.0.0",
"illuminate/contracts": "^6|^7",
"illuminate/http": "^6|^7",
"illuminate/support": "^6|^7",
"lcobucci/jwt": "^3.2",
"namshi/jose": "^7.0",
"nesbot/carbon": "^1.0"
"nesbot/carbon": "^2.0",
"web-token/jwt-checker": "^2.1",
"web-token/jwt-core": "^2.1",
"web-token/jwt-key-mgmt": "^2.1",
"web-token/jwt-signature": "^2.1",
"web-token/jwt-signature-algorithm-ecdsa": "^2.1",
"web-token/jwt-signature-algorithm-hmac": "^2.1",
"web-token/jwt-signature-algorithm-rsa": "^2.1"
},
"require-dev": {
"cartalyst/sentinel": "2.0.*",
"illuminate/console": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/database": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/routing": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"mockery/mockery": ">=0.9.9",
"phpunit/phpunit": "~4.8 || ~6.0"
"illuminate/auth": "^6|^7",
"illuminate/console": "^6|^7",
"illuminate/database": "^6|^7",
"illuminate/routing": "^6|^7",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^8.0"
},
"autoload": {
"files": [
"src/Support/helpers.php"
],
"psr-4": {
"Tymon\\JWTAuth\\": "src/"
}
Expand All @@ -52,12 +60,12 @@
},
"extra": {
"branch-alias": {
"dev-develop": "1.0-dev"
"2.0": "2.0-dev"
},
"laravel": {
"aliases": {
"JWTAuth": "Tymon\\JWTAuth\\Facades\\JWTAuth",
"JWTFactory": "Tymon\\JWTAuth\\Facades\\JWTFactory"
"JWTManager": "Tymon\\JWTAuth\\Facades\\JWTManager",
"JWTProvider": "Tymon\\JWTAuth\\Facades\\JWTProvider"
},
"providers": [
"Tymon\\JWTAuth\\Providers\\LaravelServiceProvider"
Expand Down
79 changes: 25 additions & 54 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/

use Tymon\JWTAuth\Claims;

return [

/*
Expand Down Expand Up @@ -91,7 +93,7 @@
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour.
| Defaults to 30 minutes.
|
| You can also set this to null, to yield a never expiring token.
| Some people may want this behaviour for e.g. a mobile app.
Expand All @@ -100,26 +102,21 @@
|
*/

'ttl' => env('JWT_TTL', 60),
'ttl' => env('JWT_TTL', 30),

/*
|--------------------------------------------------------------------------
| Refresh time to live
| Max refresh period
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token can be refreshed
| within. I.E. The user can refresh their token within a 2 week window of
| the original token being created until they must re-authenticate.
| Defaults to 2 weeks.
| Specify the length of time (in minutes) that the token will be
| refreshable for.
|
| You can also set this to null, to yield an infinite refresh time.
| Some may want this instead of never expiring tokens for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
| Defaults to null, which will allow tokens to be refreshable forever.
|
*/

'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
'max_refresh_period' => env('JWT_MAX_REFRESH_PERIOD'),

/*
|--------------------------------------------------------------------------
Expand All @@ -128,8 +125,11 @@
|
| Specify the hashing algorithm that will be used to sign the token.
|
| See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
| for possible values.
| Possible values:
|
| 'HS256', 'HS384', 'HS512',
| 'RS256', 'RS384', 'RS512',
| 'ES256', 'ES384', 'ES512'
|
*/

Expand All @@ -147,42 +147,24 @@
*/

'required_claims' => [
'iss',
'iat',
'exp',
'nbf',
'sub',
'jti',
],

/*
|--------------------------------------------------------------------------
| Persistent Claims
|--------------------------------------------------------------------------
|
| Specify the claim keys to be persisted when refreshing a token.
| `sub` and `iat` will automatically be persisted, in
| addition to the these claims.
|
| Note: If a claim does not exist then it will be ignored.
|
*/

'persistent_claims' => [
// 'foo',
// 'bar',
Claims\Issuer::NAME,
Claims\IssuedAt::NAME,
Claims\Expiration::NAME,
Claims\Subject::NAME,
Claims\JwtId::NAME,
],

/*
|--------------------------------------------------------------------------
| Lock Subject
|--------------------------------------------------------------------------
|
| This will determine whether a `prv` claim is automatically added to
| the token. The purpose of this is to ensure that if you have multiple
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
| should prevent one authentication request from impersonating another,
| if 2 tokens happen to have the same id across the 2 different models.
| This will determine whether a HashedSubject (hsu) claim is automatically
| added to the token. The purpose of this is to ensure that if you have
| multiple authentication models e.g. `App\User` & `App\OtherPerson`,
| then we should prevent one authentication request from impersonating
| another, if 2 tokens happen to have the same id across the 2 different
| models.
|
| Under specific circumstances, you may want to disable this behaviour
| e.g. if you only have one authentication model, then you would save
Expand Down Expand Up @@ -276,17 +258,6 @@

'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,

/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/

'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,

/*
|--------------------------------------------------------------------------
| Storage Provider
Expand Down
Empty file added docs/.nojekyll
Empty file.
11 changes: 11 additions & 0 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# jwt-auth

> JSON Web Token Authentication for Laravel & Lumen

- Simple and lightweight (~21kB gzipped)
- No statically built html files
- Multiple themes

[Get Started](laravel-installation.md)
[GitHub](https://github.com/tymondesigns/jwt-auth)

Loading