-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/fix blazor references #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 62 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
a0e4b37
Refactor: Move Shared models to Contracts to fix Blazor WASM references
e29c50b
Fix: Remove redundant using directives for Contracts.Models
1562ac3
Fix: Remove remaining duplicate using directives in Modules
a162d28
Fix(Auth): Update admin role mapping and add safety tests
1fe00eb
Chore: Add auth diagnostics middleware
0302227
Fix: Update namespace references and add debug auth constants
2ac5c46
Refactor: Complete code review fixes - RoleNames constants, localizat…
8ed5e98
Fix: Re-add Shared.Utilities.Constants for ValidationConstants access
41f3d7a
Fix: Add missing AuthConstants using statements in middleware and ext…
e19ebad
feat: Implement security extensions for environment-specific authenti…
a09f6ca
fix: resolve authorization 403 errors by registering KeycloakPermissi…
d8aa569
test: fix 7 failing unit tests to expect Portuguese error messages
e400389
refactor: implement code review fixes for security and authorization
1600a03
feat: Implement Keycloak-based user permission resolution and add a q…
7ca1371
test: fix GetProvidersByIdsQueryHandlerTests to expect Portuguese err…
029607d
feat: Add PII masking utility and architecture tests for the authoriz…
d77b12f
feat: Introduce multiple provider query handlers with unit tests and …
788516d
feat: introduce `GetProvidersByStateQueryHandler` with dedicated unit…
b3972c8
feat: introduce BaseApiTest as a base class for integration tests, pr…
1e0ffdf
feat: Add base test authentication handler and application startup di…
7046cf5
feat: Add `BaseTestAuthenticationHandler` for configurable test authe…
370d9c8
feat: Introduce `TestContainerFixture` to manage shared TestContainer…
1ec304a
Fix: Global API Protocol Mismatch (500) and Route Mismatch (404). Bac…
7f788ff
fix: align Allowed Cities DTOs between frontend and backend
d74a58a
fix: address code review comments and fix unit tests
7852909
chore: remove accidental test_results.txt
bafd3ed
feat: introduce service and service category management operations, l…
fb77921
feat: Introduce centralized validation messages, an admin endpoint fo…
d535fb1
feat: Implement service and service category command handlers and the…
6744fa3
feat: Add integration and unit tests for Providers, Users, Service Ca…
619280e
feat: Add comprehensive unit and integration tests for ServiceCatalog…
14dc43f
feat: add integration tests for Providers and ServiceCatalogs modules…
77ad1ce
feat: Introduce comprehensive integration and end-to-end tests for mu…
929a92b
feat: Introduce E2E tests and a standardized HTTP status code convent…
df88701
feat: Add E2E tests for the Providers module covering CRUD, workflow,…
53eaa8b
feat: introduce AllowedCity entity and add unit tests for provider pr…
45ebaf8
test(allowedcity): add unit tests for AllowedCity entity constructor,…
6e1f4ee
test: add unit tests for provider and service command handlers.
9075979
feat: Add unit tests for shared components, endpoint extensions, exce…
aac2aac
feat: Implement provider activation command handler and add unit test…
50f3495
feat: implement E2E tests to verify correct HTTP status codes for val…
3a3bdd7
feat: Implement AllowedCity entity with full CRUD operations and add …
8ef0d75
feat: Implement AllowedCity entity with full CRUD, activation, and de…
e6afe09
feat: Implement service creation dialog with Fluxor actions and E2E t…
f95c2a2
feat: Add comprehensive unit tests for `EndpointExtensions` covering …
819e31f
feat: Implement creation and update of allowed cities with geocoding …
36f1650
feat: Add create and update handlers for allowed cities, including un…
2d169bf
feat: add unit tests for `UpdateAllowedCityHandler` covering various …
f6a9813
feat: Implement AllowedCity CRUD operations with dedicated API endpoi…
5a415c4
feat: add admin endpoint to update allowed cities
f903664
feat: Add E2E tests for Locations module's admin AllowedCities endpoi…
574cc78
feat: Add an endpoint to update allowed cities and introduce end-to-e…
c08858b
feat: implement Locations module with allowed city management and Nom…
53cc5a4
refactor(locations): implement code review fixes and optimizations
9d24593
feat: Add administrative functionality for managing allowed cities, i…
4c2609d
feat: Add comprehensive provider administration and service managemen…
db3bcbc
feat: Add comprehensive provider administration and service managemen…
64cc3ae
feat: Add module APIs, admin dashboard, document upload, location man…
b1da169
Update src/Shared/Exceptions/GlobalExceptionHandler.cs
frigini 697a835
feat: Implement module APIs for Documents, Users, SearchProviders, an…
c847fc0
feat: Add handler for updating allowed cities and implement developme…
dfd81d4
feat: Introduce document upload command handler, development data see…
5110b11
feat: implement UpdateAllowedCityHandler and DevelopmentDataSeeder.
9991ad9
feat: Implement DevelopmentDataSeeder to populate the database with d…
937c064
Update src/Modules/Documents/Application/ModuleApi/DocumentsModuleApi.cs
frigini fc3bf0d
feat: add document upload command handler, validation messages, and u…
9ff326f
feat: Add admin UI for providers, documents, and dashboard, along wit…
4c888b2
feat: Add initial Admin Portal with Dashboard, Providers, and Documen…
1aa945b
feat: Introduce Admin Portal architecture and overview documentation,…
53b209c
feat: Add initial comprehensive documentation for the Admin Portal, i…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| # Script para reimportar o realm do Keycloak | ||
| # Este script deleta o realm existente e reimporta com as novas configurações | ||
| # | ||
| # Uso: | ||
| # .\reimport-realm.ps1 [-ShowSecrets] [-KeycloakUrl <url>] [-RealmName <name>] [-RealmFile <path>] | ||
| # | ||
| # Variáveis de ambiente: | ||
| # KEYCLOAK_ADMIN_USER - Nome de usuário do admin (padrão: "admin") | ||
| # KEYCLOAK_CLIENT_ID - Client ID para autenticação (padrão: "admin-cli") | ||
| # KEYCLOAK_URL - URL do Keycloak (padrão: "http://localhost:8080") | ||
| # REALM_NAME - Nome do realm (padrão: "meajudaai") | ||
| # REALM_FILE - Caminho do arquivo de configuração do realm | ||
|
|
||
| param( | ||
| [switch]$ShowSecrets = $false, | ||
| [string]$KeycloakUrl = $env:KEYCLOAK_URL, | ||
| [string]$RealmName = $env:REALM_NAME, | ||
| [string]$RealmFile = $env:REALM_FILE | ||
| ) | ||
|
|
||
| # Configurações padrão | ||
| if ([string]::IsNullOrWhiteSpace($KeycloakUrl)) { | ||
| $KeycloakUrl = "http://localhost:8080" | ||
| } | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($RealmName)) { | ||
| $RealmName = "meajudaai" | ||
| } | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($RealmFile)) { | ||
| $RealmFile = ".\infrastructure\keycloak\realms\meajudaai-realm.dev.json" | ||
| } | ||
|
|
||
| # Validar que o arquivo existe | ||
| if (-not (Test-Path $RealmFile)) { | ||
| Write-Error "Arquivo de realm não encontrado: $RealmFile" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Obter credenciais de ambiente ou prompt | ||
| $adminUser = $env:KEYCLOAK_ADMIN_USER | ||
| if ([string]::IsNullOrWhiteSpace($adminUser)) { | ||
| $adminUser = "admin" | ||
| } | ||
|
|
||
| $clientId = $env:KEYCLOAK_CLIENT_ID | ||
| if ([string]::IsNullOrWhiteSpace($clientId)) { | ||
| $clientId = "admin-cli" | ||
| } | ||
|
|
||
| # Solicitar senha de forma segura | ||
| $adminPassword = Read-Host -Prompt "Digite a senha do admin do Keycloak" -AsSecureString | ||
| $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($adminPassword) | ||
| $adminPasswordPlain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) | ||
| [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR) | ||
|
|
||
| Write-Host "Reimportando realm do Keycloak..." -ForegroundColor Cyan | ||
| Write-Host "URL: $KeycloakUrl" | ||
| Write-Host "Realm: $RealmName" | ||
| Write-Host "Arquivo: $RealmFile" | ||
| if ($ShowSecrets) { | ||
| Write-Host "Admin User: $adminUser" | ||
| Write-Host "Client ID: $clientId" | ||
| } | ||
| Write-Host "" | ||
|
|
||
| # 1. Obter token de admin | ||
| Write-Host "1. Obtendo token de administrador..." -ForegroundColor Yellow | ||
|
|
||
| $tokenBody = @{ | ||
| username = $adminUser | ||
| password = $adminPasswordPlain | ||
| grant_type = "password" | ||
| client_id = $clientId | ||
| } | ||
|
frigini marked this conversation as resolved.
|
||
|
|
||
| try { | ||
| $tokenResponse = Invoke-RestMethod -Uri "$KeycloakUrl/realms/master/protocol/openid-connect/token" ` | ||
| -Method Post ` | ||
| -ContentType "application/x-www-form-urlencoded" ` | ||
| -Body $tokenBody ` | ||
| -ErrorAction Stop | ||
|
|
||
| $ADMIN_TOKEN = $tokenResponse.access_token | ||
| Write-Host "Token obtido com sucesso" -ForegroundColor Green | ||
| } | ||
| catch { | ||
| Write-Error "Erro ao obter token de admin. Verifique se o Keycloak está rodando e as credenciais estão corretas." | ||
| Write-Error $_.Exception.Message | ||
| exit 1 | ||
| } | ||
| finally { | ||
| # Limpar senha da memória | ||
| $adminPasswordPlain = $null | ||
| $tokenBody = $null | ||
| } | ||
|
|
||
| Write-Host "" | ||
|
|
||
| # 2. Deletar realm existente (se existir) | ||
| Write-Host "2. Deletando realm existente (se existir)..." -ForegroundColor Yellow | ||
|
|
||
| $headers = @{ | ||
| Authorization = "Bearer $ADMIN_TOKEN" | ||
| } | ||
|
|
||
| try { | ||
| Invoke-RestMethod -Uri "$KeycloakUrl/admin/realms/$RealmName" ` | ||
| -Method Delete ` | ||
| -Headers $headers ` | ||
| -ErrorAction Stop | ||
| Write-Host "Realm deletado com sucesso" -ForegroundColor Green | ||
| } | ||
| catch { | ||
| if ($_.Exception.Response.StatusCode -eq 404) { | ||
| Write-Host "Realm não existia, continuando..." -ForegroundColor Gray | ||
| } | ||
| else { | ||
| Write-Error "Erro ao deletar realm: $($_.Exception.Message)" | ||
| exit 1 | ||
| } | ||
|
frigini marked this conversation as resolved.
|
||
| } | ||
|
|
||
| Write-Host "" | ||
|
|
||
| # 3. Importar novo realm | ||
| Write-Host "3. Importando novo realm..." -ForegroundColor Yellow | ||
|
|
||
| $realmContent = Get-Content -Path $RealmFile -Raw -ErrorAction Stop | ||
|
|
||
| try { | ||
| Invoke-RestMethod -Uri "$KeycloakUrl/admin/realms" ` | ||
| -Method Post ` | ||
| -Headers $headers ` | ||
| -ContentType "application/json" ` | ||
| -Body $realmContent ` | ||
| -ErrorAction Stop | ||
|
|
||
| Write-Host "Realm importado com sucesso!" -ForegroundColor Green | ||
| Write-Host "" | ||
| Write-Host "ATENÇÃO: Configurações de segurança necessárias:" -ForegroundColor Yellow | ||
| Write-Host "" | ||
| Write-Host "1. Configure o Client Secret para 'meajudaai-api-service':" -ForegroundColor Cyan | ||
| Write-Host " - Acesse: $KeycloakUrl/admin/master/console/#/$RealmName/clients" | ||
| Write-Host " - Selecione 'meajudaai-api-service'" | ||
| Write-Host " - Vá para a aba 'Credentials'" | ||
| Write-Host " - Gere ou configure um novo secret" | ||
| Write-Host " - Atualize a variável de ambiente KEYCLOAK_CLIENT_SECRET na aplicação" | ||
| Write-Host "" | ||
| Write-Host "2. Configure senhas para os usuários:" -ForegroundColor Cyan | ||
| Write-Host " - Acesse: $KeycloakUrl/admin/master/console/#/$RealmName/users" | ||
| Write-Host " - Para cada usuário (admin.portal, customer.demo):" | ||
| Write-Host " * Clique no usuário" | ||
| Write-Host " * Vá para 'Credentials'" | ||
| Write-Host " * Defina uma senha" | ||
| Write-Host "" | ||
| Write-Host "Reimportação concluída! Reinicie a aplicação Aspire após configurar as credenciais." -ForegroundColor Green | ||
| } | ||
| catch { | ||
| Write-Error "Erro ao importar realm." | ||
| Write-Error $_.Exception.Message | ||
| exit 1 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.