This commit is contained in:
38
Startup.cs
38
Startup.cs
@@ -9,9 +9,9 @@ using rockfishCore.Util;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace rockfishCore
|
namespace rockfishCore
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,12 @@ namespace rockfishCore
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
services.AddAuthorization(options =>
|
||||||
|
{
|
||||||
|
options.FallbackPolicy = new AuthorizationPolicyBuilder()
|
||||||
|
.RequireAuthenticatedUser()
|
||||||
|
.Build();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +80,13 @@ namespace rockfishCore
|
|||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseDefaultFiles();
|
app.UseDefaultFiles();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
OnPrepareResponse = context =>
|
OnPrepareResponse = context =>
|
||||||
@@ -87,15 +98,32 @@ namespace rockfishCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
//Check schema
|
//Check schema
|
||||||
RfSchema.CheckAndUpdate(dbContext);
|
RfSchema.CheckAndUpdate(dbContext);
|
||||||
|
|
||||||
// app.UseHttpsRedirection();
|
// app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
//Rockfish docs so they are authenticated and not availble to anyone
|
||||||
|
//https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-5.0#static-file-authorization
|
||||||
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
FileProvider = new PhysicalFileProvider(
|
||||||
|
Path.Combine(env.ContentRootPath, "rfdocs"))
|
||||||
|
,
|
||||||
|
RequestPath = "/docs",
|
||||||
|
RedirectToAppendTrailingSlash=true
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
|
|||||||
@@ -63,12 +63,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="rfdocs" class="nav-item">
|
<li id="rfdocs" class="nav-item">
|
||||||
<a
|
<a class="rfac nav-link mdi mdi-help" href="/docs/index.html">Docs </a>
|
||||||
class="rfac nav-link mdi mdi-help"
|
|
||||||
href="https://rfuser:mypasswordforrfuser2022@rockfish.ayanova.com/docs/"
|
|
||||||
target="_blank"
|
|
||||||
>Docs </a>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="rfops" class="nav-item">
|
<li id="rfops" class="nav-item">
|
||||||
|
|||||||
Reference in New Issue
Block a user