mirror of https://github.com/abpframework/abp.git
37 changed files with 231 additions and 196 deletions
@ -0,0 +1,15 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace OpenIddict.Demo.API.Controllers; |
|||
|
|||
[ApiController] |
|||
[Authorize] |
|||
[Route("api/claims")] |
|||
public class ClaimsController : Controller |
|||
{ |
|||
public JsonResult Get() |
|||
{ |
|||
return Json(User.Claims.Select(x => new {Type = x.Type, Value = x.Value})); |
|||
} |
|||
} |
|||
@ -1,6 +1,6 @@ |
|||
{ |
|||
"profiles": { |
|||
"OpenIddict.Demo.Client.API": { |
|||
"OpenIddict.Demo.API": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": true, |
|||
"launchBrowser": true, |
|||
@ -1,32 +0,0 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace OpenIddict.Demo.Client.API.Controllers; |
|||
|
|||
[ApiController] |
|||
[Authorize] |
|||
[Route("[controller]")]
|
|||
public class WeatherForecastController : ControllerBase |
|||
{ |
|||
private static readonly string[] Summaries = new[] { |
|||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
|||
}; |
|||
|
|||
private readonly ILogger<WeatherForecastController> _logger; |
|||
|
|||
public WeatherForecastController(ILogger<WeatherForecastController> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
[HttpGet(Name = "GetWeatherForecast")] |
|||
public IEnumerable<WeatherForecast> Get() |
|||
{ |
|||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast { |
|||
Date = DateTime.Now.AddDays(index), |
|||
TemperatureC = Random.Shared.Next(-20, 55), |
|||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] |
|||
}) |
|||
.ToArray(); |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
namespace OpenIddict.Demo.Client.API; |
|||
|
|||
public class WeatherForecast |
|||
{ |
|||
public DateTime Date { get; set; } |
|||
|
|||
public int TemperatureC { get; set; } |
|||
|
|||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); |
|||
|
|||
public string? Summary { get; set; } |
|||
} |
|||
@ -1,26 +1,26 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<OutputType>Library</OutputType> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.OpenIddict.Domain\Volo.Abp.OpenIddict.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Reference Include="Volo.Abp.AspNetCore.Mvc.UI, Version=5.3.0.0, Culture=neutral, PublicKeyToken=null, ProcessorArchitecture=MSIL"> |
|||
<HintPath>..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI\bin\Debug\net6.0\Volo.Abp.AspNetCore.Mvc.UI.dll</HintPath> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<Import Project="..\..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<OutputType>Library</OutputType> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.OpenIddict.Domain\Volo.Abp.OpenIddict.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="OpenIddict.Server.AspNetCore" Version="3.1.1" /> |
|||
<PackageReference Include="OpenIddict.Validation.AspNetCore" Version="3.1.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,41 @@ |
|||
using Microsoft.AspNetCore.Mvc.Razor; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreMvcModule), |
|||
typeof(AbpAspNetCoreMvcUiThemeSharedModule), |
|||
typeof(AbpOpenIddictDomainModule) |
|||
)] |
|||
public class AbpOpenIddictAspNetCoreModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictServerBuilder>(builder => |
|||
{ |
|||
builder.UseAspNetCore() |
|||
.EnableAuthorizationEndpointPassthrough() |
|||
.EnableTokenEndpointPassthrough() |
|||
.EnableUserinfoEndpointPassthrough() |
|||
.EnableLogoutEndpointPassthrough() |
|||
.EnableVerificationEndpointPassthrough(); |
|||
}); |
|||
|
|||
PreConfigure<OpenIddictValidationBuilder>(builder => |
|||
{ |
|||
builder.UseAspNetCore(); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<RazorViewEngineOptions>(options => |
|||
{ |
|||
options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/{1}/{0}.cshtml"); |
|||
}); |
|||
} |
|||
} |
|||
@ -1,21 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc.Razor; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreMvcModule), |
|||
typeof(OpenIddictDomainModule) |
|||
)] |
|||
public class OpenIddictAspNetCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<RazorViewEngineOptions>(options => |
|||
{ |
|||
options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/{1}/{0}.cshtml"); |
|||
options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/Authorization/{0}.cshtml"); |
|||
}); |
|||
} |
|||
} |
|||
@ -1,6 +0,0 @@ |
|||
namespace Volo.Abp.OpenIddict.ViewModels.Authorization; |
|||
|
|||
public class LogoutViewModel |
|||
{ |
|||
public string RequestId { get; set; } |
|||
} |
|||
Loading…
Reference in new issue