spbgovbr / Sistema_Programa_de_Gestao_Susep

34 stars 48 forks source link

Erro de autenticação na versão de 27/06/2021 #25

Closed filipepgoes closed 3 years ago

filipepgoes commented 3 years ago

Ao digitar o login e a senha e clicar em "Entrar" aparece um erro 500 no método POST "https:/hostname:porta/connect/token" com a seguinte descrição. O erro aponta para arquivo o recentemente mudado "ResourceOwnerPasswordValidator.cs".

XHR POST https://hostname:porta/connect/token [HTTP/1.1 500 Internal Server Error 409ms] System.NullReferenceException: Object reference not set to an instance of an object. at Susep.SISRH.Application.Auth.ResourceOwnerPasswordValidator.<>c__DisplayClass4_0.b0() in /src/Susep.SISRH.Application/Auth/ResourceOwnerPasswordValidator.cs:line 66 at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b274_0(Object obj) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown ---

at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at Susep.SISRH.Application.Auth.ResourceOwnerPasswordValidator.ValidateAsync(ResourceOwnerPasswordValidationContext context) in /src/Susep.SISRH.Application/Auth/ResourceOwnerPasswordValidator.cs:line 64 at IdentityServer4.Validation.TokenRequestValidator.ValidateResourceOwnerCredentialRequestAsync(NameValueCollection parameters) at IdentityServer4.Validation.TokenRequestValidator.RunValidationAsync(Func`2 validationFunc, NameValueCollection parameters) at IdentityServer4.Validation.TokenRequestValidator.ValidateRequestAsync(NameValueCollection parameters, ClientSecretValidationResult clientValidationResult) at IdentityServer4.Endpoints.TokenEndpoint.ProcessTokenRequestAsync(HttpContext context) at IdentityServer4.Endpoints.TokenEndpoint.ProcessAsync(HttpContext context) at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService) at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService) at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

HEADERS

Content-Type: application/x-www-form-urlencoded Accept: application/json, text/plain, / Accept-Encoding: gzip, deflate, br Accept-Language: pt-BR, pt; q=0.8, en-US; q=0.5, en; q=0.3 Host: hostname:5000 Referer: https://hostname:porta/ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0 DNT: 1 Request-Id: |a4768b8f-41b9510b0ebd4352.1. Origin: https://hostname:porta Content-Length: 127 X-Real-IP: 10.253.66.159 X-Forwarded-For: hostname:porta, ip X-Forwarded-Host: hostname:porta X-Forwarded-Port: 443 X-Forwarded-Proto: https Forwarded: for=172.20.0.2;host=hostname:porta;proto=https;proto-version=

henrique-prog commented 3 years ago

Boa noite @filipepgoes . Obrigado pelo feedback, o erro foi corrigido.

filipepgoes commented 3 years ago

Registrando. Deve ser mudado arquivo appsettings.Homolog.json, colocando na tag ldapOptions um array de nome Configurations:

"ldapOptions": { "Configurations": [ { "Url": "ldap.orgao.gov.br", "Port": 389, ... "EmailAttributeFilter": "mail" } ] },

filipepgoes commented 3 years ago

Resolvido.