initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using OpenHarbor.JwtTokenManager;
|
||||
using OpenHarbor.JwtTokenManager.Abstractions;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
builder.Services.AddJwtTokenManager(builder.Configuration, "JwtTokenManager", options =>
|
||||
{
|
||||
options.Cache(cacheOptions =>
|
||||
{
|
||||
cacheOptions.ExpirationOffset = 30;
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.MapGet("/", async (IJwtTokenManagerService jwtTokenManagerService, CancellationToken cancellationToken) =>
|
||||
{
|
||||
var response = await jwtTokenManagerService.GetTokenAsync(cancellationToken);
|
||||
return Results.Ok(response);
|
||||
});;
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "",
|
||||
"applicationUrl": "http://localhost:5050",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "",
|
||||
"applicationUrl": "https://localhost:7204;http://localhost:5050",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenHarbor.JwtTokenManager\OpenHarbor.JwtTokenManager.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"JwtTokenManager": {
|
||||
"TokenEndpoint": "",
|
||||
"ClientId": "",
|
||||
"ClientSecret": "",
|
||||
"Scopes": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user