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
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
This commit is contained in:
commit
b6432d2701
@ -84,20 +84,24 @@ builder.Services.AddAuthentication(options =>
|
|||||||
options.AuthorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
|
options.AuthorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
|
||||||
options.TokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
|
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
|
options.Events = new OAuthEvents
|
||||||
{
|
{
|
||||||
OnRedirectToAuthorizationEndpoint = context =>
|
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;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user