Compare commits

..

2 Commits

Author SHA1 Message Date
b6432d2701 Merge pull request 'fix: http para https. Ajustar novamente.' (#15) from feat/plano-rodape into main
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 1s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 7m9s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m8s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
Reviewed-on: http://git.carneiro.ddnsfree.com/ricardo/BCards/pulls/15
2025-08-21 23:45:44 +00:00
Ricardo Carneiro
4f200845f5 fix: http para https. Ajustar novamente.
All checks were successful
BCards Deployment Pipeline / Run Tests (pull_request) Successful in 3s
BCards Deployment Pipeline / PR Validation (pull_request) Successful in 0s
BCards Deployment Pipeline / Build and Push Image (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (pull_request) Has been skipped
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (pull_request) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (pull_request) Has been skipped
BCards Deployment Pipeline / Deployment Summary (pull_request) Successful in 0s
2025-08-21 20:44:53 -03:00

View File

@ -84,20 +84,24 @@ builder.Services.AddAuthentication(options =>
options.AuthorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
options.TokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
if (!builder.Environment.IsDevelopment())
{
options.Events.OnRedirectToAuthorizationEndpoint = context =>
{
context.RedirectUri = context.RedirectUri.Replace("http://", "https://");
return Task.CompletedTask;
};
}
options.Events = new OAuthEvents
{
OnRedirectToAuthorizationEndpoint = context =>
{
context.Response.Redirect(context.RedirectUri + "&prompt=login");
// 1. Força HTTPS em produção
if (!builder.Environment.IsDevelopment())
{
context.RedirectUri = context.RedirectUri.Replace("http://", "https://");
}
// 2. Adiciona prompt=login para forçar seleção de conta
var redirectUri = context.RedirectUri;
if (!redirectUri.Contains("prompt="))
{
redirectUri += "&prompt=login";
}
context.Response.Redirect(redirectUri);
return Task.CompletedTask;
}
};