Browse Source

Fix identity configuration

pull/5399/head
Halil İbrahim Kalkan 6 years ago
parent
commit
333da8a1b0
  1. 22
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs
  2. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyService.cs
  3. 15
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor

22
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs

@ -33,13 +33,16 @@ namespace MyCompanyName.MyProjectName.Blazor
context.Services.Configure<AbpIdentityClientOptions>(options =>
{
//TODO: Get from config, automatically!
options.IdentityClients.Default.Authority = "https://localhost:44305";
options.IdentityClients.Default.GrantType = "password";
options.IdentityClients.Default.ClientId = "MyProjectName_App";
options.IdentityClients.Default.ClientSecret = "1q2w3e*";
options.IdentityClients.Default.UserName = "admin";
options.IdentityClients.Default.UserPassword = "1q2w3E*";
options.IdentityClients.Default.Scope = "MyProjectName";
options.IdentityClients.Default = new IdentityClientConfiguration
{
Authority = "https://localhost:44305",
GrantType = "password",
ClientId = "MyProjectName_App",
ClientSecret = "1q2w3e*",
UserName = "admin",
UserPassword = "1q2w3E*",
Scope = "MyProjectName"
};
});
}
@ -48,7 +51,10 @@ namespace MyCompanyName.MyProjectName.Blazor
//TODO: Get from config, automatically!
Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default.BaseUrl = "https://localhost:44305";
options.RemoteServices.Default = new RemoteServiceConfiguration
{
BaseUrl = "https://localhost:44305"
};
});
}

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyService.cs

@ -15,7 +15,7 @@ namespace MyCompanyName.MyProjectName.Blazor
public async Task<string> GetUserNameAsync()
{
return "test";
return (await _profileAppService.GetAsync()).UserName;
}
}
}

15
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Pages/Index.razor

@ -1,7 +1,22 @@
@page "/"
@inject MyProfileService MyProfileService
<h1>Hello, world!</h1>
Welcome to your new app.
<h2>Current user name: @_userName</h2>
<button class="btn btn-primary" @onclick="GetUserNameAsync">Click me</button>
<SurveyPrompt Title="How is Blazor working for you?" />
@code
{
private string _userName = "?";
private async Task GetUserNameAsync()
{
_userName = await MyProfileService.GetUserNameAsync();
}
}
Loading…
Cancel
Save