This removes api authentification with token in favor of signature method. Refactorize code and clean up. It add more unit test plus code coverage in test/converage. - Added config.api.timestampTimeout - Added Helper::signRequest This calculates the request signature - Added more unit tests and extend code coverage. - Added rate limiter for web routes - Added RemoveSpaces Sanitizer on api requests - Added stress test suite - Changed AuthServiceProvider api-token to api-hmac - Changed CustomerSeeder to have at least of customer activated (for unit tests) - Changed used transation for saveing multiple models - Changed, in ServiceController generateApiToken to generateServicePassword - Changed, timestamp has to be send in request with a DateTime format, it also has to a UTC value - Composer added brianium/paratest - Composer update - Fixed case where removing single optin could be the wrong one (not for the good service) - Fixed customer delete - Fixed customer would not be resolved by brand. - Fixed Really check that request is json checking body content, preventing sending malformed requests - Remove ApiError::needAuth - Removed api_token - Removed ApiController::authenticate - Removed config.api.tokenTimeout - Removed Header check or usage because of HAProxy doing weird stuff - Removed lock files from gitignore - Removed memcached dependency - Removed unused questions resources api routes - Removed workspace file Migrations - Added unique index on services.bearer_token - Changed customer_id on customer_answer is nullable - Changed services.bearer_pwd length to 312 (the size of the token) - Dropped services.api_token and service.api_token_date
72 lines
3.3 KiB
PHP
72 lines
3.3 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\AnswerController;
|
|
use App\Http\Controllers\BrandController;
|
|
use App\Http\Controllers\CustomerController;
|
|
use App\Http\Controllers\LoginController;
|
|
use App\Http\Controllers\QuestionController;
|
|
use App\Http\Controllers\ServiceController;
|
|
use App\Http\Controllers\SingleOptinController;
|
|
use App\Http\Controllers\StatsController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
*/
|
|
|
|
Route::get('/login', [LoginController::class, 'index'])->name('login');
|
|
Route::post('/login', [LoginController::class, 'authenticate'])->name('authenticate');
|
|
Route::middleware(['auth'])->group(function () {
|
|
Route::get('/', function () {
|
|
return redirect()->route('brands.index');
|
|
})->name('home');
|
|
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');
|
|
|
|
// * Marques
|
|
Route::resource('brands', BrandController::class)->except([
|
|
'delete'
|
|
]);
|
|
Route::match(['get', 'post'], '/brand/manage/{brand?}', [BrandController::class, 'manage'])
|
|
->name('manage-brand');
|
|
|
|
// * Services
|
|
Route::resource('services', ServiceController::class)->except([
|
|
'delete'
|
|
]);
|
|
Route::post('/services/{service}/token/generate', [ServiceController::class, 'generateServicePassword'])
|
|
->name('generate-token-service');
|
|
|
|
// * Clients
|
|
Route::get('/customers', [CustomerController::class, 'index'])->name('customers.index');
|
|
Route::get('/customers/{customer}/{brand}', [CustomerController::class, 'show'])->name('customers.show');
|
|
Route::delete('/customers/{customer}/{brand}', [CustomerController::class, 'delete'])->name('customers.delete');
|
|
Route::get('/customers/export', [CustomerController::class, 'export'])->name('customers.export');
|
|
Route::post('/customers/export', [CustomerController::class, 'exportSubmit'])->name('customers.exportSubmit');
|
|
|
|
// * Single optins
|
|
Route::resource('single_optins', SingleOptinController::class);
|
|
Route::post('/single_optins/{id}/delete', [SingleOptinController::class, 'delete'])->name('single-optins-delete');
|
|
|
|
// * Questions
|
|
Route::get('/questions/export', [QuestionController::class, 'export'])->name('questions.export');
|
|
Route::post('/questions/export', [QuestionController::class, 'exportSubmit'])->name('questions.exportSubmit');
|
|
Route::resource('questions', QuestionController::class);
|
|
Route::resource('questions.answers', AnswerController::class);
|
|
|
|
// * Stats
|
|
Route::match(['get', 'post'], '/stats/brand', [StatsController::class, 'viewStatsByBrand'])
|
|
->name('stats.viewByBrand');
|
|
Route::get('/stats/brand/csv', [StatsController::class, 'exportByBrandCsv'])
|
|
->name('stats.viewByBrandExportCsv');
|
|
Route::match(['get', 'post'], '/stats/question', [StatsController::class, 'viewByQuestion'])
|
|
->name('stats.viewByQuestion');
|
|
Route::get('/stats/question/csv', [StatsController::class, 'exportByQuestionCsv'])
|
|
->name('stats.viewByQuestionExportCSV');
|
|
});
|