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
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
This commit is contained in:
parent
31ed2b3e15
commit
4f200845f5
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user