ajout param enabled 2fa, trusted headers
Some checks failed
Cadoles/hydra-sql/pipeline/head There was a failure building this commit
Some checks failed
Cadoles/hydra-sql/pipeline/head There was a failure building this commit
This commit is contained in:
3
.env
3
.env
@@ -45,4 +45,5 @@ ALTCHA_DELAY=100
|
|||||||
ALTCHA_MOCK_ERROR=false
|
ALTCHA_MOCK_ERROR=false
|
||||||
ALTCHA_ENABLED=true
|
ALTCHA_ENABLED=true
|
||||||
|
|
||||||
ENABLED_2FA=true
|
ENABLED_2FA=true
|
||||||
|
URL_2FA=http://localhost:8070/2fa
|
34
compose.yml
34
compose.yml
@@ -123,17 +123,17 @@ services:
|
|||||||
- postgres:/var/lib/pgsql/data
|
- postgres:/var/lib/pgsql/data
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
|
||||||
pgadmin:
|
# pgadmin:
|
||||||
image: dpage/pgadmin4
|
# image: dpage/pgadmin4
|
||||||
ports:
|
# ports:
|
||||||
- 8085:80
|
# - 8085:80
|
||||||
restart: always
|
# restart: always
|
||||||
environment:
|
# environment:
|
||||||
PGADMIN_DEFAULT_EMAIL: admin@admin.com
|
# PGADMIN_DEFAULT_EMAIL: admin@admin.com
|
||||||
PGADMIN_DEFAULT_PASSWORD: admin
|
# PGADMIN_DEFAULT_PASSWORD: admin
|
||||||
PGADMIN_SERVER_JSON_FILE: /pgadminfile/server.json
|
# PGADMIN_SERVER_JSON_FILE: /pgadminfile/server.json
|
||||||
volumes:
|
# volumes:
|
||||||
- ./misc/compose/pgadmin:/pgadminfile/:ro
|
# - ./misc/compose/pgadmin:/pgadminfile/:ro
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.10
|
image: mariadb:10.10
|
||||||
environment:
|
environment:
|
||||||
@@ -169,7 +169,17 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8070:80" # Mappe le port 80 du conteneur sur 8081 de l'hôte
|
- "8070:80" # Mappe le port 80 du conteneur sur 8081 de l'hôte
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb # Si tu utilises la DB partagée
|
- postgres # Si tu utilises la DB partagée
|
||||||
|
pgweb:
|
||||||
|
container_name: pgweb
|
||||||
|
restart: always
|
||||||
|
image: sosedoff/pgweb
|
||||||
|
ports:
|
||||||
|
- "8095:8081"
|
||||||
|
environment:
|
||||||
|
- PGWEB_DATABASE_URL=postgres://lasql:lasql@postgres:5432/lasql?sslmode=disable
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
volumes:
|
volumes:
|
||||||
postgres:
|
postgres:
|
||||||
mariadb:
|
mariadb:
|
||||||
|
@@ -29,7 +29,14 @@ framework:
|
|||||||
php_errors:
|
php_errors:
|
||||||
log: true
|
log: true
|
||||||
error_controller: App\Controller\CustomErrorController::show
|
error_controller: App\Controller\CustomErrorController::show
|
||||||
|
trusted_headers:
|
||||||
|
[
|
||||||
|
"x-forwarded-for",
|
||||||
|
"x-forwarded-host",
|
||||||
|
"x-forwarded-proto",
|
||||||
|
"x-forwarded-port",
|
||||||
|
"x-forwarded-prefix",
|
||||||
|
]
|
||||||
when@test:
|
when@test:
|
||||||
framework:
|
framework:
|
||||||
test: true
|
test: true
|
||||||
|
@@ -53,6 +53,7 @@ services:
|
|||||||
$baseUrl: '%base_url%'
|
$baseUrl: '%base_url%'
|
||||||
App\Controller\MainController:
|
App\Controller\MainController:
|
||||||
arguments:
|
arguments:
|
||||||
|
$url2fa: '%env(string:URL_2FA)%'
|
||||||
$enabled2fa: '%env(bool:ENABLED_2FA)%'
|
$enabled2fa: '%env(bool:ENABLED_2FA)%'
|
||||||
App\SQLLogin\SQLLoginRequest:
|
App\SQLLogin\SQLLoginRequest:
|
||||||
arguments:
|
arguments:
|
||||||
|
@@ -21,6 +21,7 @@ class MainController extends AbstractController
|
|||||||
private readonly RequestStack $requestStack,
|
private readonly RequestStack $requestStack,
|
||||||
private readonly HydraService $hydra,
|
private readonly HydraService $hydra,
|
||||||
private readonly Client $client,
|
private readonly Client $client,
|
||||||
|
private readonly string $url2fa,
|
||||||
private readonly bool $enabled2fa
|
private readonly bool $enabled2fa
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -43,8 +44,6 @@ class MainController extends AbstractController
|
|||||||
#[Route('/connect/login-accept', name: 'app_login_accept', methods: ['GET'])]
|
#[Route('/connect/login-accept', name: 'app_login_accept', methods: ['GET'])]
|
||||||
public function loginAccept(SQLLoginRequest $sqlLoginRequest): RedirectResponse
|
public function loginAccept(SQLLoginRequest $sqlLoginRequest): RedirectResponse
|
||||||
{
|
{
|
||||||
dd($this->enabled2fa);
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if (!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
@@ -64,6 +63,9 @@ class MainController extends AbstractController
|
|||||||
$subject = $expressionLanguage->evaluate($subjectRewriteExpression, $user->getAttributes());
|
$subject = $expressionLanguage->evaluate($subjectRewriteExpression, $user->getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->url2fa) {
|
||||||
|
return $this->redirect($this->url2fa.'?loginchallenge='.$challenge.'&identifier='.$subject);
|
||||||
|
}
|
||||||
$loginAcceptRes = $this->client->acceptLoginRequest($challenge, [
|
$loginAcceptRes = $this->client->acceptLoginRequest($challenge, [
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'remember' => true,
|
'remember' => true,
|
||||||
|
Reference in New Issue
Block a user