Compare commits
No commits in common. "master" and "ticket717" have entirely different histories.
214 changed files with 8674 additions and 10122 deletions
|
|
@ -42,9 +42,3 @@ MAILJET_APISECRET=
|
|||
MAILJET_SMSTOKEN=
|
||||
MAILJET_SMSENDPOINT=
|
||||
MAILJET_SMSFROM=
|
||||
|
||||
WEBHOOKS_GITLAB_NOTIFY=
|
||||
WEBHOOKS_GITLAB_TOKEN=
|
||||
|
||||
MEMCACHED_HOST=
|
||||
MEMCACHED_PORT=
|
||||
|
|
|
|||
16
.gitignore
vendored
16
.gitignore
vendored
|
|
@ -3,29 +3,17 @@
|
|||
/public/storage
|
||||
/public/css
|
||||
/public/js
|
||||
/public/images
|
||||
/public/fonts
|
||||
/public/medias
|
||||
/public/uploads
|
||||
/public/webfonts
|
||||
/public/assets
|
||||
/public/cache
|
||||
/public/mix-manifest.json
|
||||
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
|
||||
docker-compose.override.yml
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
|
||||
/public/.htpasswd
|
||||
/public/.htaccess
|
||||
|
||||
/resourcesLegacy
|
||||
.idea/
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
stages:
|
||||
- Security
|
||||
- CodingStandards
|
||||
|
||||
composer-security:
|
||||
stage: Security
|
||||
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
|
||||
script:
|
||||
- local-php-security-checker --format=json --path=./composer.lock > composer-security-checker-report.json
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'composer-security-checker'
|
||||
paths:
|
||||
- composer-security-checker-report.json
|
||||
allow_failure: true
|
||||
needs: []
|
||||
|
||||
npm-security:
|
||||
stage: Security
|
||||
image: node:17.9.1
|
||||
before_script:
|
||||
- npm install --location=global audit-ci@^6
|
||||
script:
|
||||
- audit-ci -p npm -o json > npm-security-checker-report.json
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'npm-security-checker'
|
||||
paths:
|
||||
- npm-security-checker-report.json
|
||||
allow_failure: true
|
||||
needs: []
|
||||
|
||||
phpcs:
|
||||
stage: CodingStandards
|
||||
image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0
|
||||
before_script:
|
||||
- composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
|
||||
- composer install
|
||||
cache:
|
||||
paths:
|
||||
- vendor/
|
||||
script:
|
||||
- vendor/bin/phpcs --report=junit --report-file=phpcs-report.xml
|
||||
artifacts:
|
||||
when: on_failure
|
||||
expose_as: 'phpcs'
|
||||
paths:
|
||||
- phpcs-report.xml
|
||||
reports:
|
||||
junit: phpcs-report.xml
|
||||
allow_failure: false
|
||||
needs:
|
||||
- composer-security
|
||||
- npm-security
|
||||
23
.vscode/settings.json
vendored
23
.vscode/settings.json
vendored
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#385567",
|
||||
"activityBar.activeBorder": "#b06e97",
|
||||
"activityBar.background": "#385567",
|
||||
"activityBar.foreground": "#e7e7e7",
|
||||
"activityBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBarBadge.background": "#b06e97",
|
||||
"activityBarBadge.foreground": "#15202b",
|
||||
"sash.hoverBorder": "#385567",
|
||||
"statusBar.background": "#263a46",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#385567",
|
||||
"statusBarItem.remoteBackground": "#263a46",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#263a46",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#263a4699",
|
||||
"titleBar.inactiveForeground": "#e7e7e799",
|
||||
"commandCenter.border": "#e7e7e799"
|
||||
},
|
||||
"peacock.remoteColor": "#263a46"
|
||||
}
|
||||
90
README.md
90
README.md
|
|
@ -1,12 +1,78 @@
|
|||
# LDC WEB
|
||||
## Installation
|
||||
```
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
```
|
||||
## Front
|
||||
```
|
||||
npm install && npm run prod
|
||||
```
|
||||
## Dependencies
|
||||
- Memcached
|
||||
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[British Software Development](https://www.britishsoftware.co)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- [UserInsights](https://userinsights.com)
|
||||
- [Fragrantica](https://www.fragrantica.com)
|
||||
- [SOFTonSOFA](https://softonsofa.com/)
|
||||
- [User10](https://user10.com)
|
||||
- [Soumettre.fr](https://soumettre.fr/)
|
||||
- [CodeBrisk](https://codebrisk.com)
|
||||
- [1Forge](https://1forge.com)
|
||||
- [TECPRESSO](https://tecpresso.co.jp/)
|
||||
- [Runtime Converter](http://runtimeconverter.com/)
|
||||
- [WebL'Agence](https://weblagence.com/)
|
||||
- [Invoice Ninja](https://www.invoiceninja.com)
|
||||
- [iMi digital](https://www.imi-digital.de/)
|
||||
- [Earthlink](https://www.earthlink.ro/)
|
||||
- [Steadfast Collective](https://steadfastcollective.com/)
|
||||
- [We Are The Robots Inc.](https://watr.mx/)
|
||||
- [Understand.io](https://www.understand.io/)
|
||||
- [Abdel Elrafa](https://abdelelrafa.com)
|
||||
- [Hyper Host](https://hyper.host)
|
||||
- [Appoly](https://www.appoly.co.uk)
|
||||
- [OP.GG](https://op.gg)
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
|
|
|||
|
|
@ -1,117 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
/**
|
||||
* Creates a new user
|
||||
*/
|
||||
class CreateAdmin extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'user:create';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a backend admin user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$email = $this->getInput(
|
||||
'Type the wanted user email',
|
||||
'email',
|
||||
'required|ends_with:@ldc.fr|unique:users,email|email:rfc,dns',
|
||||
'equipe.web@ldc.fr'
|
||||
);
|
||||
|
||||
$firstname = $this->getInput(
|
||||
'Type the wanted user firstname',
|
||||
'firstname',
|
||||
'required|min:5,max:255',
|
||||
'Saitama'
|
||||
);
|
||||
|
||||
$lastname = $this->getInput(
|
||||
'Type the wanted user lastname',
|
||||
'lastname',
|
||||
'required|min:5,max:255',
|
||||
'Hagemanto'
|
||||
);
|
||||
|
||||
$phone = $this->getInput(
|
||||
'Type the wanted user phone',
|
||||
'phone',
|
||||
'required|phone:FR|unique:users,phone|min:5,max:255'
|
||||
);
|
||||
|
||||
$password = null;
|
||||
while (
|
||||
($password = $this->secret(
|
||||
(!\is_null($password) ? 'Failed to confirm, ' : '') . 'Type the wanted user password'
|
||||
)) !== $this->secret('Confirm the password')
|
||||
) {
|
||||
continue;
|
||||
};
|
||||
|
||||
$admin = new User([
|
||||
'firstname' => $firstname,
|
||||
'lastname' => $lastname,
|
||||
'email' => $email,
|
||||
'phone' => $phone,
|
||||
'password' => $password,
|
||||
'equipe_web_member' => $this->confirm('Is the user an member of equipe web ?')
|
||||
]);
|
||||
$admin->saveOrFail();
|
||||
|
||||
$this->info('User created.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get User Input
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $inputName
|
||||
* @param string|array $rules
|
||||
* @param string|null $defaultValue
|
||||
* @return mixed
|
||||
*/
|
||||
private function getInput(string $message, string $inputName, $rules, ?string $defaultValue = null)
|
||||
{
|
||||
$out = null;
|
||||
while (is_null($out)) {
|
||||
try {
|
||||
$tmp = $this->ask($message, $defaultValue);
|
||||
$validator = Validator::make([$inputName => $tmp], [
|
||||
$inputName => $rules
|
||||
]);
|
||||
$validator->validate();
|
||||
$out = $tmp;
|
||||
} catch (ValidationException $e) {
|
||||
$this->error(sprintf(
|
||||
"'Please provide a valid $inputName %s'",
|
||||
\implode(',', collect($e->errors())->flatten()->all())
|
||||
));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\LDCNetwork;
|
||||
use App\Models\Project;
|
||||
use App\Models\Server;
|
||||
use App\Models\DatastorePcc;
|
||||
use App\Models\DomainNames;
|
||||
use App\Models\GitRepos;
|
||||
use App\Models\LDCNetworks;
|
||||
use App\Models\Projects;
|
||||
use App\Models\Servers;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ExportDatas extends Command
|
||||
|
|
@ -25,30 +27,50 @@ class ExportDatas extends Command
|
|||
*/
|
||||
protected $description = 'Export data in Excel format';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->exportProjects("EDL_WEB.csv");
|
||||
$this->exportServers("EDL_Servers.csv");
|
||||
$this->exportLdcNetworks("EDL_LDC_Networks.csv");
|
||||
$this->ExportProjects("EDL_WEB.csv");
|
||||
$this->ExportServers("EDL_Servers.csv");
|
||||
$this->ExportDatastorePcc("EDL_Datastore_pcc.csv");
|
||||
$this->ExportDomainNames("EDL_Domain_Names.csv");
|
||||
$this->ExportLdcNetworks("EDL_LDC_Networks.csv");
|
||||
$this->ExportGitRepos("EDL_GIT_Repos.csv");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export ldc networks as filename.csv
|
||||
*
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
private function exportLdcNetworks(string $filename)
|
||||
private function ExportGitRepos($filename)
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\LDCNetwork> */
|
||||
$networks = LDCNetwork::all();
|
||||
$repos = GitRepos::orderBy('name', 'ASC')->get();
|
||||
Storage::disk('export')->append($filename, "Nom");
|
||||
foreach ($repos as $repo) {
|
||||
$infos = [
|
||||
trim($repo->name),
|
||||
];
|
||||
|
||||
Storage::disk('export')->append($filename, implode(";", $infos));
|
||||
}
|
||||
}
|
||||
|
||||
private function ExportLdcNetworks($filename)
|
||||
{
|
||||
$networks = LDCNetworks::all();
|
||||
Storage::disk('export')->append($filename, "CIDR;First IP;Last IP");
|
||||
foreach ($networks as $network) {
|
||||
$infos = [
|
||||
|
|
@ -61,20 +83,44 @@ class ExportDatas extends Command
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export servers as filename.csv
|
||||
*
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
private function exportServers(string $filename)
|
||||
private function ExportDomainNames($filename)
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Server> */
|
||||
$servers = Server::orderBy('env', 'DESC')->get();
|
||||
Storage::disk('export')->append(
|
||||
$filename,
|
||||
"ENV;NOM;TITRE;FUNCTION;SSH;IP INFRAWEB;VIRTUAL IP;COMMENTAIRE"
|
||||
);
|
||||
$domains = DomainNames::all();
|
||||
Storage::disk('export')->append($filename, "ASCII;UTF-8;DATE D'EXPIRATION;RENOUVELLEMENT;MARQUE REF.;DNS REDIRIGES;TYPE CERTIFICATS;COMMENTAIRE");
|
||||
foreach ($domains as $domain) {
|
||||
$infos = [
|
||||
trim($domain->ascii_name),
|
||||
trim($domain->utf8_name),
|
||||
trim($domain->expiration_date),
|
||||
$domain->renew === 1 ? 'OUI' : 'NON',
|
||||
trim($domain->related_brand),
|
||||
trim($domain->redirect_dns),
|
||||
trim($domain->certificats),
|
||||
trim($domain->comment),
|
||||
];
|
||||
|
||||
Storage::disk('export')->append($filename, implode(";", $infos));
|
||||
}
|
||||
}
|
||||
|
||||
private function ExportDatastorePcc($filename)
|
||||
{
|
||||
$datastores = DatastorePcc::all();
|
||||
Storage::disk('export')->append($filename, "NOM;COMMENTAIRE");
|
||||
foreach ($datastores as $datastore) {
|
||||
$infos = [
|
||||
trim($datastore->title),
|
||||
trim($datastore->comment)
|
||||
];
|
||||
|
||||
Storage::disk('export')->append($filename, implode(";", $infos));
|
||||
}
|
||||
}
|
||||
|
||||
private function ExportServers($filename)
|
||||
{
|
||||
$servers = Servers::orderBy('env', 'DESC')->get();
|
||||
Storage::disk('export')->append($filename, "ENV;NOM;TITRE;FUNCTION;SSH;IP INFRAWEB;VIRTUAL IP;DATASTORE PCC;COMMENTAIRE");
|
||||
foreach ($servers as $server) {
|
||||
$infos = [
|
||||
trim($server->env),
|
||||
|
|
@ -84,6 +130,7 @@ class ExportDatas extends Command
|
|||
trim($server->ssh),
|
||||
trim($server->infraweb_ip),
|
||||
trim($server->virtual_ip),
|
||||
!is_null($server->datastore_pcc_id) ? trim(DatastorePcc::find($server->datastore_pcc_id)->title) : '',
|
||||
trim($server->comment)
|
||||
];
|
||||
|
||||
|
|
@ -91,17 +138,10 @@ class ExportDatas extends Command
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export projects as filename.csv
|
||||
*
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
private function exportProjects(string $filename)
|
||||
private function ExportProjects($filename)
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Project> */
|
||||
$projects = Project::orderBy('name', 'ASC')->get();
|
||||
$fields = [
|
||||
$projects = Projects::orderBy('name', 'ASC')->get();
|
||||
$fields = [
|
||||
'DEV',
|
||||
'name',
|
||||
'dev_haproxy_id',
|
||||
|
|
@ -123,34 +163,21 @@ class ExportDatas extends Command
|
|||
'dev_whitelist_fw',
|
||||
];
|
||||
|
||||
Storage::disk('export')->append(
|
||||
$filename,
|
||||
// phpcs:ignore
|
||||
"ENV;NOM;ID HAPROXY;URL;HTTPS;PHP;SERVEUR WEB;SSH;USER UNIX;PWD UNIX;DOCUMENT ROOT;SERVEUR BDD;SSH;USER DB;PWD DB;HTACCESS USER;HTACCESS PWD;COMMENTAIRE;FLUX EAI;WHITELIST FW"
|
||||
);
|
||||
Storage::disk('export')->append($filename, "ENV;NOM;ID HAPROXY;URL;HTTPS;PHP;SERVEUR WEB;SSH;USER UNIX;PWD UNIX;DOCUMENT ROOT;SERVEUR BDD;SSH;USER DB;PWD DB;HTACCESS USER;HTACCESS PWD;COMMENTAIRE;FLUX EAI;WHITELIST FW");
|
||||
$this->writeProjectExport($projects, $fields, $filename);
|
||||
|
||||
$prod = implode(";", $fields);
|
||||
$prod = str_replace("dev", "prod", $prod);
|
||||
$prod = str_replace("DEV", "PROD", $prod);
|
||||
$prod = str_replace("prod_htaccess_user", "BLANK", $prod);
|
||||
$prod = str_replace("prod_htaccess_pwd", "BLANK", $prod);
|
||||
$prod = implode(";", $fields);
|
||||
$prod = str_replace("dev", "prod", $prod);
|
||||
$prod = str_replace("DEV", "PROD", $prod);
|
||||
$prod = str_replace("prod_htaccess_user", "BLANK", $prod);
|
||||
$prod = str_replace("prod_htaccess_pwd", "BLANK", $prod);
|
||||
$fields = explode(";", $prod);
|
||||
|
||||
$this->writeProjectExport($projects, $fields, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Project to filename.csv
|
||||
*
|
||||
* @param Collection $projects
|
||||
* @param string[] $fields
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
private function writeProjectExport(Collection $projects, array $fields, string $filename)
|
||||
private function writeProjectExport($projects, $fields, $filename)
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Project> $projects */
|
||||
foreach ($projects as $project) {
|
||||
$infos = [];
|
||||
foreach ($fields as $field) {
|
||||
|
|
@ -160,13 +187,13 @@ class ExportDatas extends Command
|
|||
$infos[] = $field;
|
||||
break;
|
||||
case 'https':
|
||||
$infos[] = $project->{$field} === 1 ? 'OUI' : 'NON';
|
||||
$infos[] = $project->{$field} === 1 ? 'OUI' : 'NON';
|
||||
break;
|
||||
case 'dev_web_server_id':
|
||||
case 'dev_db_server_id':
|
||||
case 'prod_web_server_id':
|
||||
case 'prod_db_server_id':
|
||||
$server = Server::find($project->{$field});
|
||||
$server = Servers::find($project->{$field});
|
||||
$infos[] = trim($server->name);
|
||||
$infos[] = trim($server->ssh);
|
||||
break;
|
||||
|
|
@ -175,9 +202,9 @@ class ExportDatas extends Command
|
|||
break;
|
||||
default:
|
||||
$infos[] = trim($project->{$field});
|
||||
}//end switch
|
||||
}//end foreach
|
||||
}
|
||||
}
|
||||
Storage::disk('export')->append($filename, implode(";", $infos));
|
||||
}//end foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,25 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +35,7 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* SMTP Types
|
||||
*
|
||||
* @method static self DEV()
|
||||
* @method static self PROD()
|
||||
*/
|
||||
final class Environment extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'DEV' => 0,
|
||||
'PROD' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
'DEV' => 'Developpement',
|
||||
'PROD' => 'Production'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* Servers Different Types
|
||||
*
|
||||
* @method static self v5_6()
|
||||
* @method static self v7_3()
|
||||
* @method static self v7_4()
|
||||
* @method static self v8()
|
||||
* @method static self v8_1()
|
||||
*/
|
||||
final class PhpVersion extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'v5_6' => 0,
|
||||
'v7_3' => 1,
|
||||
'v7_4' => 2,
|
||||
'v8' => 3,
|
||||
'v8_1' => 4
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
'v5_6' => 'PHP 5.6',
|
||||
'v7_3' => 'PHP 7.3',
|
||||
'v7_4' => 'PHP 7.4',
|
||||
'v8' => 'PHP 8',
|
||||
'v8_1' => 'PHP 8.1'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -12,13 +12,8 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
* @method static self laravel() Laravel
|
||||
* @method static self symfony() Symfony
|
||||
*/
|
||||
final class ProjectType extends BaseEnumRoutable
|
||||
final class ProjectTypes extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -29,11 +24,6 @@ final class ProjectType extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* Servers Different Types
|
||||
*
|
||||
* @method static self DB()
|
||||
* @method static self WEB()
|
||||
* @method static self ELASTIC()
|
||||
*/
|
||||
final class ServerType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'DB' => 0,
|
||||
'WEB' => 1,
|
||||
'ELASTIC' => 2
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
'DB' => trans('Base de données'),
|
||||
'WEB' => trans('WEB'),
|
||||
'ELASTIC' => trans('Eslatic Search')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -11,13 +11,8 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
* @method static self mailjet() Mailjet Relay
|
||||
* @method static self sendinblue() Sendinblue Relay
|
||||
*/
|
||||
final class SmtpEnum extends BaseEnumRoutable
|
||||
final class Smtp extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -27,11 +22,6 @@ final class SmtpEnum extends BaseEnumRoutable
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -2,37 +2,55 @@
|
|||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
||||
use Throwable;
|
||||
use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [];
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function register()
|
||||
public function report(Throwable $e)
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
});
|
||||
parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,20 +3,20 @@
|
|||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LDCNetwork;
|
||||
use App\Models\LDCNetworks;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LDCNetworksController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api LDC Networks
|
||||
*
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
public function index(Request $request) {
|
||||
$token = $request->token;
|
||||
|
||||
if ($token !== 'CE8S52Qq7stf5k8frF4T')
|
||||
return response('Unauthorized', 401);
|
||||
|
||||
$ips = [];
|
||||
|
||||
$networks = LDCNetwork::all();
|
||||
$networks = LDCNetworks::all();
|
||||
foreach ($networks as $network) {
|
||||
$infos = explode('.', $network->first_ip);
|
||||
$min = $infos[3];
|
||||
|
|
|
|||
|
|
@ -3,25 +3,44 @@
|
|||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Api\UpdateProjectStatusRequest;
|
||||
use App\Models\ProjectStatusChecker;
|
||||
use App\Models\Projects;
|
||||
use App\Models\ProjectsStatusChecker;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class StatusCheckerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param \App\Http\Requests\Api\UpdateProjectStatusRequest $request
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory
|
||||
*/
|
||||
public function index(UpdateProjectStatusRequest $request)
|
||||
{
|
||||
/** @var \App\Models\ProjectStatusChecker */
|
||||
$project_sc = ProjectStatusChecker::where('project_uuid', '=', $request->project_uuid)
|
||||
->firstOrNew();
|
||||
public function index(Request $request) {
|
||||
$token = $request->token;
|
||||
$datas = $request->datas;
|
||||
|
||||
$project_sc->fill($request->validated());
|
||||
$project_sc->last_call = \now();
|
||||
return $project_sc->save() ? response('OK') : response('KO');
|
||||
if ($token !== 'CE8S52Qq7stf5k8frF4T')
|
||||
return response('Unauthorized', 401);
|
||||
|
||||
$oDatas = json_decode($datas);
|
||||
|
||||
$app_uuid = $oDatas->uuid;
|
||||
$sitemap = $oDatas->sitemap;
|
||||
$robots = $oDatas->robots;
|
||||
$code = json_encode($oDatas->code);
|
||||
$logs = $oDatas->logs;
|
||||
|
||||
$project_sc = ProjectsStatusChecker::where('project_uuid', '=', $app_uuid)->first();
|
||||
if (!$project_sc) {
|
||||
$project = Projects::where('uuid', '=', $app_uuid)->first();
|
||||
if (!$project)
|
||||
return response('Unknown', 404);
|
||||
$project_sc = new ProjectsStatusChecker();
|
||||
$project_sc->project_uuid = $app_uuid;
|
||||
}
|
||||
|
||||
$project_sc->code = $code;
|
||||
$project_sc->sitemap = $sitemap;
|
||||
$project_sc->robots = $robots;
|
||||
$project_sc->logs = $logs;
|
||||
$project_sc->updated_at = NOW();
|
||||
$project_sc->save();
|
||||
|
||||
return response('OK');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,5 @@ use Illuminate\Routing\Controller as BaseController;
|
|||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
|
|||
80
app/Http/Controllers/DatastorePCCController.php
Normal file
80
app/Http/Controllers/DatastorePCCController.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DatastorePcc;
|
||||
use App\Models\Servers;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class DatastorePCCController extends Controller
|
||||
{
|
||||
public function index(Request $request) {
|
||||
$dpccs = DatastorePcc::all();
|
||||
return view('dpccs.index', ['dpccs' => $dpccs]);
|
||||
}
|
||||
|
||||
public function add(Request $request) {
|
||||
return view('dpccs.add');
|
||||
}
|
||||
|
||||
public function edit(Request $request) {
|
||||
$dpcc_id = $request->id;
|
||||
$dpcc = DatastorePcc::findOrFail($dpcc_id);
|
||||
return view('dpccs.edit', ['dpcc' => $dpcc]);
|
||||
}
|
||||
|
||||
public function update(Request $request) {
|
||||
$dpcc_id = $request->id;
|
||||
$dpcc = DatastorePcc::findOrFail($dpcc_id);
|
||||
$this->makeChanges($request, $dpcc);
|
||||
return redirect()->route('dpccs.edit', ['id' => $dpcc->id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
$dpcc = new DatastorePcc();
|
||||
$this->makeChanges($request, $dpcc);
|
||||
return redirect()->route('dpccs.edit', ['id' => $dpcc->id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function delete(Request $request) {
|
||||
$dpcc_id = $request->id;
|
||||
$dpcc = DatastorePcc::findOrFail($dpcc_id);
|
||||
|
||||
$isUsed = Servers::where('datastore_pcc_id', '=', $dpcc->id)->get();
|
||||
if ($isUsed->count() === 0)
|
||||
$isUsed = false;
|
||||
|
||||
return view('dpccs.delete', ['dpcc' => $dpcc, 'isUsed' => $isUsed]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$dpcc_id = $request->id;
|
||||
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$dpcc = DatastorePcc::findOrFail($dpcc_id);
|
||||
$dpcc->delete();
|
||||
return redirect()->route('dpccs.index')->with('status', 'Datastore PCC supprimé !');
|
||||
}else{
|
||||
return redirect()->route('dpccs.edit', ['id' => $dpcc_id])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
}
|
||||
|
||||
private function makeChanges($request, $dpcc) {
|
||||
$title = $request->title;
|
||||
$comment = $request->comment;
|
||||
|
||||
$dpcc->title = $title;
|
||||
$dpcc->comment = $comment;
|
||||
$dpcc->save();
|
||||
}
|
||||
}
|
||||
98
app/Http/Controllers/DomainNamesController.php
Normal file
98
app/Http/Controllers/DomainNamesController.php
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DomainNames;
|
||||
use App\Models\EmailAddresses;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class DomainNamesController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$dms = DomainNames::all();
|
||||
return view('domain-names.index', ['dms' => $dms]);
|
||||
}
|
||||
|
||||
public function add(Request $request)
|
||||
{
|
||||
return view('domain-names.add');
|
||||
}
|
||||
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$dm_id = $request->id;
|
||||
$dm = DomainNames::findOrFail($dm_id);
|
||||
return view('domain-names.edit', ['dm' => $dm]);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$dm_id = $request->id;
|
||||
$dm = DomainNames::findOrFail($dm_id);
|
||||
$this->makeChanges($request, $dm);
|
||||
return redirect()->route('domain-names.edit', ['id' => $dm->id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$dm = new DomainNames();
|
||||
$this->makeChanges($request, $dm);
|
||||
return redirect()->route('domain-names.edit', ['id' => $dm->id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$dm_id = $request->id;
|
||||
$dm = DomainNames::findOrFail($dm_id);
|
||||
|
||||
$isUsed = EmailAddresses::where('domain_name_id', '=', $dm->id)->get();
|
||||
if ($isUsed->count() === 0)
|
||||
$isUsed = false;
|
||||
|
||||
return view('domain-names.delete', ['dm' => $dm, 'isUsed' => $isUsed]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$dm_id = $request->id;
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$dm = DomainNames::findOrFail($dm_id);
|
||||
$dm->delete();
|
||||
return redirect()->route('domain-names.index')->with('status', 'Nom de domaine supprimé !');
|
||||
} else {
|
||||
return redirect()->route('domain-names.edit', ['id' => $dm_id])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
}
|
||||
|
||||
private function makeChanges($request, $dm)
|
||||
{
|
||||
$ascii_name = $request->ascii_name;
|
||||
$utf8_name = $request->utf8_name;
|
||||
$exp_date = $request->expiration_date;
|
||||
$renew = $request->renew;
|
||||
$related_brand = $request->related_brand;
|
||||
$redirect_dns = $request->redirect_dns;
|
||||
$certificats = $request->certificats;
|
||||
$comment = $request->comment;
|
||||
|
||||
$dm->ascii_name = $ascii_name;
|
||||
$dm->utf8_name = $utf8_name;
|
||||
$dm->expiration_date = $exp_date;
|
||||
$dm->renew = $renew;
|
||||
$dm->related_brand = $related_brand;
|
||||
$dm->redirect_dns = $redirect_dns;
|
||||
$dm->certificats = $certificats;
|
||||
$dm->comment = $comment;
|
||||
$dm->save();
|
||||
}
|
||||
}
|
||||
78
app/Http/Controllers/EmailAddressesController.php
Normal file
78
app/Http/Controllers/EmailAddressesController.php
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DomainNames;
|
||||
use App\Models\EmailAddresses;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class EmailAddressesController extends Controller
|
||||
{
|
||||
public function index(Request $request) {
|
||||
$emails = EmailAddresses::all();
|
||||
return view('email-addresses.index', ['emails' => $emails]);
|
||||
}
|
||||
|
||||
public function add(Request $request) {
|
||||
$dms = DomainNames::orderBy('utf8_name')->get();
|
||||
return view('email-addresses.add', ['dms' => $dms]);
|
||||
}
|
||||
|
||||
public function edit(Request $request) {
|
||||
$email_id = $request->id;
|
||||
$email = EmailAddresses::findOrFail($email_id);
|
||||
$dms = DomainNames::orderBy('utf8_name')->get();
|
||||
return view('email-addresses.edit', ['email' => $email, 'dms' => $dms]);
|
||||
}
|
||||
|
||||
public function update(Request $request) {
|
||||
$email_id = $request->id;
|
||||
$email = EmailAddresses::findOrFail($email_id);
|
||||
$this->makeChanges($request, $email);
|
||||
return redirect()->route('email-addresses.edit', ['id' => $email->id])->with('status', 'Sauvegardée !');
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
$email = new EmailAddresses();
|
||||
$this->makeChanges($request, $email);
|
||||
return redirect()->route('email-addresses.edit', ['id' => $email->id])->with('status', 'Sauvegardée !');
|
||||
}
|
||||
|
||||
public function delete(Request $request) {
|
||||
$email_id = $request->id;
|
||||
$email = EmailAddresses::findOrFail($email_id);
|
||||
return view('email-addresses.delete', ['email' => $email]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$email_id = $request->id;
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$email = EmailAddresses::findOrFail($email_id);
|
||||
$email->delete();
|
||||
return redirect()->route('email-addresses.index')->with('status', 'Adresse email supprimée !');
|
||||
}else{
|
||||
return redirect()->route('email-addresses.edit', ['id' => $email_id])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
}
|
||||
|
||||
private function makeChanges($request, $email) {
|
||||
$account = $request->account;
|
||||
$password = $request->password;
|
||||
$domain_name_id = $request->d_n_id;
|
||||
|
||||
$email->account = $account;
|
||||
$email->password = $password;
|
||||
$email->domain_name_id = $domain_name_id;
|
||||
$email->save();
|
||||
}
|
||||
}
|
||||
97
app/Http/Controllers/GitReposController.php
Normal file
97
app/Http/Controllers/GitReposController.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\GitReposStoreRequest;
|
||||
use App\Http\Requests\GitReposUpdateRequest;
|
||||
use App\Models\GitRepos;
|
||||
|
||||
class GitReposController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$repos = GitRepos::all();
|
||||
return view('git-repos.index', compact('repos'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('git-repos.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\GitReposStoreRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(GitReposStoreRequest $request)
|
||||
{
|
||||
$datas = $request->validated();
|
||||
$git_repo = new GitRepos();
|
||||
$git_repo->fill($datas);
|
||||
$git_repo->save();
|
||||
|
||||
return redirect()->route('git-repos.edit', ['git_repo' => $git_repo])->with('status', __('Dépôt Git créé.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
abort('404');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param GitRepos $git_repo
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(GitRepos $git_repo)
|
||||
{
|
||||
return view('git-repos.edit', compact('git_repo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\GitReposUpdateRequest $request
|
||||
* @param GitRepos $git_repo
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(GitReposUpdateRequest $request, GitRepos $git_repo)
|
||||
{
|
||||
$datas = $request->validated();
|
||||
$git_repo->fill($datas);
|
||||
$git_repo->save();
|
||||
|
||||
return redirect()->route('git-repos.edit', ['git_repo' => $git_repo])->with('status', __('Dépôt Git mis à jour.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param GitRepos $git_repo
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(GitRepos $git_repo)
|
||||
{
|
||||
$git_repo->delete();
|
||||
return redirect()->route('git-repos.index')->with('status', __('Dépôt Git supprimé.'));
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\{Base32,Totp};
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
|
||||
class HomeController extends Controller
|
||||
|
|
@ -12,26 +14,19 @@ class HomeController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
// $secret = Totp::GenerateSecret(16);
|
||||
// Display new key to user so they can enter it in Google Authenticator or Authy
|
||||
// echo strtoupper(Base32::encode($secret));exit;
|
||||
//$secret = Totp::GenerateSecret(16);
|
||||
# Display new key to user so they can enter it in Google Authenticator or Authy
|
||||
//echo strtoupper(Base32::encode($secret));exit;
|
||||
// otpauth://totp/LDC%20WEB:mail@ldc.fr?secret=secret&issuer=LDC%20WEB
|
||||
return view('home');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate QR code
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function qr()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$qrcode = QrCode::size(200)->generate(
|
||||
"otpauth://totp/LDC%20WEB:$user->email?secret=$user->totp_secret&issuer=LDC%20WEB"
|
||||
);
|
||||
$user = Auth::user();
|
||||
$qrcode = QrCode::size(200)->generate("otpauth://totp/LDC%20WEB:".$user->email."?secret=".$user->totp_secret."&issuer=LDC%20WEB");
|
||||
return view("qrcode", compact('qrcode'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,107 +2,82 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\LDCNetworks\StoreLDCNetwork;
|
||||
use App\Http\Requests\LDCNetworks\UpdateLDCNetwork;
|
||||
use App\Http\Requests\ValidateOtpRequest;
|
||||
use App\Models\LDCNetwork;
|
||||
use App\Models\LDCNetworks;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class LDCNetworkController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$ldc_networks = LDCNetwork::all();
|
||||
return view('ldc-networks.index', compact('ldc_networks'));
|
||||
public function index(Request $request) {
|
||||
$networks = LDCNetworks::all();
|
||||
return view('ldc-networks.index', ['networks' => $networks]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('ldc-networks.create');
|
||||
public function add(Request $request) {
|
||||
return view('ldc-networks.add');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\LDCNetworks\StoreLDCNetwork $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreLDCNetwork $request)
|
||||
public function edit(Request $request) {
|
||||
$network_id = $request->id;
|
||||
$network = LDCNetworks::findOrFail($network_id);
|
||||
return view('ldc-networks.edit', ['network' => $network]);
|
||||
}
|
||||
|
||||
public function update(Request $request) {
|
||||
$network_id = $request->id;
|
||||
$network = LDCNetworks::findOrFail($network_id);
|
||||
$this->makeChanges($request, $network);
|
||||
return redirect()->route('ldc-networks.edit', ['id' => $network->id])->with('status', 'Sauvegardée !');
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
$network = new LDCNetworks();
|
||||
$this->makeChanges($request, $network);
|
||||
return redirect()->route('ldc-networks.edit', ['id' => $network->id])->with('status', 'Sauvegardée !');
|
||||
}
|
||||
|
||||
public function delete(Request $request) {
|
||||
$network_id = $request->id;
|
||||
$network = LDCNetworks::findOrFail($network_id);
|
||||
|
||||
return view('ldc-networks.delete', ['network' => $network]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$ldc_network = new LDCNetwork();
|
||||
$ldc_network->fill($request->validated());
|
||||
if ($ldc_network->saveOrFail()) {
|
||||
return redirect()->route('ldc-networks.edit', compact('ldc_network'))
|
||||
->with('success', trans('LDC Network créé.'));
|
||||
$network_id = $request->id;
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$network = LDCNetworks::findOrFail($network_id);
|
||||
$network->delete();
|
||||
return redirect()->route('ldc-networks.index')->with('status', 'IP supprimée !');
|
||||
}else{
|
||||
return redirect()->route('ldc-networks.edit', ['id' => $network_id])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\LDCNetwork $ldc_network
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(LDCNetwork $ldc_network)
|
||||
{
|
||||
return view('ldc-networks.edit', ['ldc_network' => $ldc_network]);
|
||||
private function makeChanges($request, $network) {
|
||||
$cidr = $request->cidr;
|
||||
$range = $this->cidrToRange($cidr);
|
||||
|
||||
$network->cidr = $cidr;
|
||||
$network->first_ip = $range[0];
|
||||
$network->last_ip = $range[1];
|
||||
$network->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\LDCNetworks\UpdateLDCNetwork $request
|
||||
* @param \App\Models\LDCNetwork $ldc_network
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateLDCNetwork $request, LDCNetwork $ldc_network)
|
||||
{
|
||||
$ldc_network->fill($request->validated());
|
||||
if ($ldc_network->saveOrFail()) {
|
||||
return redirect()->route('ldc-networks.edit', compact('ldc_network'))
|
||||
->with('success', trans('LDC Network mis à jour.'));
|
||||
}
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\LDCNetwork $ldc_network
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(LDCNetwork $ldc_network)
|
||||
{
|
||||
return view('ldc-networks.delete', ['ldc_network' => $ldc_network]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ValidateOtpRequest $request
|
||||
* @param \App\Models\LDCNetwork $ldc_network
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function destroySubmit(ValidateOtpRequest $request, LDCNetwork $ldc_network)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($ldc_network->deleteOrFail()) {
|
||||
return redirect()->route('ldc-networks.index')
|
||||
->with('warning', 'LDC Network supprimé !');
|
||||
}
|
||||
|
||||
return back();
|
||||
private function cidrToRange($cidr) {
|
||||
$range = array();
|
||||
$cidr = explode('/', $cidr);
|
||||
$range[0] = long2ip((ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1]))));
|
||||
$range[1] = long2ip((ip2long($range[0])) + pow(2, (32 - (int)$cidr[1])) - 1);
|
||||
return $range;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,79 +2,63 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ValidateOtpRequest;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use lfkeitel\phptotp\{Base32,Totp};
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class OTPController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show verifiy otp page
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function verify()
|
||||
{
|
||||
public function verify(Request $request) {
|
||||
$user = session()->get('tmpUserOTP');
|
||||
if (!$user) {
|
||||
if (!$user)
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
return view('auth.verify');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check OPT request
|
||||
*
|
||||
* @param ValidateOtpRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
public function check(ValidateOtpRequest $request)
|
||||
{
|
||||
//phpcs:enable
|
||||
Auth::login(session()->get('tmpUserOTP'));
|
||||
return \response()->redirectTo(RouteServiceProvider::HOME);
|
||||
public function check(Request $request) {
|
||||
$otp = $request->otp;
|
||||
$user = session()->get('tmpUserOTP');
|
||||
if (!$user)
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode($user->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode($user->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
Auth::login($user);
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
} else {
|
||||
Auth::logout();
|
||||
Session::flush();
|
||||
return redirect()->route('verification_failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send OPT by SMS
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function sendOtpBySms()
|
||||
public function sendOTPBySMS()
|
||||
{
|
||||
$user = session()->get('tmpUserOTP');
|
||||
if (!$user) {
|
||||
if (!$user)
|
||||
return back()->withErrors('User not found.');
|
||||
}
|
||||
|
||||
if (is_null($user->phone)) {
|
||||
if (is_null($user->phone))
|
||||
return back()->withErrors('Phone number missing.');
|
||||
}
|
||||
|
||||
$otp = (new Totp())->GenerateToken(Base32::decode($user->totp_secret));
|
||||
|
||||
if (!$otp) {
|
||||
return back()->withErrors('Erreur lors de la génération du code OTP');
|
||||
}
|
||||
|
||||
/** @var \App\Lib\LDC\MailjetSms */
|
||||
$mj = app('MailjetSms');
|
||||
$mjResponse = $mj->send("OTP : " . implode(' ', str_split($otp)), $user->phone);
|
||||
|
||||
try {
|
||||
$mjResponse = $mj->send("OTP : " . implode(' ', str_split($otp)), $user->phone);
|
||||
/** @var \GuzzleHttp\Psr7\Response $mjResponse */
|
||||
$responseStatus = $mjResponse->getStatusCode();
|
||||
if ($responseStatus == 200) {
|
||||
return back()->with('success', 'SMS envoyé.');
|
||||
}
|
||||
return back()->withErrors('SMS not sent.');
|
||||
} catch (RequestException $e) {
|
||||
report($e);
|
||||
return back()->withErrors('Erreur lors de l\'envoi du SMS');
|
||||
/** @var \GuzzleHttp\Psr7\Response $mjResponse */
|
||||
$responseStatus = $mjResponse->getStatusCode(); //"200"
|
||||
$responsePhrase = $mjResponse->getReasonPhrase(); //"OK"
|
||||
if ($responseStatus == 200) {
|
||||
$mjSmsResponse = $mjResponse->getBody()->getContents();
|
||||
return back()->with('success', "SMS envoyé.");
|
||||
}
|
||||
return back()->withErrors('SMS not sent.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,161 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Environment;
|
||||
use App\Enums\ServerType;
|
||||
use App\Http\Requests\Projects\StoreProjectRequest;
|
||||
use App\Http\Requests\Projects\UpdateProjectRequest;
|
||||
use App\Http\Requests\ValidateOtpRequest;
|
||||
use App\Models\Project;
|
||||
use App\Models\Server;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class ProjectController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$projects = Project::orderBy('name')->get();
|
||||
return view('projects.index', ['projects' => $projects]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$dev_db_server = Server::where([
|
||||
['env', Environment::DEV()],
|
||||
['type', ServerType::DB()]
|
||||
])->get();
|
||||
$dev_web_server = Server::where([
|
||||
['env', Environment::DEV()],
|
||||
['type', ServerType::WEB()]
|
||||
])->get();
|
||||
$prod_db_server = Server::where([
|
||||
['env', Environment::PROD()],
|
||||
['type', ServerType::DB()]
|
||||
])->get();
|
||||
$prod_web_server = Server::where([
|
||||
['env', Environment::PROD()],
|
||||
['type', ServerType::WEB()]
|
||||
])->get();
|
||||
return view('projects.create', \compact(
|
||||
'dev_db_server',
|
||||
'dev_web_server',
|
||||
'prod_db_server',
|
||||
'prod_web_server'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Projects\StoreProjectRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreProjectRequest $request)
|
||||
{
|
||||
$project = new Project();
|
||||
$project->uuid = Uuid::uuid4();
|
||||
$project->fill($request->validated());
|
||||
$project->dev_login = \json_decode($project->dev_login);
|
||||
$project->prod_login = \json_decode($project->prod_login);
|
||||
if ($project->saveOrFail()) {
|
||||
return redirect()->route('projects.edit', compact('project'))
|
||||
->with('success', trans('Projet ajouté.'));
|
||||
}
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Project $project
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
public function edit(Project $project)
|
||||
{
|
||||
// phpcs:enable
|
||||
$dev_db_server = Server::where([
|
||||
['env', Environment::DEV()],
|
||||
['type', ServerType::DB()]
|
||||
])->get();
|
||||
$dev_web_server = Server::where([
|
||||
['env', Environment::DEV()],
|
||||
['type', ServerType::WEB()]
|
||||
])->get();
|
||||
$prod_db_server = Server::where([
|
||||
['env', Environment::PROD()],
|
||||
['type', ServerType::DB()]
|
||||
])->get();
|
||||
$prod_web_server = Server::where([
|
||||
['env', Environment::PROD()],
|
||||
['type', ServerType::WEB()]
|
||||
])->get();
|
||||
return view('projects.edit', \compact(
|
||||
'project',
|
||||
'dev_db_server',
|
||||
'dev_web_server',
|
||||
'prod_db_server',
|
||||
'prod_web_server'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Projects\UpdateProjectRequest $request
|
||||
* @param \App\Models\Project $project
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateProjectRequest $request, Project $project)
|
||||
{
|
||||
$project->fill($request->validated());
|
||||
$project->dev_login = \json_decode($project->dev_login);
|
||||
$project->prod_login = \json_decode($project->prod_login);
|
||||
if ($project->saveOrFail()) {
|
||||
return redirect()->route('projects.edit', compact('project'))
|
||||
->with('success', trans('Projet mis à jour.'));
|
||||
}
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Project $project
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Project $project)
|
||||
{
|
||||
return view('projects.delete', ['project' => $project]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ValidateOtpRequest $request
|
||||
* @param \App\Models\Project $project
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function destroySubmit(ValidateOtpRequest $request, Project $project)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($project->deleteOrFail()) {
|
||||
return redirect()->route('projects.index')
|
||||
->with('warning', 'Projet supprimé !');
|
||||
}
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
223
app/Http/Controllers/ProjectsController.php
Normal file
223
app/Http/Controllers/ProjectsController.php
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Projects\StoreProjects;
|
||||
use App\Http\Requests\Projects\UpdateProjects;
|
||||
use App\Models\Projects;
|
||||
use App\Models\Servers;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class ProjectsController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$projects = Projects::orderBy('name')->get();
|
||||
return view('projects.index', ['projects' => $projects]);
|
||||
}
|
||||
|
||||
public function WpAutoLogin(Request $request)
|
||||
{
|
||||
$url = $request->url;
|
||||
$login = $request->login;
|
||||
$pwd = $request->pwd;
|
||||
|
||||
return view('projects.wp-auto-login', ['url' => $url, 'login' => $login, 'pwd' => $pwd]);
|
||||
}
|
||||
|
||||
public function add(Request $request)
|
||||
{
|
||||
$dev_db_server = Servers::where([
|
||||
['env', 'DEV'],
|
||||
['type', 'DB']
|
||||
])->get();
|
||||
$dev_web_server = Servers::where([
|
||||
['env', 'DEV'],
|
||||
['type', 'WEB']
|
||||
])->get();
|
||||
$prod_db_server = Servers::where([
|
||||
['env', 'PROD'],
|
||||
['type', 'DB']
|
||||
])->get();
|
||||
$prod_web_server = Servers::where([
|
||||
['env', 'PROD'],
|
||||
['type', 'WEB']
|
||||
])->get();
|
||||
return view('projects.add', ['dev_db_server' => $dev_db_server, 'dev_web_server' => $dev_web_server, 'prod_db_server' => $prod_db_server, 'prod_web_server' => $prod_web_server]);
|
||||
}
|
||||
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$uuid = $request->uuid;
|
||||
$project = Projects::where('uuid', '=', $uuid)->first();
|
||||
if (!$project)
|
||||
abort(404);
|
||||
|
||||
$dev_db_server = Servers::where([
|
||||
['env', 'DEV'],
|
||||
['type', 'DB']
|
||||
])->get();
|
||||
$dev_web_server = Servers::where([
|
||||
['env', 'DEV'],
|
||||
['type', 'WEB']
|
||||
])->get();
|
||||
$prod_db_server = Servers::where([
|
||||
['env', 'PROD'],
|
||||
['type', 'DB']
|
||||
])->get();
|
||||
$prod_web_server = Servers::where([
|
||||
['env', 'PROD'],
|
||||
['type', 'WEB']
|
||||
])->get();
|
||||
return view('projects.edit', ['project' => $project, 'dev_db_server' => $dev_db_server, 'dev_web_server' => $dev_web_server, 'prod_db_server' => $prod_db_server, 'prod_web_server' => $prod_web_server]);
|
||||
}
|
||||
|
||||
public function update(UpdateProjects $request)
|
||||
{
|
||||
$uuid = $request->uuid;
|
||||
$project = Projects::where('uuid', '=', $uuid)->first();
|
||||
if (!$project)
|
||||
abort(404);
|
||||
$this->makeChanges($request, $project);
|
||||
return redirect()->route('projects.edit', ['uuid' => $project->uuid])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function store(StoreProjects $request)
|
||||
{
|
||||
$project = new Projects();
|
||||
$project->uuid = Uuid::uuid4();
|
||||
$this->makeChanges($request, $project);
|
||||
return redirect()->route('projects.edit', ['uuid' => $project->uuid])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$uuid = $request->uuid;
|
||||
$project = Projects::where('uuid', '=', $uuid)->first();
|
||||
if (!$project)
|
||||
abort(404);
|
||||
return view('projects.delete', ['project' => $project]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$uuid = $request->uuid;
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$project = Projects::where('uuid', '=', $uuid)->first();
|
||||
if (!$project)
|
||||
abort(404);
|
||||
$project->delete();
|
||||
return redirect()->route('projects.index')->with('status', 'Projet supprimé !');
|
||||
} else {
|
||||
return redirect()->route('projects.edit', ['uuid' => $uuid])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
}
|
||||
|
||||
private function makeChanges(Request $request, $project)
|
||||
{
|
||||
$name = $request->name;
|
||||
$display_name = $request->display_name;
|
||||
$php = $request->php;
|
||||
$type = $request->type;
|
||||
$https = $request->https;
|
||||
$prod_haproxy_id = $request->prod_haproxy_id;
|
||||
$dev_haproxy_id = $request->dev_haproxy_id;
|
||||
$prod_url = $request->prod_url;
|
||||
$dev_url = $request->dev_url;
|
||||
$prod_document_root = $request->prod_document_root;
|
||||
$dev_document_root = $request->dev_document_root;
|
||||
$prod_unix_user = $request->prod_unix_user;
|
||||
$dev_unix_user = $request->dev_unix_user;
|
||||
$prod_unix_pwd = $request->prod_unix_pwd;
|
||||
$dev_unix_pwd = $request->dev_unix_pwd;
|
||||
$prod_db_user = $request->prod_db_user;
|
||||
$dev_db_user = $request->dev_db_user;
|
||||
$prod_db_pwd = $request->prod_db_pwd;
|
||||
$dev_db_pwd = $request->dev_db_pwd;
|
||||
$prod_db_schema = $request->prod_db_schema;
|
||||
$dev_db_schema = $request->dev_db_schema;
|
||||
$prod_db_server_id = $request->prod_db_server_id;
|
||||
$dev_db_server_id = $request->dev_db_server_id;
|
||||
$prod_web_server_id = $request->prod_web_server_id;
|
||||
$dev_web_server_id = $request->dev_web_server_id;
|
||||
$prod_comment = $request->prod_comment;
|
||||
$dev_comment = $request->dev_comment;
|
||||
$prod_eai = $request->prod_eai;
|
||||
$dev_eai = $request->dev_eai;
|
||||
$prod_whitelist_fw = $request->prod_whitelist_fw;
|
||||
$dev_whitelist_fw = $request->dev_whitelist_fw;
|
||||
$dev_htaccess_user = $request->dev_htaccess_user;
|
||||
$dev_htaccess_pwd = $request->dev_htaccess_pwd;
|
||||
$prod_ga_id = $request->prod_ga_id;
|
||||
$prod_laravel_app_key = $request->prod_laravel_app_key;
|
||||
$dev_laravel_app_key = $request->dev_laravel_app_key;
|
||||
$prod_smtp_config = $request->prod_smtp_config;
|
||||
$prod_smtp_key = $request->prod_smtp_key;
|
||||
|
||||
if (Auth::user()->role === 1) {
|
||||
$prod_login = $request->prod_login;
|
||||
$dev_login = $request->dev_login;
|
||||
$prod_bo_url = $request->prod_bo_url;
|
||||
$dev_bo_url = $request->dev_bo_url;
|
||||
}
|
||||
|
||||
$project->name = $name;
|
||||
$project->display_name = $display_name;
|
||||
$project->php = $php;
|
||||
$project->type = $type;
|
||||
$project->https = $https;
|
||||
$project->prod_haproxy_id = $prod_haproxy_id;
|
||||
$project->dev_haproxy_id = $dev_haproxy_id;
|
||||
$project->prod_url = $prod_url;
|
||||
$project->dev_url = $dev_url;
|
||||
$project->prod_document_root = $prod_document_root;
|
||||
$project->dev_document_root = $dev_document_root;
|
||||
$project->prod_unix_user = $prod_unix_user;
|
||||
$project->dev_unix_user = $dev_unix_user;
|
||||
$project->prod_unix_pwd = $prod_unix_pwd;
|
||||
$project->dev_unix_pwd = $dev_unix_pwd;
|
||||
$project->prod_db_user = $prod_db_user;
|
||||
$project->dev_db_user = $dev_db_user;
|
||||
$project->prod_db_pwd = $prod_db_pwd;
|
||||
$project->dev_db_pwd = $dev_db_pwd;
|
||||
$project->prod_db_schema = $prod_db_schema;
|
||||
$project->dev_db_schema = $dev_db_schema;
|
||||
$project->prod_db_server_id = $prod_db_server_id;
|
||||
$project->dev_db_server_id = $dev_db_server_id;
|
||||
$project->prod_web_server_id = $prod_web_server_id;
|
||||
$project->dev_web_server_id = $dev_web_server_id;
|
||||
$project->prod_comment = $prod_comment;
|
||||
$project->dev_comment = $dev_comment;
|
||||
$project->prod_eai = $prod_eai;
|
||||
$project->dev_eai = $dev_eai;
|
||||
$project->prod_whitelist_fw = $prod_whitelist_fw;
|
||||
$project->dev_whitelist_fw = $dev_whitelist_fw;
|
||||
$project->dev_htaccess_user = $dev_htaccess_user;
|
||||
$project->dev_htaccess_pwd = $dev_htaccess_pwd;
|
||||
$project->prod_ga_id = $prod_ga_id;
|
||||
$project->prod_laravel_app_key = $prod_laravel_app_key;
|
||||
$project->dev_laravel_app_key = $dev_laravel_app_key;
|
||||
$project->prod_smtp_config = $prod_smtp_config;
|
||||
$project->prod_smtp_key = $prod_smtp_key;
|
||||
|
||||
if (Auth::user()->role === 1) {
|
||||
$project->prod_login = $prod_login;
|
||||
$project->dev_login = $dev_login;
|
||||
$project->prod_bo_url = $prod_bo_url;
|
||||
$project->dev_bo_url = $dev_bo_url;
|
||||
}
|
||||
|
||||
$project->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Servers\StoreServerRequest;
|
||||
use App\Http\Requests\Servers\UpdateServerRequest;
|
||||
use App\Http\Requests\ValidateOtpRequest;
|
||||
use App\Models\Project;
|
||||
use App\Models\Server;
|
||||
|
||||
class ServerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$servers = Server::all();
|
||||
return view('servers.index', compact('servers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('servers.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Servers\StoreServerRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreServerRequest $request)
|
||||
{
|
||||
$server = new Server();
|
||||
$server->fill($request->validated());
|
||||
if ($server->saveOrFail()) {
|
||||
return redirect()->route('servers.edit', compact('server'))
|
||||
->with('success', trans('Server créé.'));
|
||||
}
|
||||
|
||||
return \back();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Server $server)
|
||||
{
|
||||
return view('servers.edit', ['server' => $server]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Servers\UpdateServerRequest $request
|
||||
* @param \App\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateServerRequest $request, Server $server)
|
||||
{
|
||||
$server->fill($request->validated());
|
||||
if ($server->saveOrFail()) {
|
||||
return redirect()->route('servers.edit', compact('server'))
|
||||
->with('success', trans('Server mis à jour.'));
|
||||
}
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Server $server)
|
||||
{
|
||||
$isUsed = false;
|
||||
if ($server->type === 'DB' || $server->type === 'WEB') {
|
||||
$projects = Project::where('dev_db_server_id', '=', $server->id)
|
||||
->orWhere('dev_web_server_id', '=', $server->id)
|
||||
->orWhere('prod_db_server_id', '=', $server->id)
|
||||
->orWhere('prod_web_server_id', '=', $server->id)
|
||||
->get();
|
||||
$isUsed = $projects->count() ? $projects : false;
|
||||
}
|
||||
|
||||
return view('servers.delete', ['server' => $server, 'isUsed' => $isUsed]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ValidateOtpRequest $request
|
||||
* @param \App\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function destroySubmit(ValidateOtpRequest $request, Server $server)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($server->deleteOrFail()) {
|
||||
return redirect()->route('servers.index')
|
||||
->with('warning', 'Server supprimé !');
|
||||
}
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
102
app/Http/Controllers/ServersController.php
Normal file
102
app/Http/Controllers/ServersController.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DatastorePcc;
|
||||
use App\Models\Projects;
|
||||
use App\Models\Servers;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class ServersController extends Controller
|
||||
{
|
||||
public function index(Request $request) {
|
||||
$servers = Servers::all();
|
||||
return view('servers.index', ['servers' => $servers]);
|
||||
}
|
||||
|
||||
public function add(Request $request) {
|
||||
$datastores_pcc = DatastorePcc::orderBy('title')->get();
|
||||
return view('servers.add', ['datastores_pcc' => $datastores_pcc]);
|
||||
}
|
||||
|
||||
public function edit(Request $request) {
|
||||
$server_id = $request->id;
|
||||
$server = Servers::findOrFail($server_id);
|
||||
$datastores_pcc = DatastorePcc::orderBy('title')->get();
|
||||
return view('servers.edit', ['server' => $server, 'datastores_pcc' => $datastores_pcc]);
|
||||
}
|
||||
|
||||
public function update(Request $request) {
|
||||
$server_id = $request->id;
|
||||
$server = Servers::findOrFail($server_id);
|
||||
$this->makeChanges($request, $server);
|
||||
return redirect()->route('servers.edit', ['id' => $server_id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
$server = new Servers();
|
||||
$this->makeChanges($request, $server);
|
||||
return redirect()->route('servers.edit', ['id' => $server->id])->with('status', 'Sauvegardé !');
|
||||
}
|
||||
|
||||
public function delete(Request $request) {
|
||||
$server_id = $request->id;
|
||||
$server = Servers::findOrFail($server_id);
|
||||
|
||||
if ($server->type === 'DB' || $server->type === 'WEB') {
|
||||
$isUsed = Projects::where('dev_db_server_id', '=', $server->id)->orWhere('dev_web_server_id', '=', $server->id)->orWhere('prod_db_server_id', '=', $server->id)->orWhere('prod_web_server_id', '=', $server->id)->get();
|
||||
if ($isUsed->count() === 0)
|
||||
$isUsed = false;
|
||||
} else {
|
||||
$isUsed = false;
|
||||
}
|
||||
|
||||
return view('servers.delete', ['server' => $server, 'isUsed' => $isUsed]);
|
||||
}
|
||||
|
||||
public function forceDelete(Request $request)
|
||||
{
|
||||
$server_id = $request->id;
|
||||
$otp = $request->otp;
|
||||
|
||||
$lastCode = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret), Carbon::now()->subSeconds(30)->timestamp);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode(Auth::user()->totp_secret));
|
||||
|
||||
if ($otp === $code || $otp === $lastCode) {
|
||||
$server = Servers::findOrFail($server_id);
|
||||
$server->delete();
|
||||
return redirect()->route('servers.index')->with('status', 'Serveur supprimé !');
|
||||
}else{
|
||||
return redirect()->route('servers.edit', ['id' => $server_id])->with('error', 'Code de vérification invalide.');
|
||||
}
|
||||
}
|
||||
|
||||
private function makeChanges($request, $server) {
|
||||
$env = $request->env;
|
||||
$virtual_ip = $request->virtual_ip;
|
||||
$ssh = $request->ssh;
|
||||
$infraweb_ip = $request->infraweb_ip;
|
||||
$title = $request->title;
|
||||
$name = $request->name;
|
||||
$function = $request->function;
|
||||
$dpcc = $request->datastore_pcc_id;
|
||||
$comment = $request->comment;
|
||||
$type = $request->type;
|
||||
|
||||
$server->env = $env;
|
||||
$server->virtual_ip = $virtual_ip;
|
||||
$server->ssh = $ssh;
|
||||
$server->infraweb_ip = $infraweb_ip;
|
||||
$server->title = $title;
|
||||
$server->name = $name;
|
||||
$server->function = $function;
|
||||
$server->datastore_pcc_id = $dpcc;
|
||||
$server->comment = $comment;
|
||||
$server->type = $type;
|
||||
$server->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ServiceAccounts\StoreServiceAccountsRequest;
|
||||
use App\Http\Requests\ServiceAccounts\UpdateServiceAccountsRequest;
|
||||
use App\Http\Requests\ValidateOtpRequest;
|
||||
use App\Models\ServiceAccount;
|
||||
|
||||
class ServiceAccountsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$service_accounts = ServiceAccount::all()->sortBy('name');
|
||||
return view('service-accounts.index', compact('service_accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('service-accounts.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ServiceAccounts\StoreServiceAccountsRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreServiceAccountsRequest $request)
|
||||
{
|
||||
$service_account = new ServiceAccount();
|
||||
$service_account->fill($request->validated());
|
||||
if ($service_account->saveOrFail()) {
|
||||
return redirect()->route('service-accounts.edit', compact('service_account'))
|
||||
->with('success', trans('Compte de service créé.'));
|
||||
}
|
||||
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\ServiceAccount $service_account
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ServiceAccount $service_account)
|
||||
{
|
||||
return view('service-accounts.edit', [
|
||||
'service_account' => $service_account
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ServiceAccounts\UpdateServiceAccountsRequest $request
|
||||
* @param \App\Models\ServiceAccount $service_account
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateServiceAccountsRequest $request, ServiceAccount $service_account)
|
||||
{
|
||||
$service_account->fill($request->validated());
|
||||
if ($service_account->saveOrFail()) {
|
||||
return redirect()->route('service-accounts.edit', compact('service_account'))
|
||||
->with('success', trans('Compte de service mis à jour.'));
|
||||
}
|
||||
return \back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\ServiceAccount $service_account
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ServiceAccount $service_account)
|
||||
{
|
||||
return view('service-accounts.delete', ['service_account' => $service_account]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Http\Requests\ValidateOtpRequest $request
|
||||
* @param \App\Models\ServiceAccount $service_account
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function destroySubmit(ValidateOtpRequest $request, ServiceAccount $service_account)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($service_account->deleteOrFail()) {
|
||||
return redirect()->route('service-accounts.index')
|
||||
->with('warning', 'Compte de service supprimé !');
|
||||
}
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,31 +2,28 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Project;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\Projects;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StatusCheckerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Fetch Status
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$wpReleases = Http::get(config('status-checker.wp_endpoint'))->json();
|
||||
$laravelReleases = Http::withOptions([
|
||||
'allow_redirects' => false,
|
||||
])->asJson()->get(config('status-checker.laravel_endpoint'))->json();
|
||||
public function index(Request $request) {
|
||||
$wp_endpoint = 'https://api.wordpress.org/core/version-check/1.7/';
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET', $wp_endpoint);
|
||||
$content = $response->getBody();
|
||||
$oContent = json_decode($content);
|
||||
|
||||
$wp_latest = collect(collect(\collect($wpReleases)->get('offers'))->first())->get('version');
|
||||
$laravel_latest = ltrim(collect(collect($laravelReleases)->first())->get('tag_name'), 'v');
|
||||
$laravel_endpoint = 'https://github.com/laravel/laravel/releases/latest';
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET', $laravel_endpoint, [
|
||||
'allow_redirects' => false
|
||||
]);
|
||||
$content = $response->getBody()->getContents();
|
||||
$laravel_latest = substr($content, 84);
|
||||
$laravel_latest = substr($laravel_latest, 0, -31);
|
||||
|
||||
$projects = Project::orderBy('name')->get();
|
||||
return view('status-checker.index', compact(
|
||||
'projects',
|
||||
'wp_latest',
|
||||
'laravel_latest'
|
||||
));
|
||||
$projects = Projects::orderBy('name')->get();
|
||||
return view('status-checker.index', ['projects' => $projects, 'wp_latest' => $oContent->offers[0]->version, 'laravel_latest' => $laravel_latest]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Webhooks;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Webhooks\GitlabRequest;
|
||||
use App\Mail\Webhooks\Gitlab;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class GitlabController extends Controller
|
||||
{
|
||||
/**
|
||||
* Handle gitlab request
|
||||
*
|
||||
* @param GitlabRequest $request
|
||||
* @return void
|
||||
*/
|
||||
public function handle(GitlabRequest $request)
|
||||
{
|
||||
// TODO: Check all request inputs, before sending unvalidated data by mail.
|
||||
$event_type = $request->event_type;
|
||||
if ($event_type === 'merge_request') {
|
||||
// Si le state est <> de opened on ne fait rien .
|
||||
if ($request->object_attributes['state'] !== 'opened') {
|
||||
exit;
|
||||
}
|
||||
// Si l'action est set et egale à approved on ne fait rien .
|
||||
if (isset($request->object_attributes['action']) && $request->object_attributes['action'] === 'approved') {
|
||||
exit;
|
||||
}
|
||||
|
||||
$datas = [];
|
||||
$datas['user'] = $request->user['name'];
|
||||
$datas['project_name'] = $request->project['name'];
|
||||
$datas['project_path'] = $request->project['path_with_namespace'];
|
||||
$datas['attributes_description'] = $request->object_attributes['description'];
|
||||
$datas['attributes_status'] = $request->object_attributes['merge_status'];
|
||||
$datas['attributes_request_status'] = $request->object_attributes['state'];
|
||||
$datas['attributes_source_branch'] = $request->object_attributes['source_branch'];
|
||||
$datas['attributes_target_branch'] = $request->object_attributes['target_branch'];
|
||||
$datas['attributes_url'] = $request->object_attributes['url'];
|
||||
$datas['last_commit_author'] = $request->object_attributes['last_commit']['author']['name'];
|
||||
|
||||
Mail::to(\explode(',', config('webhooks.gitlab.notify')))->send(new Gitlab($datas));
|
||||
}//end if
|
||||
}
|
||||
}
|
||||
|
|
@ -11,13 +11,11 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
|
|
@ -26,19 +24,17 @@ class Kernel extends HttpKernel
|
|||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
'htmlsanitize',
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\SecureHeaders::class
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
|
@ -58,7 +54,7 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
|
|
@ -71,9 +67,6 @@ class Kernel extends HttpKernel
|
|||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'htmlsanitize' => \App\Http\Middleware\HtmlSanitizer::class,
|
||||
'apiCheck' => \App\Http\Middleware\ApiCheckCredentialMiddleware::class,
|
||||
'ldcnetwork' => \App\Http\Middleware\LDCNetwork::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
class ApiCheckCredentialMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param mixed $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
if ($request->token !== \config('api.key')) {
|
||||
return response('Unauthorized', 401);
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Http\Request $request */
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,12 +10,11 @@ class Authenticate extends Middleware
|
|||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param mixed $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
/** @var \Illuminate\Http\Request $request */
|
||||
if (!$request->expectsJson()) {
|
||||
session(['redirectURL' => URL::full()]);
|
||||
return route('saml2_login', 'ldc');
|
||||
|
|
|
|||
17
app/Http/Middleware/CheckForMaintenanceMode.php
Normal file
17
app/Http/Middleware/CheckForMaintenanceMode.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
||||
|
||||
class CheckForMaintenanceMode extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
@ -12,5 +12,6 @@ class EncryptCookies extends Middleware
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
];
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Lib\ToolboxHelper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HtmlSanitizer
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param mixed ...$params
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, \Closure $next, ...$params)
|
||||
{
|
||||
$inputs = $request->all();
|
||||
array_walk_recursive($inputs, function (&$input, $name) use ($params) {
|
||||
if (!is_string($input)) {
|
||||
return;
|
||||
}
|
||||
if (in_array($name, $params)) {
|
||||
// ? Is a json input ?
|
||||
if ($isJson = \json_decode($input, true) and is_array($isJson)) {
|
||||
// ! Decode each json field recursive.
|
||||
\array_walk_recursive($isJson, function (&$item) {
|
||||
if (\is_string($item)) {
|
||||
$item = clean($item);
|
||||
$item = ToolboxHelper::stripCkEditorSchemesOnMediaInputs($item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$input = clean($input);
|
||||
$input = ToolboxHelper::stripCkEditorSchemesOnMediaInputs($input);
|
||||
}
|
||||
} else {
|
||||
$input = strip_tags($input);
|
||||
}
|
||||
});
|
||||
$request->merge($inputs);
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,52 +2,22 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\LDCNetwork as ModelsLDCNetwork;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\HttpFoundation\IpUtils;
|
||||
|
||||
class LDCNetwork
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param mixed $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (\config('app.env') === 'local' || (\config('app.env') === 'production' && \config('app.debug') === true)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
/** HA PROXY HACK */
|
||||
$ip = request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp();
|
||||
$restrictedIps = Cache::get('ldcweb_ip_ranges');
|
||||
|
||||
if (\is_null($restrictedIps)) {
|
||||
$networks = ModelsLDCNetwork::all();
|
||||
$networks = $networks->map(function (ModelsLDCNetwork $network) {
|
||||
$infos = collect(explode('.', strval($network->first_ip)));
|
||||
$min = intval($infos->get(3));
|
||||
$max = collect(explode('.', strval($network->last_ip)))->get(3);
|
||||
for ($i = $min; $i <= $max; $i++) {
|
||||
$restrictedIps[] = $infos->get(0) . '.' .
|
||||
$infos->get(1) . '.' .
|
||||
$infos->get(2) . ".$i";
|
||||
}
|
||||
return $restrictedIps;
|
||||
});
|
||||
$restrictedIps = [];
|
||||
foreach ($networks->toArray() as $network) {
|
||||
$restrictedIps = array_merge($restrictedIps, $network);
|
||||
}
|
||||
Cache::put('ldcweb_ip_ranges', $restrictedIps, now()->addHours(4));
|
||||
}
|
||||
|
||||
if (!is_null($restrictedIps) && in_array($ip, $restrictedIps)) {
|
||||
return $next($request);
|
||||
}
|
||||
abort(403);
|
||||
//IpUtils::checkIp();
|
||||
// https://github.com/symfony/http-foundation/blob/master/IpUtils.php#L36
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [];
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ namespace App\Http\Middleware;
|
|||
use Aacotroneo\Saml2\Saml2Auth;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
|
|
@ -13,15 +13,15 @@ class RedirectIfAuthenticated
|
|||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
// Or, return a response that causes client side js to redirect to '/routesPrefix/myIdp1/login' .
|
||||
return response('Unauthorized.', 401);
|
||||
return response('Unauthorized.', 401); // Or, return a response that causes client side js to redirect to '/routesPrefix/myIdp1/login'
|
||||
} else {
|
||||
$saml2Auth = new Saml2Auth(Saml2Auth::loadOneLoginAuthFromIpdConfig('ldc'));
|
||||
session(['redirectURL' => URL::full()]);
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class SecureHeaders
|
||||
{
|
||||
/**
|
||||
* Enumerate headers which you do not want in your application's responses.
|
||||
* Great starting point would be to go check out @Scott_Helme's:
|
||||
* https://securityheaders.com/
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $unwantedHeaderList = [
|
||||
'X-Powered-By',
|
||||
'Server',
|
||||
];
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
View::share('nonce', $nonce = \uniqid());
|
||||
// * For VueJS dev tool to execute
|
||||
$cssDev = config('app.debug') ? "'unsafe-inline'" : "'nonce-$nonce'";
|
||||
$jsDev = config('app.debug') ? "'unsafe-eval' 'unsafe-inline'" : "'nonce-$nonce'";
|
||||
$reportUri = Route::has('cspReportUri') ?
|
||||
\sprintf('report-uri %s', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
|
||||
$this->removeUnwantedHeaders($this->unwantedHeaderList);
|
||||
$response = $next($request);
|
||||
$response->headers->set('Referrer-Policy', 'no-referrer-when-downgrade');
|
||||
$response->headers->set('X-Content-Type-Options', 'nosniff');
|
||||
$response->headers->set('X-XSS-Protection', '1; mode=block');
|
||||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
|
||||
$response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains;');
|
||||
$cspPolicies = [
|
||||
"default-src 'none';",
|
||||
// * CKEDITOR Specific https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/csp.html
|
||||
"connect-src 'self' blob:;",
|
||||
"img-src * data: blob:;",
|
||||
"frame-src https://www.youtube.com;",
|
||||
"font-src 'self' data: https://fonts.gstatic.com;",
|
||||
// ! Using CKEditor wiill must have unsafe-inline style
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
// "style-src 'self' 'unsafe-inline';",
|
||||
// ! If you dont use ckeditor use this
|
||||
"style-src 'self' $cssDev https://fonts.googleapis.com;",
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
"script-src 'self' $jsDev;"
|
||||
];
|
||||
$response->headers->set(
|
||||
'Content-Security-Policy',
|
||||
implode(' ', $cspPolicies) . $reportUri
|
||||
);
|
||||
$response->headers->set('Feature-Policy', 'fullscreen \'self\';');
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unwanted headers
|
||||
*
|
||||
* @param array $headerList
|
||||
* @return void
|
||||
*/
|
||||
private function removeUnwantedHeaders(array $headerList)
|
||||
{
|
||||
foreach ($headerList as $header) {
|
||||
header_remove($header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ class TrustProxies extends Middleware
|
|||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_FOR;
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class VerifyCsrfToken extends Middleware
|
|||
/**
|
||||
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
protected $addHttpCookie = true;
|
||||
|
||||
|
|
@ -19,6 +19,6 @@ class VerifyCsrfToken extends Middleware
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'webhooks/*'
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateProjectStatusRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return ($this->token === \config('api.key')) && !\is_null($this->datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$data = \json_decode($this->datas, true);
|
||||
$this->merge([
|
||||
'project_uuid' => collect($data)->get('uuid'),
|
||||
'sitemap' => collect($data)->get('sitemap') === 'true' ? true : false,
|
||||
'robots' => collect($data)->get('robots') === 'true' ? true : false,
|
||||
'code' => collect($data)->get('code'),
|
||||
'logs' => collect($data)->get('logs')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'project_uuid' => 'required|exists:projects,uuid',
|
||||
'sitemap' => 'required|boolean',
|
||||
'robots' => 'required|boolean',
|
||||
'code' => 'required|array',
|
||||
'logs' => 'required|numeric',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/GitReposStoreRequest.php
Normal file
46
app/Http/Requests/GitReposStoreRequest.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class GitReposStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => [
|
||||
'string',
|
||||
'required',
|
||||
Rule::unique('git_repos', 'name'),
|
||||
],
|
||||
'login' => [
|
||||
Rule::requiredIf(function () {
|
||||
return !is_null($this->password);
|
||||
})
|
||||
],
|
||||
'password' => [
|
||||
Rule::requiredIf(function () {
|
||||
return !is_null($this->login);
|
||||
})
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/GitReposUpdateRequest.php
Normal file
46
app/Http/Requests/GitReposUpdateRequest.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class GitReposUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => [
|
||||
'string',
|
||||
'required',
|
||||
Rule::unique('git_repos', 'name')->ignore($this->git_repo->id),
|
||||
],
|
||||
'login' => [
|
||||
Rule::requiredIf(function () {
|
||||
return !is_null($this->password);
|
||||
})
|
||||
],
|
||||
'password' => [
|
||||
Rule::requiredIf(function () {
|
||||
return !is_null($this->login);
|
||||
})
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\LDCNetworks;
|
||||
|
||||
use App\Rules\CidrRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class StoreLDCNetwork extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge($this->cidrToRange());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'cidr' => ['required', new CidrRule()],
|
||||
'first_ip' => 'required|ipv4',
|
||||
'last_ip' => 'required|ipv4'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* cidr To Ranges
|
||||
*
|
||||
* @return array ['first_ip', 'last_ip']
|
||||
*/
|
||||
private function cidrToRange(): array
|
||||
{
|
||||
$first_ip = '';
|
||||
$last_ip = '';
|
||||
$cidr = collect(explode('/', \strval($this->cidr)));
|
||||
try {
|
||||
$first_ip = long2ip(intval(ip2long($cidr->get(0))) & ((-1 << (32 - intval($cidr->get(1))))));
|
||||
$last_ip = long2ip(intval(ip2long(\strval($first_ip))) + pow(2, (32 - intval($cidr->get(1)))) - 1);
|
||||
} catch (\Error $e) {
|
||||
Session::flash('warning', trans('Le CIDR est mal formé'));
|
||||
}
|
||||
return \compact('first_ip', 'last_ip');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\LDCNetworks;
|
||||
|
||||
class UpdateLDCNetwork extends StoreLDCNetwork
|
||||
{
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Projects;
|
||||
|
||||
use App\Enums\PhpVersion;
|
||||
use App\Enums\ProjectType;
|
||||
use App\Enums\SmtpEnum;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
|
||||
|
||||
class StoreProjectRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'https' => $this->https ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = [];
|
||||
if (Auth::user()->equipe_web_member) {
|
||||
$rules = [
|
||||
'prod_login' => 'required|json',
|
||||
'dev_login' => 'required|json',
|
||||
'prod_bo_url' => 'required|url',
|
||||
'dev_bo_url' => 'required|url',
|
||||
];
|
||||
}
|
||||
return \array_merge($rules, [
|
||||
'name' => 'required|string|min:2|max:255',
|
||||
'display_name' => 'required|string|min:2|max:255',
|
||||
'php' => ['required', new EnumIsValidRule(PhpVersion::class)],
|
||||
'type' => ['required', new EnumIsValidRule(ProjectType::class)],
|
||||
|
||||
'https' => 'required|boolean',
|
||||
|
||||
'prod_haproxy_id' => 'nullable|regex:/^P?\d{3}$/',
|
||||
'dev_haproxy_id' => 'nullable|regex:/^P?\d{3}$/',
|
||||
|
||||
'prod_url' => 'nullable|url|max:255',
|
||||
'dev_url' => 'nullable|url|max:255',
|
||||
|
||||
'prod_document_root' => 'nullable|regex:/^(\/)?([^\/\0]+(\/)?)+$/|max:255',
|
||||
'dev_document_root' => 'nullable|regex:/^(\/)?([^\/\0]+(\/)?)+$/|max:255',
|
||||
|
||||
'prod_unix_user' => 'nullable|string|max:255',
|
||||
'prod_unix_pwd' => 'nullable|string|max:255',
|
||||
'dev_unix_user' => 'nullable|string|max:255',
|
||||
'dev_unix_pwd' => 'nullable|string|max:255',
|
||||
|
||||
'prod_db_user' => 'nullable|string|max:255',
|
||||
'prod_db_pwd' => 'nullable|string|max:255',
|
||||
'dev_db_user' => 'nullable|string|max:255',
|
||||
'dev_db_pwd' => 'nullable|string|max:255',
|
||||
|
||||
'prod_db_schema' => 'nullable|string|max:255',
|
||||
'dev_db_schema' => 'nullable|string|max:255',
|
||||
|
||||
'prod_db_server_id' => 'sometimes|exists:servers,id',
|
||||
'dev_db_server_id' => 'sometimes|exists:servers,id',
|
||||
'prod_web_server_id' => 'sometimes|exists:servers,id',
|
||||
'dev_web_server_id' => 'sometimes|exists:servers,id',
|
||||
|
||||
'prod_comment' => 'nullable|string|max:255',
|
||||
'dev_comment' => 'nullable|string|max:255',
|
||||
|
||||
'prod_eai' => 'nullable|string|max:255',
|
||||
'dev_eai' => 'nullable|string|max:255',
|
||||
|
||||
'prod_whitelist_fw' => 'nullable|string|max:255',
|
||||
'dev_whitelist_fw' => 'nullable|string|max:255',
|
||||
|
||||
'dev_htaccess_user' => 'required|string|min:2|max:255',
|
||||
'dev_htaccess_pwd' => 'required|string|min:2|max:255',
|
||||
|
||||
'prod_ga_id' => 'nullable|string|max:50',
|
||||
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'prod_laravel_app_key' => 'nullable|regex:/^base64:(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/|max:255',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'dev_laravel_app_key' => 'nullable|regex:/^base64:(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/|max:255',
|
||||
|
||||
'prod_smtp_config' => [
|
||||
'required', new EnumIsValidRule(SmtpEnum::class)
|
||||
],
|
||||
'prod_smtp_key' => 'required_if:prod_smtp_config,3|max:255|max:255',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\ServiceAccounts;
|
||||
namespace App\Http\Requests\Projects;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StoreServiceAccountsRequest extends FormRequest
|
||||
class StoreProjects extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
return Auth::checK();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -25,10 +25,9 @@ class StoreServiceAccountsRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|min:2|max:255',
|
||||
'url' => 'required|min:2|max:255|url',
|
||||
'account' => 'required|min:2|max:255',
|
||||
'password' => 'required|max:255'
|
||||
// TODO : compléter les rules
|
||||
'prod_smtp_config' => 'integer|required',
|
||||
'prod_smtp_key' => 'required_if:prod_smtp_config,3'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,21 @@
|
|||
|
||||
namespace App\Http\Requests\Projects;
|
||||
|
||||
class UpdateProjectRequest extends StoreProjectRequest
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class UpdateProjects extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::checK();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
|
|
@ -11,12 +24,12 @@ class UpdateProjectRequest extends StoreProjectRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
return \array_merge(parent::rules(), [
|
||||
// TODO : compléter les rules .
|
||||
return [
|
||||
// TODO : compléter les rules
|
||||
'prod_laravel_app_key' => 'required_if:type,3',
|
||||
'dev_laravel_app_key' => 'required_if:type,3',
|
||||
'prod_smtp_config' => 'integer|required',
|
||||
'prod_smtp_key' => 'required_if:prod_smtp_config,3'
|
||||
]);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Servers;
|
||||
|
||||
use App\Enums\Environment;
|
||||
use App\Enums\ServerType;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
|
||||
|
||||
class StoreServerRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Auth::check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'env' => [
|
||||
'required', new EnumIsValidRule(Environment::class)
|
||||
],
|
||||
'virtual_ip' => 'required|ipV4',
|
||||
'ssh' => 'required',
|
||||
'infraweb_ip' => 'required|ipV4',
|
||||
'title' => 'required|min:2|max:50',
|
||||
'name' => 'required|min:2|max:50',
|
||||
'function' => 'required|min:2|max:50',
|
||||
'comment' => 'nullable|string',
|
||||
'type' => [
|
||||
'required', new EnumIsValidRule(ServerType::class)
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Servers;
|
||||
|
||||
class UpdateServerRequest extends StoreServerRequest
|
||||
{
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\ServiceAccounts;
|
||||
|
||||
class UpdateServiceAccountsRequest extends StoreServiceAccountsRequest
|
||||
{
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Carbon;
|
||||
use lfkeitel\phptotp\Base32;
|
||||
use lfkeitel\phptotp\Totp;
|
||||
|
||||
class ValidateOtpRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
if (!session()->get('tmpUserOTP')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'otp' => [
|
||||
'string',
|
||||
'required',
|
||||
function ($attribute, $value, $fail) {
|
||||
$user = session()->get('tmpUserOTP');
|
||||
$lastCode = (new Totp())->GenerateToken(
|
||||
Base32::decode($user->totp_secret),
|
||||
Carbon::now()->subSeconds(30)->timestamp
|
||||
);
|
||||
$code = (new Totp())->GenerateToken(Base32::decode($user->totp_secret));
|
||||
|
||||
if (!($value === $code || $value === $lastCode)) {
|
||||
$fail("Code de vérification $attribute invalide.");
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Webhooks;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class GitlabRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->header('X-Gitlab-Token') !== null &&
|
||||
$this->header('X-Gitlab-Token') === config('webhooks.gitlab.token');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'event_type' => 'required|in:merge_request'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -4,44 +4,29 @@ namespace App\Lib\LDC;
|
|||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class MailjetSms
|
||||
{
|
||||
/** @var Application $app */
|
||||
protected $app;
|
||||
|
||||
/** @var array $config */
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* MailjetSms
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
*/
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->loadDefaultOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* loadDefaultOptions
|
||||
*
|
||||
* @return \App\Lib\LDC\MailjetSms
|
||||
*/
|
||||
protected function loadDefaultOptions(): \App\Lib\LDC\MailjetSms
|
||||
protected function loadDefaultOptions(): MailjetSms
|
||||
{
|
||||
$this->config = $this->app['config']->get('services.mailjet');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* buildHttpClient
|
||||
*
|
||||
* @return \GuzzleHttp\Client
|
||||
*/
|
||||
protected function buildHttpClient(): \GuzzleHttp\Client
|
||||
protected function buildHttpClient(): Client
|
||||
{
|
||||
return new Client([
|
||||
'allow_redirects' => false,
|
||||
|
|
@ -57,18 +42,9 @@ class MailjetSms
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* send sms
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $to
|
||||
* @param string|null $from
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @throws \GuzzleHttp\Exception\RequestException If Mailsms send service call failed.
|
||||
*/
|
||||
public function send(string $message, string $to, ?string $from = null): ResponseInterface
|
||||
public function send(string $message, string $to, $from = null): ResponseInterface
|
||||
{
|
||||
$from = $from ?? $this->config['sms_from'];
|
||||
$from = $from ?? $this->config['sms_from'];
|
||||
$client = $this->buildHttpClient();
|
||||
|
||||
try {
|
||||
|
|
@ -79,11 +55,16 @@ class MailjetSms
|
|||
'To' => $to,
|
||||
]
|
||||
]);
|
||||
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
||||
report($e);
|
||||
throw $e;
|
||||
} catch (\GuzzleHttp\Exception\RequestException $ex) {
|
||||
Log::debug('error ' . $ex->getMessage());
|
||||
if (!is_null($ex->getResponse())){
|
||||
Log::debug((string) $ex->getResponse()->getBody());
|
||||
}
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,228 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class ToolboxHelper
|
||||
{
|
||||
/**
|
||||
* Strip scheme (https) on oembed urls
|
||||
* Only embed allowed are for MP4 self hosted videos right now
|
||||
*
|
||||
* https is force by ckeditor MediaElements which natively supports
|
||||
* only cloud hosted medias (youtube, spotify etc..)
|
||||
*
|
||||
* @param string $input
|
||||
* @return string
|
||||
*/
|
||||
public static function stripCkEditorSchemesOnMediaInputs(string $input): string
|
||||
{
|
||||
$input = \preg_replace('/(?<=<oembed url=")(https:\/\/)(?=.*?">)/m', '', $input);
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert That no Back Office url is present on txt
|
||||
*
|
||||
* @param string $field
|
||||
* @param string $text
|
||||
* @return string
|
||||
* @throws \Illuminate\Validation\ValidationException If url is a bo url.
|
||||
*/
|
||||
public static function assertNoInternalBoUrls(string $field, string $text): string
|
||||
{
|
||||
$routes = Route::getRoutes();
|
||||
// * Url replace and email replace.
|
||||
$text = preg_replace_callback(
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'/(?P<url>(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))/',
|
||||
function ($matches) use ($routes, $field) {
|
||||
$match = collect($matches)->first() ?? '';
|
||||
$url = $match;
|
||||
try {
|
||||
$request = Request::create($url);
|
||||
// If a route is match then it do not throws exception.
|
||||
if (
|
||||
\parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST) &&
|
||||
trim($routes->match($request)->getPrefix() ?? '', '/') === 'bo'
|
||||
) {
|
||||
// Removes the matched url.
|
||||
throw ValidationException::withMessages([
|
||||
$field => sprintf(
|
||||
'%s : Il est interdit de coller une url du back office dans ce champ',
|
||||
trans($field)
|
||||
)
|
||||
]);
|
||||
}
|
||||
return $match;
|
||||
} catch (NotFoundHttpException $e) {
|
||||
return $match;
|
||||
}
|
||||
},
|
||||
$text
|
||||
);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert That only external url is present on txt
|
||||
*
|
||||
* @param string $field
|
||||
* @param string $text
|
||||
* @return string
|
||||
* @throws \Illuminate\Validation\ValidationException If url is a bo url.
|
||||
*/
|
||||
public static function assertNoInternalUrls(string $field, string $text): string
|
||||
{
|
||||
self::assertNoInternalBoUrls($field, $text);
|
||||
$routes = Route::getRoutes();
|
||||
// * Url replace and email replace.
|
||||
$text = preg_replace_callback(
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'/(?P<url>(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))/',
|
||||
function ($matches) use ($routes, $field) {
|
||||
$match = collect($matches)->first() ?? '';
|
||||
$url = $match;
|
||||
try {
|
||||
$request = Request::create($url);
|
||||
// If a route is match then it do not throws exception.
|
||||
if (
|
||||
\parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST) &&
|
||||
$routes->match($request)
|
||||
) {
|
||||
// Removes the matched url.
|
||||
throw ValidationException::withMessages([
|
||||
$field => sprintf(
|
||||
'%s : Il est interdit de coller une url de %s dans ce champ',
|
||||
trans($field),
|
||||
config('app.name')
|
||||
)
|
||||
]);
|
||||
}
|
||||
return $match;
|
||||
} catch (NotFoundHttpException $e) {
|
||||
return $match;
|
||||
}
|
||||
},
|
||||
$text
|
||||
);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array from a dot separated string
|
||||
*
|
||||
* @param string $path
|
||||
* @param mixed $value
|
||||
* @param string $separator
|
||||
* @return array
|
||||
*/
|
||||
public static function dotStringToNestedArray(string $path, $value, string $separator = '.'): array
|
||||
{
|
||||
$arr = $value;
|
||||
$keys = array_reverse(explode($separator, $path));
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$arr = [$key => $arr];
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy image
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $attribute
|
||||
* @return void
|
||||
*/
|
||||
public static function removeImage(Model $model, string $attribute)
|
||||
{
|
||||
$path = ltrim($model->{$attribute}, '/');
|
||||
if (File::exists($path) and \strpos($path, 'storage') === 0) {
|
||||
File::delete($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy image
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $attribute
|
||||
* @return void
|
||||
*/
|
||||
public static function removeOldImage(Model $model, string $attribute)
|
||||
{
|
||||
$originalPath = ltrim($model->getOriginal($attribute), '/');
|
||||
if (File::exists($originalPath) and \strpos($originalPath, 'storage') === 0) {
|
||||
File::delete($originalPath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store an image of different types
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param \Illuminate\Http\UploadedFile|\SplFileInfo|string $image
|
||||
* @return string
|
||||
* @throws \ErrorException If file copy fails.
|
||||
*/
|
||||
public static function storeImage(Model $model, $image): string
|
||||
{
|
||||
$table = $model->getTable();
|
||||
if (\is_object($image) and $image instanceof \Illuminate\Http\UploadedFile) {
|
||||
/** @var \Illuminate\Http\UploadedFile $image */
|
||||
$newPath = self::prepareMoveFile($table, \filter_var(
|
||||
\strip_tags(\urldecode($image->getClientOriginalName())),
|
||||
\FILTER_SANITIZE_STRING
|
||||
));
|
||||
$newPath = str_replace(storage_path('app'), '', $newPath);
|
||||
$image->storePubliclyAs(
|
||||
pathinfo($newPath, \PATHINFO_DIRNAME),
|
||||
pathinfo($newPath, \PATHINFO_BASENAME)
|
||||
);
|
||||
return 'storage' . str_replace('/public', '', $newPath);
|
||||
}
|
||||
if (\is_object($image) and $image instanceof \SplFileInfo) {
|
||||
/** @var \SplFileInfo $image */
|
||||
$newPath = self::prepareMoveFile($table, $image->getBaseName());
|
||||
if (!File::copy($image->getRealPath(), $newPath)) {
|
||||
throw new \ErrorException(sprintf(
|
||||
'Failed to copy file %s to %s',
|
||||
$image->getRealPath(),
|
||||
$newPath
|
||||
));
|
||||
}
|
||||
return \ltrim(str_replace(\storage_path('app/public'), '/storage', $newPath), '/');
|
||||
}
|
||||
return \ltrim(strval($image), '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare storage path and return
|
||||
* the image full path
|
||||
*
|
||||
* @param string $table Model table name.
|
||||
* @param string $filename The basename for the file.
|
||||
* @return string
|
||||
*/
|
||||
private static function prepareMoveFile(string $table, string $filename): string
|
||||
{
|
||||
$pathFolder = \storage_path(sprintf('app/public/images/%s', $table));
|
||||
if (!File::exists($pathFolder)) {
|
||||
File::makeDirectory($pathFolder, 0755, true);
|
||||
}
|
||||
$filename = sprintf('%s-%s', Str::uuid(), $filename);
|
||||
$fullPath = sprintf('%s/%s', $pathFolder, $filename);
|
||||
if (File::exists($fullPath)) {
|
||||
File::delete($fullPath);
|
||||
}
|
||||
return $fullPath;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail\Webhooks;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Gitlab extends Mailable
|
||||
{
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Mail data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->text('emails.webhooks.gitlab');
|
||||
}
|
||||
}
|
||||
10
app/Models/DatastorePcc.php
Normal file
10
app/Models/DatastorePcc.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DatastorePcc extends Model
|
||||
{
|
||||
protected $table = 'datastore_pcc';
|
||||
}
|
||||
10
app/Models/DomainNames.php
Normal file
10
app/Models/DomainNames.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DomainNames extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
13
app/Models/EmailAddresses.php
Normal file
13
app/Models/EmailAddresses.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EmailAddresses extends Model
|
||||
{
|
||||
public function getDomainNameAttribute() {
|
||||
$dn = DomainNames::findOrFail($this->domain_name_id);
|
||||
return $dn->utf8_name;
|
||||
}
|
||||
}
|
||||
10
app/Models/GitRepos.php
Normal file
10
app/Models/GitRepos.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GitRepos extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'login', 'password'];
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LDCNetwork extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ldc_networks';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'cidr', 'first_ip', 'last_ip'
|
||||
];
|
||||
}
|
||||
10
app/Models/LDCNetworks.php
Normal file
10
app/Models/LDCNetworks.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LDCNetworks extends Model
|
||||
{
|
||||
protected $table = 'ldc_networks';
|
||||
}
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\PhpVersion;
|
||||
use App\Enums\ProjectType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'dev_login' => 'array',
|
||||
'prod_login' => 'array',
|
||||
'https' => 'boolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'php' => PhpVersion::class,
|
||||
'type' => ProjectType::class,
|
||||
'smtp' => SmtpEnum::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'display_name', 'php', 'type', 'https', 'prod_haproxy_id',
|
||||
'dev_haproxy_id', 'prod_url', 'dev_url', 'prod_bo_url', 'dev_bo_url', 'prod_login', 'dev_login',
|
||||
'prod_document_root', 'dev_document_root', 'prod_unix_user', 'dev_unix_user',
|
||||
'prod_unix_pwd', 'dev_unix_pwd', 'prod_db_user', 'dev_db_user',
|
||||
'prod_db_pwd', 'dev_db_pwd', 'prod_db_schema', 'dev_db_schema',
|
||||
'prod_db_server_id', 'dev_db_server_id', 'prod_web_server_id',
|
||||
'dev_web_server_id', 'prod_comment', 'dev_comment', 'prod_eai',
|
||||
'dev_eai', 'prod_whitelist_fw', 'dev_whitelist_fw',
|
||||
'dev_htaccess_user', 'dev_htaccess_pwd', 'prod_ga_id',
|
||||
'prod_laravel_app_key', 'dev_laravel_app_key',
|
||||
'prod_smtp_config', 'prod_smtp_key',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the route key for the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'uuid';
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
* get dev_web_ip attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDevWebIpAttribute()
|
||||
{
|
||||
$value = Server::find($this->dev_web_server_id);
|
||||
if ($value) {
|
||||
$value = $value->ssh;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get dev_db_ip attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDevDbIpAttribute()
|
||||
{
|
||||
$value = Server::find($this->dev_db_server_id);
|
||||
if ($value) {
|
||||
$value = $value->ssh;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get prod_web_ip attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProdWebIpAttribute()
|
||||
{
|
||||
$value = Server::find($this->prod_web_server_id);
|
||||
if ($value) {
|
||||
$value = $value->ssh;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get prod_db_ip attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProdDbIpAttribute()
|
||||
{
|
||||
$value = Server::find($this->prod_db_server_id);
|
||||
if ($value) {
|
||||
$value = $value->ssh;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get checked attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCheckedAttribute()
|
||||
{
|
||||
$value = ProjectStatusChecker::select('last_call')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->last_call;
|
||||
$dt = Carbon::now();
|
||||
if ($dt->diffInMinutes($value) > 30) {
|
||||
$value = 'false';
|
||||
} else {
|
||||
$value = 'true';
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get sitemap_checked attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSitemapCheckedAttribute()
|
||||
{
|
||||
$value = ProjectStatusChecker::select('sitemap')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->sitemap;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get robots_checked attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRobotsCheckedAttribute()
|
||||
{
|
||||
$value = ProjectStatusChecker::select('robots')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->robots;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get logs_checked attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLogsCheckedAttribute()
|
||||
{
|
||||
$value = ProjectStatusChecker::select('logs')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->logs;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get code attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCodeAttribute()
|
||||
{
|
||||
$value = ProjectStatusChecker::select('code')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->code;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* get logs_hr attribute
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLogsHrAttribute(): string
|
||||
{
|
||||
$value = ProjectStatusChecker::select('logs')->where('project_uuid', '=', $this->uuid)->first();
|
||||
return $this->humanFilesize($value->logs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Human readable file size
|
||||
*
|
||||
* @param float $size
|
||||
* @return string
|
||||
*/
|
||||
private function humanFilesize(float $size): string
|
||||
{
|
||||
$i = \floatval(floor(log($size, 1024)));
|
||||
return round($size / pow(1024, $i), [0,0,2,2,3][$i]) . [' O',' Ko',' Mo',' Go',' To'][$i];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectStatusChecker extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'code' => 'array',
|
||||
'sitemap' => 'boolean',
|
||||
'robots' => 'boolean'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'project_uuid', 'code', 'sitemap', 'robots', 'logs', 'last_call'
|
||||
];
|
||||
}
|
||||
102
app/Models/Projects.php
Normal file
102
app/Models/Projects.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Projects extends Model
|
||||
{
|
||||
public function getDevWebIpAttribute() {
|
||||
$value = Servers::find($this->dev_web_server_id);
|
||||
if ($value)
|
||||
$value = $value->ssh;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getDevDbIpAttribute() {
|
||||
$value = Servers::find($this->dev_db_server_id);
|
||||
if ($value)
|
||||
$value = $value->ssh;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getProdWebIpAttribute() {
|
||||
$value = Servers::find($this->prod_web_server_id);
|
||||
if ($value)
|
||||
$value = $value->ssh;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getProdDbIpAttribute() {
|
||||
$value = Servers::find($this->prod_db_server_id);
|
||||
if ($value)
|
||||
$value = $value->ssh;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getCheckedAttribute() {
|
||||
$value = ProjectsStatusChecker::select('updated_at')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if (!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->updated_at;
|
||||
$dt = Carbon::now();
|
||||
if ($dt->diffInMinutes($value) > 30) {
|
||||
$value = 'false';
|
||||
} else {
|
||||
$value = 'true';
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
public function getSitemapCheckedAttribute() {
|
||||
$value = ProjectsStatusChecker::select('sitemap')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if(!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->sitemap;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getRobotsCheckedAttribute() {
|
||||
$value = ProjectsStatusChecker::select('robots')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if(!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->robots;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getLogsCheckedAttribute() {
|
||||
$value = ProjectsStatusChecker::select('logs')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if(!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->logs;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getCodeAttribute() {
|
||||
$value = ProjectsStatusChecker::select('code')->where('project_uuid', '=', $this->uuid)->first();
|
||||
if(!$value) {
|
||||
$value = 'missing';
|
||||
} else {
|
||||
$value = $value->code;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getLogsHrAttribute() {
|
||||
$value = ProjectsStatusChecker::select('logs')->where('project_uuid', '=', $this->uuid)->first();
|
||||
return $this->human_filesize($value->logs);
|
||||
}
|
||||
|
||||
private function human_filesize($size, $precision = 2) {
|
||||
$i = floor(log($size, 1024));
|
||||
return round($size / pow(1024, $i), [0,0,2,2,3][$i]).[' O',' Ko',' Mo',' Go',' To'][$i];
|
||||
}
|
||||
}
|
||||
10
app/Models/ProjectsStatusChecker.php
Normal file
10
app/Models/ProjectsStatusChecker.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectsStatusChecker extends Model
|
||||
{
|
||||
protected $table = 'projects_status_checker';
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Environment;
|
||||
use App\Enums\ServerType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
|
||||
class Server extends Model
|
||||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'env' => Environment::class,
|
||||
'type' => ServerType::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'env', 'virtual_ip',
|
||||
'ssh', 'infraweb_ip',
|
||||
'title', 'name', 'function',
|
||||
'comment',
|
||||
'type'
|
||||
];
|
||||
}
|
||||
10
app/Models/Servers.php
Normal file
10
app/Models/Servers.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Servers extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ServiceAccount extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'account', 'password', 'url'
|
||||
];
|
||||
}
|
||||
|
|
@ -2,13 +2,21 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
|
|
@ -16,34 +24,8 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
URL::forceScheme('https');
|
||||
|
||||
// * LOCAL FORCE eg: for Carbon
|
||||
// * Remove numeric to prevent float seperator to breaking numeric transactions
|
||||
\collect([\LC_TIME, \LC_MESSAGES, \LC_COLLATE, \LC_CTYPE, \LC_MONETARY])
|
||||
->map(function ($contant) {
|
||||
setlocale(
|
||||
$contant,
|
||||
\sprintf(
|
||||
'%s_%s.UTF-8',
|
||||
config('app.locale'),
|
||||
\strtoupper(config('app.locale'))
|
||||
)
|
||||
);
|
||||
});
|
||||
Carbon::setLocale(config('app.locale'));
|
||||
|
||||
// * Force bootstrap paginator
|
||||
Paginator::useBootstrap();
|
||||
|
||||
// * HA PROXY FIX
|
||||
app()->singleton('clientIp', function () {
|
||||
if (
|
||||
config('app.env') === 'local'
|
||||
) {
|
||||
return request()->getClientIp();
|
||||
}
|
||||
return request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp();
|
||||
});
|
||||
if (!app()->environment('local')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,18 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [];
|
||||
protected $policies = [
|
||||
// 'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
|
|
@ -21,5 +24,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
21
app/Providers/BroadcastServiceProvider.php
Normal file
21
app/Providers/BroadcastServiceProvider.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Aacotroneo\Saml2\Events\Saml2LoginEvent;
|
||||
use App\Models\User;
|
||||
use App\User;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
|
@ -19,6 +20,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -32,63 +34,21 @@ class EventServiceProvider extends ServiceProvider
|
|||
parent::boot();
|
||||
|
||||
Event::listen('Aacotroneo\Saml2\Events\Saml2LoginEvent', function (Saml2LoginEvent $event) {
|
||||
|
||||
$messageId = $event->getSaml2Auth()->getLastMessageId();
|
||||
// TODO : Add your own code preventing reuse of a $messageId to stop replay attacks
|
||||
|
||||
if (class_exists('Memcached')) {
|
||||
$cache = new \Memcached();
|
||||
$cache->addServer(
|
||||
config('cache.stores.memcached.servers.0.host'),
|
||||
config('cache.stores.memcached.servers.0.port')
|
||||
);
|
||||
|
||||
$fromCache = $cache->get(config('cache.prefix') . "_saml_message_id_" . $messageId);
|
||||
|
||||
if (!in_array($cache->getResultCode(), [\Memcached::RES_SUCCESS, \Memcached::RES_NOTFOUND])) {
|
||||
throw new \Exception(
|
||||
\sprintf(
|
||||
"SAML MESSAGE ID HANDLER - Memcached Error : %d - %s",
|
||||
$cache->getResultCode(),
|
||||
"https://www.php.net/manual/en/memcached.getresultcode.php"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($fromCache) {
|
||||
logger()->error(
|
||||
'SAML MESSAGE ID HANDLER',
|
||||
[
|
||||
'error' => 'Message ID : ' . $messageId . " replayed !"
|
||||
]
|
||||
);
|
||||
abort(403);
|
||||
} else {
|
||||
// Cache for 8h.
|
||||
$cache->set(config('cache.prefix') . "_saml_message_id_" . $messageId, $messageId, 28800);
|
||||
if ($cache->getResultCode() === \Memcached::RES_NOTSTORED) {
|
||||
throw new \Exception('SAML MESSAGE ID HANDLER - Memcached Error : NOT STORED');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new \Exception("SAML MESSAGE ID HANDLER - Memcached is missing");
|
||||
} //end if
|
||||
|
||||
$user = $event->getSaml2User();
|
||||
$user = $event->getSaml2User();
|
||||
$email = $user->getNameId();
|
||||
|
||||
$lUser = User::where('email', '=', $email)->first();
|
||||
|
||||
if (!$lUser) {
|
||||
abort(redirect()->route('unauthorized'));
|
||||
}
|
||||
|
||||
session(['sessionIndex' => $user->getSessionIndex()]);
|
||||
session(['nameId' => $email]);
|
||||
session(['tmpUserOTP' => $lUser]);
|
||||
|
||||
abort(redirect()->route('auth.verify'));
|
||||
});
|
||||
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
Event::listen('Aacotroneo\Saml2\Events\Saml2LogoutEvent', function ($event) {
|
||||
Auth::logout();
|
||||
Session::save();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Lib\LDC\MailjetSms;
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ class MailjetSmsServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +25,7 @@ class MailjetSmsServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->app->singleton('MailjetSms', function ($app) {
|
||||
App::singleton('MailjetSms', function ($app) {
|
||||
return new MailjetSms($app);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,18 +2,22 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -26,35 +30,51 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
//
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web-bo.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web-fo.php'));
|
||||
|
||||
Route::middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
public function map()
|
||||
{
|
||||
RateLimiter::for('web', function (Request $request) {
|
||||
return Limit::perMinute(150)->by(optional($request->user())->id ?: app('clientIp'));
|
||||
});
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(150)->by(optional($request->user())->id ?: app('clientIp'));
|
||||
});
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class TranslationServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
foreach ($this->collectLocalesStrings() as $locale) {
|
||||
// * Suported locales
|
||||
Cache::rememberForever(sprintf('translations.%s', $locale), function () use ($locale) {
|
||||
$translations = [
|
||||
'php' => $this->phpTranslations($locale),
|
||||
'json' => $this->jsonTranslations($locale),
|
||||
];
|
||||
return $translations;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather provided langs checking from files
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
private function collectLocalesStrings(): Collection
|
||||
{
|
||||
return collect(File::allFiles(resource_path('lang/')))->flatMap(function ($file) {
|
||||
if ($file->getRelativePath()) {
|
||||
return [$file->getRelativePath() => ''];
|
||||
}
|
||||
})->keys();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather all php translations
|
||||
*
|
||||
* @param string $locale
|
||||
* @return array
|
||||
*/
|
||||
private function phpTranslations(string $locale): array
|
||||
{
|
||||
$path = resource_path("lang/$locale");
|
||||
|
||||
return collect(File::allFiles($path))->flatMap(function ($file) use ($locale) {
|
||||
$translation = $file->getBasename('.php');
|
||||
return [$translation => trans($translation, [], $locale)];
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather json translations
|
||||
*
|
||||
* @param string $locale
|
||||
* @return array
|
||||
*/
|
||||
private function jsonTranslations(string $locale): array
|
||||
{
|
||||
$path = resource_path("lang/$locale.json");
|
||||
|
||||
if (is_string($path) && is_readable($path)) {
|
||||
return json_decode(file_get_contents($path), true) ?? [];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class CidrRule implements Rule
|
||||
{
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param mixed $attribute
|
||||
* @param mixed $value
|
||||
* @return boolean
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
// phpcs:enable
|
||||
$m = true;
|
||||
if (strpos($value, ":") !== false) {
|
||||
// * ipv6
|
||||
if (strpos($value, "/") !== false) {
|
||||
list($value, $mask) = explode("/", $value);
|
||||
|
||||
$m = filter_var(
|
||||
$mask,
|
||||
\FILTER_VALIDATE_INT,
|
||||
["options" => ["min_range" => 0, "max_range" => 128]]
|
||||
);
|
||||
}
|
||||
return $m && filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6);
|
||||
} else {
|
||||
// * ipv4
|
||||
if (strpos($value, "/") !== false) {
|
||||
list($value, $mask) = explode("/", $value);
|
||||
|
||||
$m = filter_var(
|
||||
$mask,
|
||||
\FILTER_VALIDATE_INT,
|
||||
["options" => ["min_range" => 0, "max_range" => 32]]
|
||||
);
|
||||
}
|
||||
return $m && filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4);
|
||||
} //end if
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return "The :attribute must be a valid IP address or CIDR range.";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
|
|
@ -15,12 +16,7 @@ class User extends Authenticatable
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'firstname',
|
||||
'lastname',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'equipe_web_member'
|
||||
'name', 'email', 'phone', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +34,6 @@ class User extends Authenticatable
|
|||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'equipe_web_member' => 'boolean',
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
|
@ -8,31 +8,25 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3",
|
||||
"php": "^7.2",
|
||||
"aacotroneo/laravel-saml2": "^2.1",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"fruitcake/laravel-cors": "^2.2",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.8",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/tinker": "^2.5",
|
||||
"kwaadpepper/exception-handler": "^0.0.6",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "^3.0",
|
||||
"lfkeitel/phptotp": " 1.0",
|
||||
"mews/purifier": "^3.3",
|
||||
"propaganistas/laravel-phone": "^4.3",
|
||||
"simplesoftwareio/simple-qrcode": "^4.2",
|
||||
"slevomat/coding-standard": "^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^3.3",
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"slevomat/coding-standard": "^7.2"
|
||||
"facade/ignition": "^2.3.6",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.0"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
|
|
|
|||
2059
composer.lock
generated
2059
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'key' => 'CE8S52Qq7stf5k8frF4T'
|
||||
];
|
||||
184
config/app.php
184
config/app.php
|
|
@ -3,53 +3,53 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool)env('APP_DEBUG', false),
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
|
@ -57,66 +57,66 @@ return [
|
|||
'asset_url' => env('ASSET_URL', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'Europe/Paris',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'fr',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
|
@ -124,14 +124,14 @@ return [
|
|||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
|
@ -139,7 +139,6 @@ return [
|
|||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
|
|
@ -170,25 +169,24 @@ return [
|
|||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\TranslationServiceProvider::class,
|
||||
App\Providers\MailjetSmsServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => [
|
||||
|
|
@ -229,6 +227,8 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'SmtpEnum' => App\Enums\Smtp::class,
|
||||
'ProjectTypesEnum' => App\Enums\ProjectTypes::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
119
config/auth.php
119
config/auth.php
|
|
@ -3,14 +3,14 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
|
|
@ -19,20 +19,20 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session", "token"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session", "token"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
|
|
@ -49,42 +49,47 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
'model' => App\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that the reset token should be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that the reset token should be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
|
|
@ -97,14 +102,14 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
|
|
|||
|
|
@ -3,29 +3,29 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "redis", "log", "null"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
|
|
|||
|
|
@ -5,30 +5,30 @@ use Illuminate\Support\Str;
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
|
@ -59,7 +59,9 @@ return [
|
|||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
|
|
@ -86,16 +88,16 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing a RAM based store such as APC or Memcached, there might
|
||||
| be other applications utilizing the same cache. So, we'll specify a
|
||||
| value to get prefixed to all our keys so we can avoid collisions.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing a RAM based store such as APC or Memcached, there might
|
||||
| be other applications utilizing the same cache. So, we'll specify a
|
||||
| value to get prefixed to all our keys so we can avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,44 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\DBAL\TimestampType;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
// * https://github.com/laravel/docs/blob/master/migrations.md#prerequisites .
|
||||
'dbal' => [
|
||||
'types' => [
|
||||
'timestamp' => TimestampType::class,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
|
@ -102,27 +94,27 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
|
@ -131,7 +123,7 @@ return [
|
|||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
|
|
|
|||
|
|
@ -3,42 +3,42 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cloud Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Many applications store files both locally and in the cloud. For this
|
||||
| reason, you may specify a default "cloud" driver here. This driver
|
||||
| will be bound as the Cloud disk implementation in the container.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cloud Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Many applications store files both locally and in the cloud. For this
|
||||
| reason, you may specify a default "cloud" driver here. This driver
|
||||
| will be bound as the Cloud disk implementation in the container.
|
||||
|
|
||||
*/
|
||||
|
||||
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been setup for each driver as an example of the required options.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been setup for each driver as an example of the required options.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
|
|
|||
|
|
@ -3,29 +3,29 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
|
|
@ -33,14 +33,14 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
|
|
|
|||
|
|
@ -7,31 +7,31 @@ use Monolog\Handler\SyslogUdpHandler;
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
|
|
|||
150
config/mail.php
150
config/mail.php
|
|
@ -3,56 +3,56 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
||||
| sending of e-mail. You may specify which one you're using throughout
|
||||
| your application here. By default, Laravel is setup for SMTP mail.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
||||
| sending of e-mail. You may specify which one you're using throughout
|
||||
| your application here. By default, Laravel is setup for SMTP mail.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may provide the host address of the SMTP server used by your
|
||||
| applications. A default option is provided that is compatible with
|
||||
| the Mailgun mail service which will provide reliable deliveries.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may provide the host address of the SMTP server used by your
|
||||
| applications. A default option is provided that is compatible with
|
||||
| the Mailgun mail service which will provide reliable deliveries.
|
||||
|
|
||||
*/
|
||||
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Port
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the SMTP port used by your application to deliver e-mails to
|
||||
| users of the application. Like the host we have set this value to
|
||||
| stay compatible with the Mailgun e-mail application by default.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Host Port
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the SMTP port used by your application to deliver e-mails to
|
||||
| users of the application. Like the host we have set this value to
|
||||
| stay compatible with the Mailgun e-mail application by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
|
|
@ -61,27 +61,27 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| E-Mail Encryption Protocol
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the encryption protocol that should be used when
|
||||
| the application send e-mail messages. A sensible default using the
|
||||
| transport layer security protocol should provide great security.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| E-Mail Encryption Protocol
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the encryption protocol that should be used when
|
||||
| the application send e-mail messages. A sensible default using the
|
||||
| transport layer security protocol should provide great security.
|
||||
|
|
||||
*/
|
||||
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Server Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your SMTP server requires a username for authentication, you should
|
||||
| set it here. This will get used to authenticate with your server on
|
||||
| connection. You may also set the "password" value below this one.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| SMTP Server Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your SMTP server requires a username for authentication, you should
|
||||
| set it here. This will get used to authenticate with your server on
|
||||
| connection. You may also set the "password" value below this one.
|
||||
|
|
||||
*/
|
||||
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
|
|
@ -89,27 +89,27 @@ return [
|
|||
'password' => env('MAIL_PASSWORD'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sendmail System Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "sendmail" driver to send e-mails, we will need to know
|
||||
| the path to where Sendmail lives on this server. A default path has
|
||||
| been provided here, which will work well on most of your systems.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Sendmail System Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "sendmail" driver to send e-mails, we will need to know
|
||||
| the path to where Sendmail lives on this server. A default path has
|
||||
| been provided here, which will work well on most of your systems.
|
||||
|
|
||||
*/
|
||||
|
||||
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
|
|
@ -121,14 +121,14 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using the "log" driver, you may specify the logging channel
|
||||
| if you prefer to keep mail messages separate from other log entries
|
||||
| for simpler reading. Otherwise, the default channel will be used.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using the "log" driver, you may specify the logging channel
|
||||
| if you prefer to keep mail messages separate from other log entries
|
||||
| for simpler reading. Otherwise, the default channel will be used.
|
||||
|
|
||||
*/
|
||||
|
||||
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
||||
|
|
|
|||
|
|
@ -3,29 +3,29 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
|
@ -69,14 +69,14 @@ return [
|
|||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
// If you choose to use ENV vars to define these values, give this IdP its own env var names
|
||||
// so you can define different values for each IdP, all starting with 'SAML2_'.$this_idp_env_id.
|
||||
// so you can define different values for each IdP, all starting with 'SAML2_'.$this_idp_env_id
|
||||
$this_idp_env_id = 'ldc';
|
||||
|
||||
// This is variable is for simplesaml example only.
|
||||
//This is variable is for simplesaml example only.
|
||||
// For real IdP, you must set the url values in the 'idp' config to conform to the IdP's real urls.
|
||||
$idp_host = env('SAML2_' . $this_idp_env_id . '_IDP_HOST', 'http://localhost:8000/simplesaml');
|
||||
$idp_host = env('SAML2_'.$this_idp_env_id.'_IDP_HOST', 'http://localhost:8000/simplesaml');
|
||||
|
||||
$settings = array(
|
||||
return $settings = array(
|
||||
|
||||
/*****
|
||||
* One Login Settings
|
||||
|
|
@ -18,34 +18,34 @@ $settings = array(
|
|||
// or unencrypted messages if it expects them signed or encrypted
|
||||
// Also will reject the messages if not strictly follow the SAML
|
||||
// standard: Destination, NameId, Conditions ... are validated too.
|
||||
'strict' => true,
|
||||
// TODO: make this depend on laravel config
|
||||
// Enable debug mode (to print errors).
|
||||
'strict' => true, //@todo: make this depend on laravel config
|
||||
|
||||
// Enable debug mode (to print errors)
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
|
||||
// Service Provider Data that we are deploying.
|
||||
// Service Provider Data that we are deploying
|
||||
'sp' => array(
|
||||
|
||||
// Specifies constraints on the name identifier to be used to
|
||||
// represent the requested subject.
|
||||
// Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported.
|
||||
// Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
|
||||
'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
|
||||
|
||||
// Usually x509cert and privateKey of the SP are provided by files placed at
|
||||
// the certs folder. But we can also provide them with the following parameters.
|
||||
'x509cert' => env('SAML2_' . $this_idp_env_id . '_SP_x509', ''),
|
||||
'privateKey' => env('SAML2_' . $this_idp_env_id . '_SP_PRIVATEKEY', ''),
|
||||
// the certs folder. But we can also provide them with the following parameters
|
||||
'x509cert' => env('SAML2_'.$this_idp_env_id.'_SP_x509',''),
|
||||
'privateKey' => env('SAML2_'.$this_idp_env_id.'_SP_PRIVATEKEY',''),
|
||||
|
||||
// Identifier (URI) of the SP entity.
|
||||
// Leave blank to use the '{idpName}_metadata' route, e.g. 'test_metadata'.
|
||||
'entityId' => env('SAML2_' . $this_idp_env_id . '_SP_ENTITYID', ''),
|
||||
'entityId' => env('SAML2_'.$this_idp_env_id.'_SP_ENTITYID',''),
|
||||
|
||||
// Specifies info about where and how the <AuthnResponse> message MUST be
|
||||
// returned to the requester, in this case our SP.
|
||||
'assertionConsumerService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned,
|
||||
// using HTTP-POST binding.
|
||||
// Leave blank to use the '{idpName}_acs' route, e.g. 'test_acs'.
|
||||
// Leave blank to use the '{idpName}_acs' route, e.g. 'test_acs'
|
||||
'url' => '',
|
||||
),
|
||||
// Specifies info about where and how the <Logout Response> message MUST be
|
||||
|
|
@ -54,36 +54,33 @@ $settings = array(
|
|||
'singleLogoutService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned,
|
||||
// using HTTP-Redirect binding.
|
||||
// Leave blank to use the '{idpName}_sls' route, e.g. 'test_sls'.
|
||||
// Leave blank to use the '{idpName}_sls' route, e.g. 'test_sls'
|
||||
'url' => '',
|
||||
),
|
||||
),
|
||||
|
||||
// Identity Provider Data that we want connect with our SP.
|
||||
// Identity Provider Data that we want connect with our SP
|
||||
'idp' => array(
|
||||
// Identifier of the IdP entity (must be a URI).
|
||||
'entityId' => env('SAML2_' . $this_idp_env_id . '_IDP_ENTITYID', $idp_host . '/saml2/idp/metadata.php'),
|
||||
// SSO endpoint info of the IdP. (Authentication Request protocol).
|
||||
// Identifier of the IdP entity (must be a URI)
|
||||
'entityId' => env('SAML2_'.$this_idp_env_id.'_IDP_ENTITYID', $idp_host . '/saml2/idp/metadata.php'),
|
||||
// SSO endpoint info of the IdP. (Authentication Request protocol)
|
||||
'singleSignOnService' => array(
|
||||
// URL Target of the IdP where the SP will send the Authentication Request Message,
|
||||
// using HTTP-Redirect binding.
|
||||
'url' => env('SAML2_' . $this_idp_env_id . '_IDP_SSO_URL', $idp_host . '/saml2/idp/SSOService.php'),
|
||||
'url' => env('SAML2_'.$this_idp_env_id.'_IDP_SSO_URL', $idp_host . '/saml2/idp/SSOService.php'),
|
||||
),
|
||||
// SLO endpoint info of the IdP.
|
||||
'singleLogoutService' => array(
|
||||
// URL Location of the IdP where the SP will send the SLO Request,
|
||||
// using HTTP-Redirect binding.
|
||||
'url' => env('SAML2_' . $this_idp_env_id . '_IDP_SL_URL', $idp_host . '/saml2/idp/SingleLogoutService.php'),
|
||||
'url' => env('SAML2_'.$this_idp_env_id.'_IDP_SL_URL', $idp_host . '/saml2/idp/SingleLogoutService.php'),
|
||||
),
|
||||
// Public x509 certificate of the IdP.
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'x509cert' => env('SAML2_' . $this_idp_env_id . '_IDP_x509', 'MIID/TCCAuWgAwIBAgIJAI4R3WyjjmB1MA0GCSqGSIb3DQEBCwUAMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjAeFw0xNDEyMDExNDM2MjVaFw0yNDExMzAxNDM2MjVaMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbzW/EpEv+qqZzfT1Buwjg9nnNNVrxkCfuR9fQiQw2tSouS5X37W5h7RmchRt54wsm046PDKtbSz1NpZT2GkmHN37yALW2lY7MyVUC7itv9vDAUsFr0EfKIdCKgxCKjrzkZ5ImbNvjxf7eA77PPGJnQ/UwXY7W+cvLkirp0K5uWpDk+nac5W0JXOCFR1BpPUJRbz2jFIEHyChRt7nsJZH6ejzNqK9lABEC76htNy1Ll/D3tUoPaqo8VlKW3N3MZE0DB9O7g65DmZIIlFqkaMH3ALd8adodJtOvqfDU/A6SxuwMfwDYPjoucykGDu1etRZ7dF2gd+W+1Pn7yizPT1q8CAwEAAaNQME4wHQYDVR0OBBYEFPsn8tUHN8XXf23ig5Qro3beP8BuMB8GA1UdIwQYMBaAFPsn8tUHN8XXf23ig5Qro3beP8BuMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGu60odWFiK+DkQekozGnlpNBQz5lQ/bwmOWdktnQj6HYXu43e7sh9oZWArLYHEOyMUekKQAxOK51vbTHzzw66BZU91/nqvaOBfkJyZKGfluHbD0/hfOl/D5kONqI9kyTu4wkLQcYGyuIi75CJs15uA03FSuULQdY/Liv+czS/XYDyvtSLnu43VuAQWN321PQNhuGueIaLJANb2C5qq5ilTBUw6PxY9Z+vtMjAjTJGKEkE/tQs7CvzLPKXX3KTD9lIILmX5yUC3dLgjVKi1KGDqNApYGOMtjr5eoxPQrqDBmyx3flcy0dQTdLXud3UjWVW3N0PYgJtw5yBsS74QTGD4='),
|
||||
|
||||
// Public x509 certificate of the IdP
|
||||
'x509cert' => env('SAML2_'.$this_idp_env_id.'_IDP_x509', 'MIID/TCCAuWgAwIBAgIJAI4R3WyjjmB1MA0GCSqGSIb3DQEBCwUAMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjAeFw0xNDEyMDExNDM2MjVaFw0yNDExMzAxNDM2MjVaMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbzW/EpEv+qqZzfT1Buwjg9nnNNVrxkCfuR9fQiQw2tSouS5X37W5h7RmchRt54wsm046PDKtbSz1NpZT2GkmHN37yALW2lY7MyVUC7itv9vDAUsFr0EfKIdCKgxCKjrzkZ5ImbNvjxf7eA77PPGJnQ/UwXY7W+cvLkirp0K5uWpDk+nac5W0JXOCFR1BpPUJRbz2jFIEHyChRt7nsJZH6ejzNqK9lABEC76htNy1Ll/D3tUoPaqo8VlKW3N3MZE0DB9O7g65DmZIIlFqkaMH3ALd8adodJtOvqfDU/A6SxuwMfwDYPjoucykGDu1etRZ7dF2gd+W+1Pn7yizPT1q8CAwEAAaNQME4wHQYDVR0OBBYEFPsn8tUHN8XXf23ig5Qro3beP8BuMB8GA1UdIwQYMBaAFPsn8tUHN8XXf23ig5Qro3beP8BuMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGu60odWFiK+DkQekozGnlpNBQz5lQ/bwmOWdktnQj6HYXu43e7sh9oZWArLYHEOyMUekKQAxOK51vbTHzzw66BZU91/nqvaOBfkJyZKGfluHbD0/hfOl/D5kONqI9kyTu4wkLQcYGyuIi75CJs15uA03FSuULQdY/Liv+czS/XYDyvtSLnu43VuAQWN321PQNhuGueIaLJANb2C5qq5ilTBUw6PxY9Z+vtMjAjTJGKEkE/tQs7CvzLPKXX3KTD9lIILmX5yUC3dLgjVKi1KGDqNApYGOMtjr5eoxPQrqDBmyx3flcy0dQTdLXud3UjWVW3N0PYgJtw5yBsS74QTGD4='),
|
||||
/*
|
||||
* Instead of use the whole x509cert you can use a fingerprint
|
||||
* (openssl x509 -noout -fingerprint -in "idp.crt" to generate it)
|
||||
*/
|
||||
|
||||
// 'certFingerprint' => '',
|
||||
),
|
||||
|
||||
|
|
@ -95,10 +92,10 @@ $settings = array(
|
|||
*
|
||||
*
|
||||
*/
|
||||
// Security settings.
|
||||
// Security settings
|
||||
'security' => array(
|
||||
|
||||
'signatureAlgorithm' => 'http://www.w3.org/2000/09/xmldsig#rsa-sha1',
|
||||
'signatureAlgorithm' => 'http://www.w3.org/2000/09/xmldsig#rsa-sha1',
|
||||
'digestAlgorithm' => 'http://www.w3.org/2000/09/xmldsig#sha1',
|
||||
|
||||
/** signatures and encryptions offered */
|
||||
|
|
@ -108,7 +105,7 @@ $settings = array(
|
|||
'nameIdEncrypted' => false,
|
||||
|
||||
// Indicates whether the <samlp:AuthnRequest> messages sent by this SP
|
||||
// will be signed. [The Metadata of the SP will offer this info].
|
||||
// will be signed. [The Metadata of the SP will offer this info]
|
||||
'authnRequestsSigned' => true,
|
||||
|
||||
// Indicates whether the <samlp:logoutRequest> messages sent by this SP
|
||||
|
|
@ -119,42 +116,37 @@ $settings = array(
|
|||
// will be signed.
|
||||
'logoutResponseSigned' => true,
|
||||
|
||||
/**
|
||||
* Sign the Metadata
|
||||
* False || True (use sp certs) || array (
|
||||
* keyFileName => 'metadata.key',
|
||||
* certFileName => 'metadata.crt'
|
||||
* )
|
||||
/* Sign the Metadata
|
||||
False || True (use sp certs) || array (
|
||||
keyFileName => 'metadata.key',
|
||||
certFileName => 'metadata.crt'
|
||||
)
|
||||
*/
|
||||
'signMetadata' => true,
|
||||
|
||||
|
||||
/** signatures and encryptions required */
|
||||
/** signatures and encryptions required **/
|
||||
|
||||
// Indicates a requirement for the <samlp:Response>, <samlp:LogoutRequest> and
|
||||
// <samlp:LogoutResponse> elements received by this SP to be signed.
|
||||
'wantMessagesSigned' => true,
|
||||
|
||||
// Indicates a requirement for the <saml:Assertion> elements received by
|
||||
// this SP to be signed. [The Metadata of the SP will offer this info].
|
||||
// this SP to be signed. [The Metadata of the SP will offer this info]
|
||||
'wantAssertionsSigned' => true,
|
||||
|
||||
// Indicates a requirement for the NameID received by
|
||||
// this SP to be encrypted.
|
||||
'wantNameIdEncrypted' => false,
|
||||
|
||||
/**
|
||||
* Authentication context.
|
||||
* Set to false and no AuthContext will be sent in the AuthNRequest,
|
||||
* Set true or don't present thi parameter and you will get an
|
||||
* AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
|
||||
* Set an array with the possible auth context values: array
|
||||
* ('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'),
|
||||
*/
|
||||
// Authentication context.
|
||||
// Set to false and no AuthContext will be sent in the AuthNRequest,
|
||||
// Set true or don't present thi parameter and you will get an AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
|
||||
// Set an array with the possible auth context values: array ('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'),
|
||||
'requestedAuthnContext' => false,
|
||||
),
|
||||
|
||||
// Contact information template, it is recommended to suply a technical and support contacts.
|
||||
// Contact information template, it is recommended to suply a technical and support contacts
|
||||
'contactPerson' => array(
|
||||
'technical' => array(
|
||||
'givenName' => 'Vincent BRIDIER',
|
||||
|
|
@ -166,7 +158,7 @@ $settings = array(
|
|||
),
|
||||
),
|
||||
|
||||
// Organization information template, the info in en_US lang is recomended, add more if required.
|
||||
// Organization information template, the info in en_US lang is recomended, add more if required
|
||||
'organization' => array(
|
||||
'fr-FR' => array(
|
||||
'name' => 'LDC',
|
||||
|
|
@ -175,16 +167,13 @@ $settings = array(
|
|||
),
|
||||
),
|
||||
|
||||
/*
|
||||
Interoperable SAML 2.0 Web Browser SSO Profile [saml2int] http://saml2int.org/profile/current
|
||||
/* Interoperable SAML 2.0 Web Browser SSO Profile [saml2int] http://saml2int.org/profile/current
|
||||
|
||||
'authnRequestsSigned' => false, // SP SHOULD NOT sign the <samlp:AuthnRequest>,
|
||||
'authnRequestsSigned' => false, // SP SHOULD NOT sign the <samlp:AuthnRequest>,
|
||||
// MUST NOT assume that the IdP validates the sign
|
||||
'wantAssertionsSigned' => true,
|
||||
'wantAssertionsEncrypted' => true, // MUST be enabled if SSL/HTTPs is disabled
|
||||
'wantNameIdEncrypted' => false,
|
||||
'wantAssertionsSigned' => true,
|
||||
'wantAssertionsEncrypted' => true, // MUST be enabled if SSL/HTTPs is disabled
|
||||
'wantNameIdEncrypted' => false,
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
return $settings;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
// If you choose to use ENV vars to define these values, give this IdP its own env var names
|
||||
// so you can define different values for each IdP, all starting with 'SAML2_'.$this_idp_env_id.
|
||||
// so you can define different values for each IdP, all starting with 'SAML2_'.$this_idp_env_id
|
||||
$this_idp_env_id = 'ldc';
|
||||
|
||||
// This is variable is for simplesaml example only.
|
||||
//This is variable is for simplesaml example only.
|
||||
// For real IdP, you must set the url values in the 'idp' config to conform to the IdP's real urls.
|
||||
$idp_host = env('SAML2_' . $this_idp_env_id . '_IDP_HOST', 'http://localhost:8000/simplesaml');
|
||||
$idp_host = env('SAML2_'.$this_idp_env_id.'_IDP_HOST', 'http://localhost:8000/simplesaml');
|
||||
|
||||
$settings = array(
|
||||
return $settings = array(
|
||||
|
||||
/*****
|
||||
* One Login Settings
|
||||
|
|
@ -18,34 +18,34 @@ $settings = array(
|
|||
// or unencrypted messages if it expects them signed or encrypted
|
||||
// Also will reject the messages if not strictly follow the SAML
|
||||
// standard: Destination, NameId, Conditions ... are validated too.
|
||||
'strict' => true,
|
||||
// TODO: make this depend on laravel config.
|
||||
// Enable debug mode (to print errors) .
|
||||
'strict' => true, //@todo: make this depend on laravel config
|
||||
|
||||
// Enable debug mode (to print errors)
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
|
||||
// Service Provider Data that we are deploying.
|
||||
// Service Provider Data that we are deploying
|
||||
'sp' => array(
|
||||
|
||||
// Specifies constraints on the name identifier to be used to
|
||||
// represent the requested subject.
|
||||
// Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported.
|
||||
// Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
|
||||
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
|
||||
|
||||
// Usually x509cert and privateKey of the SP are provided by files placed at
|
||||
// the certs folder. But we can also provide them with the following parameters.
|
||||
'x509cert' => env('SAML2_' . $this_idp_env_id . '_SP_x509', ''),
|
||||
'privateKey' => env('SAML2_' . $this_idp_env_id . '_SP_PRIVATEKEY', ''),
|
||||
// the certs folder. But we can also provide them with the following parameters
|
||||
'x509cert' => env('SAML2_'.$this_idp_env_id.'_SP_x509',''),
|
||||
'privateKey' => env('SAML2_'.$this_idp_env_id.'_SP_PRIVATEKEY',''),
|
||||
|
||||
// Identifier (URI) of the SP entity.
|
||||
// Leave blank to use the '{idpName}_metadata' route, e.g. 'test_metadata'.
|
||||
'entityId' => env('SAML2_' . $this_idp_env_id . '_SP_ENTITYID', ''),
|
||||
'entityId' => env('SAML2_'.$this_idp_env_id.'_SP_ENTITYID',''),
|
||||
|
||||
// Specifies info about where and how the <AuthnResponse> message MUST be
|
||||
// returned to the requester, in this case our SP.
|
||||
'assertionConsumerService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned,
|
||||
// using HTTP-POST binding.
|
||||
// Leave blank to use the '{idpName}_acs' route, e.g. 'test_acs'.
|
||||
// Leave blank to use the '{idpName}_acs' route, e.g. 'test_acs'
|
||||
'url' => '',
|
||||
),
|
||||
// Specifies info about where and how the <Logout Response> message MUST be
|
||||
|
|
@ -54,36 +54,33 @@ $settings = array(
|
|||
'singleLogoutService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned,
|
||||
// using HTTP-Redirect binding.
|
||||
// Leave blank to use the '{idpName}_sls' route, e.g. 'test_sls'.
|
||||
// Leave blank to use the '{idpName}_sls' route, e.g. 'test_sls'
|
||||
'url' => '',
|
||||
),
|
||||
),
|
||||
|
||||
// Identity Provider Data that we want connect with our SP.
|
||||
// Identity Provider Data that we want connect with our SP
|
||||
'idp' => array(
|
||||
// Identifier of the IdP entity (must be a URI).
|
||||
'entityId' => env('SAML2_' . $this_idp_env_id . '_IDP_ENTITYID', $idp_host . '/saml2/idp/metadata.php'),
|
||||
// SSO endpoint info of the IdP. (Authentication Request protocol).
|
||||
// Identifier of the IdP entity (must be a URI)
|
||||
'entityId' => env('SAML2_'.$this_idp_env_id.'_IDP_ENTITYID', $idp_host . '/saml2/idp/metadata.php'),
|
||||
// SSO endpoint info of the IdP. (Authentication Request protocol)
|
||||
'singleSignOnService' => array(
|
||||
// URL Target of the IdP where the SP will send the Authentication Request Message,
|
||||
// using HTTP-Redirect binding.
|
||||
'url' => env('SAML2_' . $this_idp_env_id . '_IDP_SSO_URL', $idp_host . '/saml2/idp/SSOService.php'),
|
||||
'url' => env('SAML2_'.$this_idp_env_id.'_IDP_SSO_URL', $idp_host . '/saml2/idp/SSOService.php'),
|
||||
),
|
||||
// SLO endpoint info of the IdP.
|
||||
'singleLogoutService' => array(
|
||||
// URL Location of the IdP where the SP will send the SLO Request,
|
||||
// using HTTP-Redirect binding.
|
||||
'url' => env('SAML2_' . $this_idp_env_id . '_IDP_SL_URL', $idp_host . '/saml2/idp/SingleLogoutService.php'),
|
||||
'url' => env('SAML2_'.$this_idp_env_id.'_IDP_SL_URL', $idp_host . '/saml2/idp/SingleLogoutService.php'),
|
||||
),
|
||||
// Public x509 certificate of the IdP.
|
||||
//phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'x509cert' => env('SAML2_' . $this_idp_env_id . '_IDP_x509', 'MIID/TCCAuWgAwIBAgIJAI4R3WyjjmB1MA0GCSqGSIb3DQEBCwUAMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjAeFw0xNDEyMDExNDM2MjVaFw0yNDExMzAxNDM2MjVaMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbzW/EpEv+qqZzfT1Buwjg9nnNNVrxkCfuR9fQiQw2tSouS5X37W5h7RmchRt54wsm046PDKtbSz1NpZT2GkmHN37yALW2lY7MyVUC7itv9vDAUsFr0EfKIdCKgxCKjrzkZ5ImbNvjxf7eA77PPGJnQ/UwXY7W+cvLkirp0K5uWpDk+nac5W0JXOCFR1BpPUJRbz2jFIEHyChRt7nsJZH6ejzNqK9lABEC76htNy1Ll/D3tUoPaqo8VlKW3N3MZE0DB9O7g65DmZIIlFqkaMH3ALd8adodJtOvqfDU/A6SxuwMfwDYPjoucykGDu1etRZ7dF2gd+W+1Pn7yizPT1q8CAwEAAaNQME4wHQYDVR0OBBYEFPsn8tUHN8XXf23ig5Qro3beP8BuMB8GA1UdIwQYMBaAFPsn8tUHN8XXf23ig5Qro3beP8BuMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGu60odWFiK+DkQekozGnlpNBQz5lQ/bwmOWdktnQj6HYXu43e7sh9oZWArLYHEOyMUekKQAxOK51vbTHzzw66BZU91/nqvaOBfkJyZKGfluHbD0/hfOl/D5kONqI9kyTu4wkLQcYGyuIi75CJs15uA03FSuULQdY/Liv+czS/XYDyvtSLnu43VuAQWN321PQNhuGueIaLJANb2C5qq5ilTBUw6PxY9Z+vtMjAjTJGKEkE/tQs7CvzLPKXX3KTD9lIILmX5yUC3dLgjVKi1KGDqNApYGOMtjr5eoxPQrqDBmyx3flcy0dQTdLXud3UjWVW3N0PYgJtw5yBsS74QTGD4='),
|
||||
|
||||
// Public x509 certificate of the IdP
|
||||
'x509cert' => env('SAML2_'.$this_idp_env_id.'_IDP_x509', 'MIID/TCCAuWgAwIBAgIJAI4R3WyjjmB1MA0GCSqGSIb3DQEBCwUAMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjAeFw0xNDEyMDExNDM2MjVaFw0yNDExMzAxNDM2MjVaMIGUMQswCQYDVQQGEwJBUjEVMBMGA1UECAwMQnVlbm9zIEFpcmVzMRUwEwYDVQQHDAxCdWVub3MgQWlyZXMxDDAKBgNVBAoMA1NJVTERMA8GA1UECwwIU2lzdGVtYXMxFDASBgNVBAMMC09yZy5TaXUuQ29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbmlAc2l1LmVkdS5hcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbzW/EpEv+qqZzfT1Buwjg9nnNNVrxkCfuR9fQiQw2tSouS5X37W5h7RmchRt54wsm046PDKtbSz1NpZT2GkmHN37yALW2lY7MyVUC7itv9vDAUsFr0EfKIdCKgxCKjrzkZ5ImbNvjxf7eA77PPGJnQ/UwXY7W+cvLkirp0K5uWpDk+nac5W0JXOCFR1BpPUJRbz2jFIEHyChRt7nsJZH6ejzNqK9lABEC76htNy1Ll/D3tUoPaqo8VlKW3N3MZE0DB9O7g65DmZIIlFqkaMH3ALd8adodJtOvqfDU/A6SxuwMfwDYPjoucykGDu1etRZ7dF2gd+W+1Pn7yizPT1q8CAwEAAaNQME4wHQYDVR0OBBYEFPsn8tUHN8XXf23ig5Qro3beP8BuMB8GA1UdIwQYMBaAFPsn8tUHN8XXf23ig5Qro3beP8BuMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGu60odWFiK+DkQekozGnlpNBQz5lQ/bwmOWdktnQj6HYXu43e7sh9oZWArLYHEOyMUekKQAxOK51vbTHzzw66BZU91/nqvaOBfkJyZKGfluHbD0/hfOl/D5kONqI9kyTu4wkLQcYGyuIi75CJs15uA03FSuULQdY/Liv+czS/XYDyvtSLnu43VuAQWN321PQNhuGueIaLJANb2C5qq5ilTBUw6PxY9Z+vtMjAjTJGKEkE/tQs7CvzLPKXX3KTD9lIILmX5yUC3dLgjVKi1KGDqNApYGOMtjr5eoxPQrqDBmyx3flcy0dQTdLXud3UjWVW3N0PYgJtw5yBsS74QTGD4='),
|
||||
/*
|
||||
* Instead of use the whole x509cert you can use a fingerprint
|
||||
* (openssl x509 -noout -fingerprint -in "idp.crt" to generate it)
|
||||
*/
|
||||
|
||||
// 'certFingerprint' => '',
|
||||
),
|
||||
|
||||
|
|
@ -95,7 +92,7 @@ $settings = array(
|
|||
*
|
||||
*
|
||||
*/
|
||||
// Security settings.
|
||||
// Security settings
|
||||
'security' => array(
|
||||
|
||||
/** signatures and encryptions offered */
|
||||
|
|
@ -104,10 +101,8 @@ $settings = array(
|
|||
// will be encrypted.
|
||||
'nameIdEncrypted' => false,
|
||||
|
||||
/**
|
||||
* Indicates whether the <samlp:AuthnRequest> messages sent by this SP
|
||||
* will be signed. [The Metadata of the SP will offer this info]
|
||||
*/
|
||||
// Indicates whether the <samlp:AuthnRequest> messages sent by this SP
|
||||
// will be signed. [The Metadata of the SP will offer this info]
|
||||
'authnRequestsSigned' => false,
|
||||
|
||||
// Indicates whether the <samlp:logoutRequest> messages sent by this SP
|
||||
|
|
@ -118,46 +113,37 @@ $settings = array(
|
|||
// will be signed.
|
||||
'logoutResponseSigned' => false,
|
||||
|
||||
/**
|
||||
* Sign the Metadata
|
||||
* False || True (use sp certs) || array (
|
||||
* keyFileName => 'metadata.key',
|
||||
* certFileName => 'metadata.crt'
|
||||
* )
|
||||
/* Sign the Metadata
|
||||
False || True (use sp certs) || array (
|
||||
keyFileName => 'metadata.key',
|
||||
certFileName => 'metadata.crt'
|
||||
)
|
||||
*/
|
||||
'signMetadata' => false,
|
||||
|
||||
|
||||
/** signatures and encryptions required */
|
||||
/** signatures and encryptions required **/
|
||||
|
||||
// Indicates a requirement for the <samlp:Response>, <samlp:LogoutRequest> and
|
||||
// <samlp:LogoutResponse> elements received by this SP to be signed.
|
||||
'wantMessagesSigned' => false,
|
||||
|
||||
/**
|
||||
* Indicates a requirement for the <saml:Assertion> elements received by
|
||||
* this SP to be signed.
|
||||
* [The Metadata of the SP will offer this info]
|
||||
* */
|
||||
// Indicates a requirement for the <saml:Assertion> elements received by
|
||||
// this SP to be signed. [The Metadata of the SP will offer this info]
|
||||
'wantAssertionsSigned' => false,
|
||||
|
||||
// Indicates a requirement for the NameID received by
|
||||
// this SP to be encrypted.
|
||||
'wantNameIdEncrypted' => false,
|
||||
|
||||
/**
|
||||
* Authentication context.
|
||||
* Set to false and no AuthContext will be sent in the AuthNRequest,
|
||||
* Set true or don't present thi parameter and you will get an
|
||||
* AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
|
||||
* Set an array with the possible auth context values: array
|
||||
* ('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'),
|
||||
*/
|
||||
|
||||
// Authentication context.
|
||||
// Set to false and no AuthContext will be sent in the AuthNRequest,
|
||||
// Set true or don't present thi parameter and you will get an AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
|
||||
// Set an array with the possible auth context values: array ('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'),
|
||||
'requestedAuthnContext' => true,
|
||||
),
|
||||
|
||||
// Contact information template, it is recommended to suply a technical and support contacts.
|
||||
// Contact information template, it is recommended to suply a technical and support contacts
|
||||
'contactPerson' => array(
|
||||
'technical' => array(
|
||||
'givenName' => 'name',
|
||||
|
|
@ -169,7 +155,7 @@ $settings = array(
|
|||
),
|
||||
),
|
||||
|
||||
// Organization information template, the info in en_US lang is recomended, add more if required.
|
||||
// Organization information template, the info in en_US lang is recomended, add more if required
|
||||
'organization' => array(
|
||||
'en-US' => array(
|
||||
'name' => 'Name',
|
||||
|
|
@ -178,16 +164,13 @@ $settings = array(
|
|||
),
|
||||
),
|
||||
|
||||
/*
|
||||
Interoperable SAML 2.0 Web Browser SSO Profile [saml2int] http://saml2int.org/profile/current
|
||||
/* Interoperable SAML 2.0 Web Browser SSO Profile [saml2int] http://saml2int.org/profile/current
|
||||
|
||||
'authnRequestsSigned' => false, // SP SHOULD NOT sign the <samlp:AuthnRequest>,
|
||||
'authnRequestsSigned' => false, // SP SHOULD NOT sign the <samlp:AuthnRequest>,
|
||||
// MUST NOT assume that the IdP validates the sign
|
||||
'wantAssertionsSigned' => true,
|
||||
'wantAssertionsEncrypted' => true, // MUST be enabled if SSL/HTTPs is disabled
|
||||
'wantNameIdEncrypted' => false,
|
||||
'wantAssertionsSigned' => true,
|
||||
'wantAssertionsEncrypted' => true, // MUST be enabled if SSL/HTTPs is disabled
|
||||
'wantNameIdEncrypted' => false,
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
return $settings;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$settings = array(
|
||||
return $settings = array(
|
||||
|
||||
/**
|
||||
* Array of IDP prefixes to be configured e.g. 'idpNames' => ['test1', 'test2', 'test3'],
|
||||
|
|
@ -58,8 +58,15 @@ $settings = array(
|
|||
// e.g X-Forwarded-Proto / HTTP_X_FORWARDED_PROTO. This is useful if
|
||||
// your application is running behind a load balancer which terminates
|
||||
// SSL.
|
||||
// LDC WEB SET FALSE IF LOCAL.
|
||||
// LDC WEB SET FALSE IF LOCAL
|
||||
'proxyVars' => true,
|
||||
);
|
||||
|
||||
return $settings;
|
||||
/**
|
||||
* (Optional) Which class implements the route functions.
|
||||
* If commented out, defaults to this lib's controller (Aacotroneo\Saml2\Http\Controllers\Saml2Controller).
|
||||
* If you need to extend Saml2Controller (e.g. to override the `login()` function to pass
|
||||
* a `$returnTo` argument), this value allows you to pass your own controller, and have
|
||||
* it used in the routes definition.
|
||||
*/
|
||||
// 'saml2_controller' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
|
|
|
|||
|
|
@ -5,30 +5,30 @@ use Illuminate\Support\Str;
|
|||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
|
@ -36,92 +36,92 @@ return [
|
|||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "apc", "memcached", or "dynamodb" session drivers you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "apc", "memcached", or "dynamodb" session drivers you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
|
|
@ -130,70 +130,70 @@ return [
|
|||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you if it can not be done securely.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you if it can not be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| do not enable this as other CSRF protection services are in place.
|
||||
|
|
||||
| Supported: "lax", "strict", "none"
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| do not enable this as other CSRF protection services are in place.
|
||||
|
|
||||
| Supported: "lax", "strict", "none"
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
'same_site' => null,
|
||||
|
||||
];
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue