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 => context.Services.Configure<AbpIdentityClientOptions>(options =>
{ {
//TODO: Get from config, automatically! //TODO: Get from config, automatically!
options.IdentityClients.Default.Authority = "https://localhost:44305"; options.IdentityClients.Default = new IdentityClientConfiguration
options.IdentityClients.Default.GrantType = "password"; {
options.IdentityClients.Default.ClientId = "MyProjectName_App"; Authority = "https://localhost:44305",
options.IdentityClients.Default.ClientSecret = "1q2w3e*"; GrantType = "password",
options.IdentityClients.Default.UserName = "admin"; ClientId = "MyProjectName_App",
options.IdentityClients.Default.UserPassword = "1q2w3E*"; ClientSecret = "1q2w3e*",
options.IdentityClients.Default.Scope = "MyProjectName"; UserName = "admin",
UserPassword = "1q2w3E*",
Scope = "MyProjectName"
};
}); });
} }
@ -48,7 +51,10 @@ namespace MyCompanyName.MyProjectName.Blazor
//TODO: Get from config, automatically! //TODO: Get from config, automatically!
Configure<AbpRemoteServiceOptions>(options => 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() 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 "/" @page "/"
@inject MyProfileService MyProfileService
<h1>Hello, world!</h1> <h1>Hello, world!</h1>
Welcome to your new app. 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?" /> <SurveyPrompt Title="How is Blazor working for you?" />
@code
{
private string _userName = "?";
private async Task GetUserNameAsync()
{
_userName = await MyProfileService.GetUserNameAsync();
}
}
Loading…
Cancel
Save