From ac374b7a77790577428052c7c9806e2a342554f7 Mon Sep 17 00:00:00 2001 From: Lucas Pirola Date: Fri, 22 Nov 2024 17:41:22 -0300 Subject: [PATCH] Habilita login com gov br --- .env.sample | 7 +++++++ config/authentication.php | 30 ++++++++++++++++++++++++++++-- config/plugins.php | 8 ++++---- docker-compose.yml | 5 +++++ 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/.env.sample b/.env.sample index 6f760ec3da..63007c922f 100644 --- a/.env.sample +++ b/.env.sample @@ -36,3 +36,10 @@ AUTH_EMAIL_IMAGE= AUTH_LOGIN_ON_REGISTER=true STATUS_CREATE_AGENT=1 AUTH_LOGIN_BY_CPF=false + + +AUTH_SALT=0123456789 +AUTH_GOV_BR_CLIENT_ID=xxxxxxxxxx +AUTH_GOV_BR_CLIENT_SECRET=fdsafdsafdsa +AUTH_GOV_BR_ID="true" +AUTH_GOV_BR_SCOPE="openid email profile phone govbr_confiabilidades" diff --git a/config/authentication.php b/config/authentication.php index b6e52841c1..56d8c2bbb3 100644 --- a/config/authentication.php +++ b/config/authentication.php @@ -13,12 +13,38 @@ 'wizard' => 'true', 'timeout' => '24 hours', 'strategies' => [ - 'Facebook' => [ + 'govbr' => [ + 'client_id' => env('AUTH_GOV_BR_CLIENT_ID', null), + 'client_secret' => env('AUTH_GOV_BR_CLIENT_SECRET', null), + 'scope' => env('AUTH_GOV_BR_SCOPE', 'openid email profile phone govbr_confiabilidades'), + 'visible' => env('AUTH_GOV_BR_ID', true), + 'response_type' => 'code', + 'scope' => 'openid email profile phone govbr_confiabilidades', + 'redirect_uri' => 'https://experimente-minc.mapas.tec.br/autenticacao/govbr/oauth2callback', + 'auth_endpoint' => 'https://sso.staging.acesso.gov.br/authorize', + 'token_endpoint' => 'https://sso.staging.acesso.gov.br/token', + 'nonce' => 'abc', + 'code_challenge_method' => 'S256', + 'userinfo_endpoint' => 'https://sso.staging.acesso.gov.br/jwk', + 'state_salt' => "mapasminc", + 'applySealId' => 1, + 'menssagem_authenticated' => "", + 'dic_agent_fields_update' => [ + 'nomeCompleto' => 'full_name', + 'name' => 'name', + 'documento' => 'cpf', + 'cpf' => 'cpf', + 'emailPrivado' => 'email', + 'telefone1' => 'phone_number', + ] + ], + + 'Facebook' => [ 'app_id' => env('AUTH_FACEBOOK_APP_ID', null), 'app_secret' => env('AUTH_FACEBOOK_APP_SECRET', null), 'scope' => env('AUTH_FACEBOOK_SCOPE', 'email'), ], - + 'Google' => [ 'client_id' => env('AUTH_GOOGLE_CLIENT_ID', null), 'client_secret' => env('AUTH_GOOGLE_CLIENT_SECRET', null), diff --git a/config/plugins.php b/config/plugins.php index 0e3279ecc1..56beb32f7e 100644 --- a/config/plugins.php +++ b/config/plugins.php @@ -2,9 +2,9 @@ return [ 'plugins' => [ - 'MultipleLocalAuth', - 'AdminLoginAsUser', - 'RecreatePCacheOnLogin', - 'SpamDetector' + 'MultipleLocalAuth', + 'AdminLoginAsUser', + 'RecreatePCacheOnLogin', + 'SpamDetector' ] ]; diff --git a/docker-compose.yml b/docker-compose.yml index eeab7a51eb..e0e3d6dbd0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,11 @@ x-defaults: &defaults AUTH_LOGIN_ON_REGISTER: ${AUTH_LOGIN_ON_REGISTER} STATUS_CREATE_AGENT: ${STATUS_CREATE_AGENT} AUTH_LOGIN_BY_CPF: ${AUTH_LOGIN_BY_CPF} + AUTH_SALT: ${AUTH_SALT} + AUTH_GOV_BR_ID: ${AUTH_GOV_BR_ID} + AUTH_GOV_BR_CLIENT_ID: ${AUTH_GOV_BR_CLIENT_ID} + AUTH_GOV_BR_CLIENT_SECRET: ${AUTH_GOV_BR_CLIENT_SECRET} + AUTH_GOV_BR_SCOPE: ${AUTH_GOV_BR_SCOPE} services: backend: