diff --git a/.gitignore b/.gitignore index 6a182b5..9ead147 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.userosscache *.sln.docstates *.env +*.env.json # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs @@ -55,6 +56,7 @@ bld/ # Visual Studio 2015/2017 cache/options directory .vs/ +.vscode/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ diff --git a/PostFundManagement.Api/PostFundManagement.Api.csproj b/PostFundManagement.Api/PostFundManagement.Api.csproj index 958507a..a7e664e 100644 --- a/PostFundManagement.Api/PostFundManagement.Api.csproj +++ b/PostFundManagement.Api/PostFundManagement.Api.csproj @@ -1,14 +1,16 @@ - + net10.0 enable enable + 59a05094-4ac2-472d-af04-3407e909432d + diff --git a/PostFundManagement.Api/PostFundManagement.Api.http b/PostFundManagement.Api/PostFundManagement.Api.http deleted file mode 100644 index 201cc3a..0000000 --- a/PostFundManagement.Api/PostFundManagement.Api.http +++ /dev/null @@ -1,6 +0,0 @@ -@PostFundManagement.Api_HostAddress = http://localhost:5112 - -GET {{PostFundManagement.Api_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/PostFundManagement.Api/Program.cs b/PostFundManagement.Api/Program.cs index ee9d65d..60e8031 100644 --- a/PostFundManagement.Api/Program.cs +++ b/PostFundManagement.Api/Program.cs @@ -1,3 +1,5 @@ +using Scalar.AspNetCore; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -9,6 +11,11 @@ var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { + app.MapScalarApiReference(options => + { + options.WithTitle("Post-fund Management API") + .WithTheme(ScalarTheme.BluePlanet); + }); app.MapOpenApi(); } @@ -21,7 +28,7 @@ var summaries = new[] app.MapGet("/weatherforecast", () => { - var forecast = Enumerable.Range(1, 5).Select(index => + var forecast = Enumerable.Range(1, 5).Select(index => new WeatherForecast ( DateOnly.FromDateTime(DateTime.Now.AddDays(index)), diff --git a/PostFundManagement.Api/appsettings.Development.json b/PostFundManagement.Api/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/PostFundManagement.Api/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/PostFundManagement.Api/appsettings.json b/PostFundManagement.Api/appsettings.json index 10f68b8..a2002e3 100644 --- a/PostFundManagement.Api/appsettings.json +++ b/PostFundManagement.Api/appsettings.json @@ -1,4 +1,8 @@ { + "MachineIdentity": { + "Authority": "https://sts.security.khongisa.co.za", + "Audience": "pfm-api-dev" + }, "Logging": { "LogLevel": { "Default": "Information", diff --git a/PostFundManagement.Api/http/api.http b/PostFundManagement.Api/http/api.http new file mode 100644 index 0000000..ca524aa --- /dev/null +++ b/PostFundManagement.Api/http/api.http @@ -0,0 +1,16 @@ +@hostname = api.example.com +@port = 8080 +@host = {{hostname}}:{{port}} +@contentType = application/json + +### +# @prompt username +# @prompt refCode Your reference code display on webpage +# @prompt otp Your one-time password in your mailbox +POST https://{{host}}/verify-otp/{{refCode}} HTTP/1.1 +Content-Type: {{contentType}} + +{ + "username": "{{username}}", + "otp": "{{otp}}" +} \ No newline at end of file diff --git a/PostFundManagement.Api/http/token.http b/PostFundManagement.Api/http/token.http new file mode 100644 index 0000000..8ecb8bf --- /dev/null +++ b/PostFundManagement.Api/http/token.http @@ -0,0 +1,6 @@ +### Token Request +POST https://{{authority}}/connect/token +Content-Type: application/x-www-form-urlencoded +Accept-Encoding: identity + +grant_type={{grantType}}&client_id={{clientId}}&client_secret={{clientSecret}}&scope={{scope}} diff --git a/PostFundManagement.Infrastructure/Configuration/MachineIdentity.cs b/PostFundManagement.Infrastructure/Configuration/MachineIdentity.cs new file mode 100644 index 0000000..2434107 --- /dev/null +++ b/PostFundManagement.Infrastructure/Configuration/MachineIdentity.cs @@ -0,0 +1,12 @@ +namespace PostFundManagement.Infrastructure.Configuration; + +public sealed class MachineIdentity +{ + public string? Authority { get; set; } + + public string? Audience { get; set; } + + public string? ClientId { get; set; } + + public string? ClientSecret { get; set; } +} \ No newline at end of file