-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 188f970
Showing
65 changed files
with
10,561 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* text=auto eol=lf | ||
|
||
*.blade.php diff=html | ||
*.css diff=css | ||
*.html diff=html | ||
*.md diff=markdown | ||
*.php diff=php | ||
|
||
/.github export-ignore | ||
CHANGELOG.md export-ignore | ||
.styleci.yml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/.phpunit.cache | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.env.production | ||
.phpactor.json | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.fleet | ||
/.idea | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Progetto Laravel | ||
Questo è il README per il tuo progetto Laravel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use PHPOpenSourceSaver\JWTAuth\Facades\JWTAuth; | ||
use Illuminate\Support\Facades\Auth; | ||
use App\Http\Controllers\Controller; | ||
|
||
class AuthController extends Controller | ||
{ | ||
public function login(Request $request) | ||
{ | ||
$credentials = $request->only('user', 'password'); | ||
|
||
if (!$token = JWTAuth::attempt($credentials)) { | ||
return response()->json(['error' => 'invalid_credentials'], 401); | ||
} | ||
|
||
return response()->json(compact('token')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
abstract class Controller | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Http; | ||
|
||
class ProxyController extends Controller | ||
{ | ||
public function fetchFromApi(Request $request) | ||
{ | ||
$response = Http::withOptions([ | ||
'verify' => false, | ||
'allow_redirects' => false // Disable redirects for testing | ||
])->get('https://api.publicapis.org/entries'); | ||
|
||
// $response = Http::withOptions(['verify' => false])->get('https://jsonplaceholder.typicode.com/posts'); | ||
|
||
return response()->json($response->json()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Exception; | ||
use PHPOpenSourceSaver\JWTAuth\Facades\JWTAuth; | ||
use PHPOpenSourceSaver\JWTAuth\Http\Middleware\BaseMiddleware; | ||
|
||
class JwtMiddleware extends BaseMiddleware | ||
{ | ||
public function handle($request, Closure $next) | ||
{ | ||
try { | ||
$user = JWTAuth::parseToken()->authenticate(); | ||
} catch (Exception $e) { | ||
if ($e instanceof \PHPOpenSourceSaver\JWTAuth\Exceptions\TokenInvalidException) { | ||
return response()->json(['error' => 'Token is Invalid'], 401); | ||
} elseif ($e instanceof \PHPOpenSourceSaver\JWTAuth\Exceptions\TokenExpiredException) { | ||
return response()->json(['error' => 'Token is Expired'], 401); | ||
} else { | ||
return response()->json(['error' => 'Authorization Token not found'], 401); | ||
} | ||
} | ||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Foundation\Auth\User as Authenticatable; | ||
use Illuminate\Notifications\Notifiable; | ||
use PHPOpenSourceSaver\JWTAuth\Contracts\JWTSubject; | ||
|
||
class User extends Authenticatable implements JWTSubject | ||
{ | ||
use Notifiable; | ||
|
||
protected $fillable = [ | ||
'user', 'password', | ||
]; | ||
|
||
protected $hidden = [ | ||
'password', 'remember_token', | ||
]; | ||
|
||
public function getJWTIdentifier() | ||
{ | ||
return $this->getKey(); | ||
} | ||
|
||
public function getJWTCustomClaims() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class AppServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register any application services. | ||
*/ | ||
public function register(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Bootstrap any application services. | ||
*/ | ||
public function boot(): void | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Symfony\Component\Console\Input\ArgvInput; | ||
|
||
define('LARAVEL_START', microtime(true)); | ||
|
||
// Register the Composer autoloader... | ||
require __DIR__.'/vendor/autoload.php'; | ||
|
||
// Bootstrap Laravel and handle the command... | ||
$status = (require_once __DIR__.'/bootstrap/app.php') | ||
->handleCommand(new ArgvInput); | ||
|
||
exit($status); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use Illuminate\Foundation\Application; | ||
use Illuminate\Foundation\Configuration\Exceptions; | ||
use Illuminate\Foundation\Configuration\Middleware; | ||
|
||
return Application::configure(basePath: dirname(__DIR__)) | ||
->withRouting( | ||
web: __DIR__ . '/../routes/web.php', | ||
api: __DIR__ . '/../routes/api.php', | ||
commands: __DIR__ . '/../routes/console.php', | ||
health: '/up', | ||
) | ||
->withMiddleware(function (Middleware $middleware) { | ||
$middleware->alias([ | ||
'auth.jwt' => \PHPOpenSourceSaver\JWTAuth\Http\Middleware\Authenticate::class, | ||
]); | ||
}) | ||
->withExceptions(function (Exceptions $exceptions) { | ||
// | ||
})->create(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
App\Providers\AppServiceProvider::class, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "laravel/laravel", | ||
"type": "project", | ||
"description": "The skeleton application for the Laravel framework.", | ||
"keywords": ["laravel", "framework"], | ||
"license": "MIT", | ||
"require": { | ||
"php": "^8.2", | ||
"laravel/framework": "^11.9", | ||
"laravel/sanctum": "^4.0", | ||
"laravel/tinker": "^2.9", | ||
"php-open-source-saver/jwt-auth": "^2.3" | ||
}, | ||
"require-dev": { | ||
"fakerphp/faker": "^1.23", | ||
"laravel/pint": "^1.13", | ||
"laravel/sail": "^1.26", | ||
"mockery/mockery": "^1.6", | ||
"nunomaduro/collision": "^8.0", | ||
"phpunit/phpunit": "^11.0.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"App\\": "app/", | ||
"Database\\Factories\\": "database/factories/", | ||
"Database\\Seeders\\": "database/seeders/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"post-autoload-dump": [ | ||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", | ||
"@php artisan package:discover --ansi" | ||
], | ||
"post-update-cmd": [ | ||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force" | ||
], | ||
"post-root-package-install": [ | ||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" | ||
], | ||
"post-create-project-cmd": [ | ||
"@php artisan key:generate --ansi", | ||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", | ||
"@php artisan migrate --graceful --ansi" | ||
] | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"dont-discover": [] | ||
} | ||
}, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"preferred-install": "dist", | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true, | ||
"php-http/discovery": true | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"prefer-stable": true | ||
} |
Oops, something went wrong.