54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Internal;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 토큰 교환 요청 검증
|
||
|
|
*/
|
||
|
|
class ExchangeTokenRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'user_id' => ['required', 'integer', 'min:1'],
|
||
|
|
'tenant_id' => ['required', 'integer', 'min:1'],
|
||
|
|
'exp' => ['required', 'integer', 'min:1'],
|
||
|
|
'signature' => ['required', 'string', 'size:64'], // SHA256 hex = 64 chars
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get custom messages for validator errors.
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'user_id.required' => __('validation.required', ['attribute' => 'user_id']),
|
||
|
|
'user_id.integer' => __('validation.integer', ['attribute' => 'user_id']),
|
||
|
|
'tenant_id.required' => __('validation.required', ['attribute' => 'tenant_id']),
|
||
|
|
'tenant_id.integer' => __('validation.integer', ['attribute' => 'tenant_id']),
|
||
|
|
'exp.required' => __('validation.required', ['attribute' => 'exp']),
|
||
|
|
'exp.integer' => __('validation.integer', ['attribute' => 'exp']),
|
||
|
|
'signature.required' => __('validation.required', ['attribute' => 'signature']),
|
||
|
|
'signature.size' => __('validation.size.string', ['attribute' => 'signature', 'size' => 64]),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|