DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
6b02ee7c9b
  1. 6
      src/Shentun.WebPeis.Application/Users/UserAppService.cs
  2. 13
      src/Shentun.WebPeis.HttpApi.Host/WebPeisHttpApiHostModule.cs
  3. 3
      src/Shentun.WebPeis.HttpApi.Host/appsettings.json

6
src/Shentun.WebPeis.Application/Users/UserAppService.cs

@ -204,11 +204,13 @@ namespace Shentun.WebPeis.Users
protected virtual async Task<TokenResponse> RequestAuthServerLoginByPasswordAsync(HttpClient client, string username, string password) protected virtual async Task<TokenResponse> RequestAuthServerLoginByPasswordAsync(HttpClient client, string username, string password)
{ {
var AdminUrl = _configuration.GetSection("Kestrel")
.GetSection("Endpoints").GetSection("Http")
.GetSection("Url").Value;
var request = new PasswordTokenRequest var request = new PasswordTokenRequest
{ {
Address = _configuration["AuthServer:Authority"] + "/connect/token",
Address = AdminUrl + "/connect/token",
//GrantType = "password", //GrantType = "password",
//UserName = username, //UserName = username,
//Password = password, //Password = password,

13
src/Shentun.WebPeis.HttpApi.Host/WebPeisHttpApiHostModule.cs

@ -182,7 +182,12 @@ public class WebPeisHttpApiHostModule : AbpModule
}); });
///½â³ýhttpsÏÞÖÆ
context.Services.AddOpenIddict()
.AddServer(option =>
{
option.UseAspNetCore().DisableTransportSecurityRequirement();
});
//Configure<OpenIddictServerAspNetCoreBuilder>(configure => //Configure<OpenIddictServerAspNetCoreBuilder>(configure =>
@ -454,6 +459,10 @@ public class WebPeisHttpApiHostModule : AbpModule
app.UseDynamicClaims(); app.UseDynamicClaims();
app.UseAuthorization(); app.UseAuthorization();
//ÅäÖÃÊÇ·ñÆôÓÃswagger
var IsSwagger = Convert.ToBoolean(configuration["Swagger:IsEnabled"]);
if (IsSwagger)
{
app.UseSwagger(); app.UseSwagger();
app.UseAbpSwaggerUI(c => app.UseAbpSwaggerUI(c =>
{ {
@ -467,7 +476,7 @@ public class WebPeisHttpApiHostModule : AbpModule
c.OAuthScopes("WebPeis"); c.OAuthScopes("WebPeis");
c.DefaultModelExpandDepth(-1); c.DefaultModelExpandDepth(-1);
}); });
}
app.UseAuditing(); app.UseAuditing();
app.UseAbpSerilogEnrichers(); app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints(); app.UseConfiguredEndpoints();

3
src/Shentun.WebPeis.HttpApi.Host/appsettings.json

@ -64,5 +64,8 @@
"BaseAddress": "http://10.1.13.31", "BaseAddress": "http://10.1.13.31",
"ReportListApiUrl": "http://10.1.13.31/api/report/page", "ReportListApiUrl": "http://10.1.13.31/api/report/page",
"ReportApiUrl": "http://10.1.13.31/api/report/download" "ReportApiUrl": "http://10.1.13.31/api/report/download"
},
"Swagger": {
"IsEnabled": true
} }
} }
Loading…
Cancel
Save