We are in the process of developing a new API. This API will be accessible to both internal and external clients.
For the internal clients, we do not need any authentication. But for the external clients, authentication is required (based upon JWT tokens).
So, eventually, we would like something like this pseudo code:
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
if (HttpContext.RemoteIP.IP != "192.168.1.1") // <== something like this
{
services.AddAuthentication(options =>
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.Authority = "https://Issuer.localdomain.local";
options.Audience = "TestAudience";
});
}
}
Obviously, the line if (HttpContext.RemoteIP.IP != "192.1698.1.1")
isn't going to work. But I hope that it clarifies what we're trying to do here.