Skip to content

Commit d4bbef5

Browse files
committed
update to net 9.0
1 parent 5fb1154 commit d4bbef5

6 files changed

Lines changed: 25 additions & 75 deletions

File tree

SimpleAPI/Controllers/SimpleController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.AspNetCore.Mvc;
22
using SimpleAPI.OIDC;
3-
using System.Threading.Tasks;
43

54
namespace SimpleAPI.Controllers
65
{
@@ -33,3 +32,4 @@ public async Task<IActionResult> Index([FromHeader(Name = "Authorization")] stri
3332
}
3433
}
3534
}
35+

SimpleAPI/OIDC/BearerTokenResult.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Microsoft.AspNetCore.Mvc;
22
using Microsoft.Net.Http.Headers;
33
using System.Net.Http.Headers;
4-
using System.Threading.Tasks;
54

65
namespace SimpleAPI.OIDC
76
{

SimpleAPI/OIDC/IntrospectionClient.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
using Microsoft.Extensions.Configuration;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Text.Json;
5-
using System.Net.Http;
1+
using System.Text.Json;
62
using System.Net.Http.Headers;
73
using System.Text;
8-
using System.Threading.Tasks;
94

105
namespace SimpleAPI.OIDC
116
{

SimpleAPI/Program.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
using Microsoft.AspNetCore;
2-
using Microsoft.AspNetCore.Hosting;
1+
using Microsoft.Net.Http.Headers;
2+
using SimpleAPI.OIDC;
33

4-
namespace SimpleAPI
5-
{
6-
public class Program
7-
{
8-
public static void Main(string[] args)
9-
{
10-
CreateWebHostBuilder(args).Build().Run();
11-
}
4+
var builder = WebApplication.CreateBuilder(args);
125

13-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
14-
WebHost.CreateDefaultBuilder(args)
15-
.UseStartup<Startup>();
16-
}
17-
}
6+
builder.Services.AddCors(options => options
7+
.AddDefaultPolicy(policy => policy
8+
.AllowAnyOrigin()
9+
.AllowAnyMethod()
10+
.WithHeaders(HeaderNames.Authorization, HeaderNames.Accept, HeaderNames.ContentType)
11+
.WithExposedHeaders(HeaderNames.WWWAuthenticate, HeaderNames.ContentType)));
12+
builder.Services.AddControllers();
13+
builder.Services.AddHttpClient<HttpClient>();
14+
builder.Services.AddSingleton<IntrospectionClient>();
15+
16+
var app = builder.Build();
17+
18+
app.UseCors();
19+
app.UseAuthorization();
20+
21+
app.MapControllers();
22+
23+
app.Run();

SimpleAPI/SimpleAPI.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
56
</PropertyGroup>
67

78
</Project>

SimpleAPI/Startup.cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)