Skip to content

Commit

Permalink
Merge pull request #638 from Laixer/develop
Browse files Browse the repository at this point in the history
v3.5.1
  • Loading branch information
yorickdewid committed Jan 20, 2022
2 parents 24e888a + 91c2cce commit 72896e5
Show file tree
Hide file tree
Showing 39 changed files with 1,256 additions and 1,260 deletions.
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/FunderMaps.BatchNode/bin/Debug/net5.0/FunderMaps.BatchNode",
"program": "${workspaceFolder}/src/FunderMaps.BatchNode/bin/Debug/net6.0/FunderMaps.BatchNode",
"args": [],
"cwd": "${workspaceFolder}/src/FunderMaps.BatchNode",
"stopAtEntry": false,
Expand All @@ -25,7 +25,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/FunderMaps.WebApi/bin/Debug/net5.0/FunderMaps.WebApi",
"program": "${workspaceFolder}/src/FunderMaps.WebApi/bin/Debug/net6.0/FunderMaps.WebApi",
"args": [],
"cwd": "${workspaceFolder}/src/FunderMaps.WebApi",
"stopAtEntry": false,
Expand All @@ -43,7 +43,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/FunderMaps.Webservice/bin/Debug/net5.0/FunderMaps.Webservice",
"program": "${workspaceFolder}/src/FunderMaps.Webservice/bin/Debug/net6.0/FunderMaps.Webservice",
"args": [],
"cwd": "${workspaceFolder}/src/FunderMaps.Webservice",
"stopAtEntry": false,
Expand All @@ -61,7 +61,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/FunderMaps.Portal/bin/Debug/net5.0/FunderMaps.Portal",
"program": "${workspaceFolder}/src/FunderMaps.Portal/bin/Debug/net6.0/FunderMaps.Portal",
"args": [],
"cwd": "${workspaceFolder}/src/FunderMaps.Portal",
"stopAtEntry": false,
Expand Down
3 changes: 0 additions & 3 deletions API_TEST

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RUN dotnet publish -c release -o /app \
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
ENV DOTNET_PRINT_TELEMETRY_MESSAGE=false
ENV Logging__Console__FormatterName=Simple
WORKDIR /app
COPY --from=build /app .
RUN if grep -Fxq "FunderMaps.BatchNode" SUBTOOL ; then \
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,37 @@ Foundation issues occur and are actively investigated by local government. Gaini
* .NET 6 LTS Runtime and SDK
* Docker

See https://docs.microsoft.com/en-us/dotnet/core/install/ for installation instructions of .NET.

## Running the application on localhost

After cloning or downloading the application you will be able to run the application on localhost. You will need to run the setup and load scripts to configure the local database.

1. Run from solution directory. This will setup the PostgreSQL instance and seed the database.
1. Run from solution directory. This will setup the PostgreSQL instance in a docker container.

```
```sh
./scripts/setupdb.sh
```

2. Wait **5 seconds** before running the database seeder script.

```sh
./scripts/loaddb.sh
```

3. Ensure your connection strings in `appsettings.{ENV}.json` point to the local PostgreSQL instance. For example the *FunderMaps.WebApi* would have `Server=localhost;Database=fundermaps;User Id=fundermaps_webapp` where the user id corresponds to the application.

4. Enter the project directory in `src/{project}`.

5. Run the application with `ASPNETCORE_ENVIRONMENT={ENV} dotnet run`. The application should keep running in the foreground. The foreground logging shows the connection details.
5. _(Optional)_ Test the application by running `dotnet test`. The tests cover almost all of the application logic. Address any issues before continue the development.

6. Run the application with `ASPNETCORE_ENVIRONMENT={ENV} dotnet run`. The application should keep running in the foreground. The foreground logging shows the connection details.

When using VS Code the 'debug' section should list all the applications. Just run the application (or hit F5).

## Configuration

See the `contrib/etc/_appsettings.{ENV}.json` directory for configuration files for each environment. You can copy these configuration files to the project source directory.
See the `contrib/etc/_appsettings.{ENV}.json` directory for configuration files for each environment. You can copy these configuration files to the project source directory (`src/{project}`).

## Using the application

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
namespace FunderMaps.AspNetCore.Authentication
namespace FunderMaps.AspNetCore.Authentication;

/// <summary>
/// FunderMaps claim types.
/// </summary>
public static class FunderMapsAuthenticationClaimTypes
{
/// <summary>
/// FunderMaps claim types.
/// FunderMaps tenant claim type.
/// </summary>
public static class FunderMapsAuthenticationClaimTypes
{
/// <summary>
/// FunderMaps tenant claim type.
/// </summary>
public const string Tenant = "cfo";
public const string Tenant = "cfo";

/// <summary>
/// FunderMaps tenant role claim type.
/// </summary>
public const string TenantRole = "cfor";
}
/// <summary>
/// FunderMaps tenant role claim type.
/// </summary>
public const string TenantRole = "cfor";
}
33 changes: 16 additions & 17 deletions src/FunderMaps.AspNetCore/Authentication/ISecurityTokenProvider.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using Microsoft.IdentityModel.Tokens;
using System.Security.Claims;

namespace FunderMaps.AspNetCore.Authentication
namespace FunderMaps.AspNetCore.Authentication;

/// <summary>
/// Security token provider.
/// </summary>
public interface ISecurityTokenProvider
{
/// <summary>
/// Security token provider.
/// Generate token.
/// </summary>
public interface ISecurityTokenProvider
{
/// <summary>
/// Generate token.
/// </summary>
/// <param name="principal">Claims principal.</param>
/// <returns>Instance of <see cref="SecurityToken"/>.</returns>
SecurityToken GetToken(ClaimsPrincipal principal);
/// <param name="principal">Claims principal.</param>
/// <returns>Instance of <see cref="SecurityToken"/>.</returns>
SecurityToken GetToken(ClaimsPrincipal principal);

/// <summary>
/// Generate token.
/// </summary>
/// <param name="principal">Claims principal.</param>
/// <returns>Instance of <see cref="TokenContext"/>.</returns>
TokenContext GetTokenContext(ClaimsPrincipal principal);
}
/// <summary>
/// Generate token.
/// </summary>
/// <param name="principal">Claims principal.</param>
/// <returns>Instance of <see cref="TokenContext"/>.</returns>
TokenContext GetTokenContext(ClaimsPrincipal principal);
}
Loading

0 comments on commit 72896e5

Please sign in to comment.