Browse Source

Show actual exception message from Identity Server . Issue volosoft/volo#1533

Identity server hides the exception message therefore I used Raw of the HTTP content. And hide the stack trace I used <eof/>
pull/3435/head
Alper Ebicoglu 7 years ago
parent
commit
8c917e390e
  1. 10
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs

10
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs

@ -70,9 +70,17 @@ namespace Volo.Abp.IdentityModel
} }
var tokenResponse = await GetTokenResponse(discoveryResponse, configuration); var tokenResponse = await GetTokenResponse(discoveryResponse, configuration);
if (tokenResponse.IsError) if (tokenResponse.IsError)
{ {
throw new AbpException($"Could not get token from the OpenId Connect server! ErrorType: {tokenResponse.ErrorType}. Error: {tokenResponse.Error}. ErrorDescription: {tokenResponse.ErrorDescription}. HttpStatusCode: {tokenResponse.HttpStatusCode}"); if (tokenResponse.ErrorDescription != null)
{
throw new AbpException($"Could not get token from the OpenId Connect server! ErrorType: {tokenResponse.ErrorType}. Error: {tokenResponse.Error}. ErrorDescription: {tokenResponse.ErrorDescription}. HttpStatusCode: {tokenResponse.HttpStatusCode}");
}
var rawError = tokenResponse.Raw;
var withoutInnerException = rawError.Split(new string[] { "<eof/>" }, StringSplitOptions.RemoveEmptyEntries);
throw new AbpException(withoutInnerException[0]);
} }
return tokenResponse.AccessToken; return tokenResponse.AccessToken;

Loading…
Cancel
Save