Projects and packages

In this page, you can find the different projects that I have published over time, with links to their GitHub repositories.

If you have issues with or suggestions for any of these, please use the respective GitHub repository.

ASP.NET Core API Keys

The TerevintoSoftware.ApiKeys package provides a simple to use yet secure implementation to generate API keys and validate them. Key generation and validation is provided by the package, with interfaces for easily storing the generated keys in any database.

NuGet: NuGet package.

builder.Services
    .AddDefaultApiKeyGenerator(new ApiKeyGenerationOptions
    {
        KeyPrefix = "CT-",
        GenerateUrlSafeKeys = true,
        LengthOfKey = 36
    })
    .AddDefaultClaimsPrincipalFactory()
    .AddSingleton() // CacheService is not provided
    .AddApiKeys();

.NET Static Site Generator

The TerevintoSoftware.StaticSiteGenerator .NET tool compiles an ASP.NET Core MVC application into a set of static files (HTML, CSS and JavaScript), allowing you to host the front-end side of MVC applications in free/cheap hosting solutions.

NuGet: NuGet package.

ssg [options]
Options:
  --project (REQUIRED) --output (REQUIRED) --assembly  
  --base-controller --route-template 
  --route-casing (KebabCase|KeepOriginal|LowerCase)
  --default-culture --use-localization --verbose 
  --clear-output --version -?, -h, --help

.NET SolidTester

The TerevintoSoftware.SolidTester .NET tool aims to provide people with a fast way to generate the boilerplate needed for tests across an entire .NET project. This tool generates: test files, fixture classes, Moq mocks for constructor-injected dependencies, and methods for each method found in service classes.

NuGet: NuGet package.

private readonly MockRepository _mockRepository;
private readonly Mock _noDependenciesService;

public SingleDependencyServiceTest()
{
    _mockRepository = new MockRepository(MockBehavior.Default);
    _noDependenciesService = _mockRepository.Create();
}

private SingleDependencyService CreateSystemUnderTestInstance()
{
    return new SingleDependencyService
        (_noDependenciesService.Object);
}

Python PKCE client

The TerevintoSoftware.PythonPkceClient Python package allows you to easily call APIs from desktop client applications, such as Jupyter Notebooks, by performing log in to an OAuth 2/OIDC server to retrieve access, ID, and refresh tokens.

PyPi: Pypi package.

from terevintosoftware.pkce_client import *
config = PkceLoginConfig(
    authorization_uri="https://localhost:44300/connect/authorize",
    token_uri="https://localhost:44300/connect/token",
    scopes=[ "openid", "profile", "api" ],
    client_id="python-nb",
    internal_port=8888,
    add_random_state=True,
    random_state_length=32,
    verify_authorization_server_https=False
)

login_client = PkceClient(config)
pkce_token = login_client.login()
headers = { "Authorization": "Bearer " + \ 
    str(pkce_token.access_token) }