APi Scopes

This commit is contained in:
Paul Schneider 2026-03-16 23:16:12 +00:00
commit be7df3d054
25 changed files with 823 additions and 116 deletions

View file

@ -0,0 +1,153 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Models;
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Org.Controllers
{
public class ApiScopeController : Controller
{
private readonly ApplicationDbContext _context;
public ApiScopeController(ApplicationDbContext context)
{
_context = context;
}
// GET: ApiScope
public async Task<IActionResult> Index()
{
return View(await _context.ApiScopes.ToListAsync());
}
// GET: ApiScope/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
var apiScope = await _context.ApiScopes
.FirstOrDefaultAsync(m => m.Id == id);
if (apiScope == null)
{
return NotFound();
}
return View(apiScope);
}
// GET: ApiScope/Create
public IActionResult Create()
{
return View();
}
// POST: ApiScope/Create
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(ApiScope apiScope)
{
if (ModelState.IsValid)
{
_context.Add(apiScope);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(apiScope);
}
// GET: ApiScope/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
var apiScope = await _context.ApiScopes.FindAsync(id);
if (apiScope == null)
{
return NotFound();
}
return View(apiScope);
}
// POST: ApiScope/Edit/5
// To protect from overposting attacks, enable the specific properties you want to bind to.
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id,
ApiScope apiScope)
{
if (id != apiScope.Id)
{
return NotFound();
}
if (ModelState.IsValid)
{
try
{
_context.Update(apiScope);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ApiScopeExists(apiScope.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(apiScope);
}
// GET: ApiScope/Delete/5
public async Task<IActionResult> Delete(int? id)
{
if (id == null)
{
return NotFound();
}
var apiScope = await _context.ApiScopes
.FirstOrDefaultAsync(m => m.Id == id);
if (apiScope == null)
{
return NotFound();
}
return View(apiScope);
}
// POST: ApiScope/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var apiScope = await _context.ApiScopes.FindAsync(id);
if (apiScope != null)
{
_context.ApiScopes.Remove(apiScope);
}
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
private bool ApiScopeExists(int id)
{
return _context.ApiScopes.Any(e => e.Id == id);
}
}
}

View file

@ -0,0 +1,58 @@
using IdentityServer8.EntityFramework.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Models;
using Yavsc.Server.Helpers;
namespace Yavsc.Org.Controllers.Administration
{
[Route("api/[controller]")]
[ApiController]
public class ApiScopesApiController : ControllerBase
{
private ApplicationDbContext dbContext;
public ApiScopesApiController(ApplicationDbContext dbContext)
{
this.dbContext = dbContext;
}
// GET: api/<Administration>
[HttpGet]
public async Task<IEnumerable<ApiScope>> Get(int skip = 0, int take = 25)
{
return await dbContext.ApiScopes.Skip(skip).Take(take).ToArrayAsync();
}
// GET api/<Administration>/5
[HttpGet("{id}")]
public async Task<ApiScope> Get(int id)
{
return await dbContext.ApiScopes.FirstOrDefaultAsync(s => s.Id == id);
}
// POST api/<Administration>
[HttpPost]
public async Task Post([FromBody] ApiScope value)
{
dbContext.ApiScopes.Add(value);
await dbContext.SaveChangesAsync(User.GetUserId());
}
// PUT api/<Administration>/5
[HttpPut("{id}")]
public async Task Put(int id, [FromBody] ApiScope value)
{
dbContext.Update(value);
await dbContext.SaveChangesAsync(User.GetUserId());
}
// DELETE api/<Administration>/5
[HttpDelete("{id}")]
public async Task Delete(int id)
{
var scope = await dbContext.ApiScopes.FirstAsync(s => s.Id == id);
dbContext.Remove(scope);
}
}
}

View file

@ -5,33 +5,36 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Yavsc.Models;
using Yavsc.Models.Auth;
using Yavsc.Server.Helpers;
namespace Yavsc.Controllers
{
[Authorize("AdministratorOnly")]
public class ClientController : Controller
{
private readonly ApplicationDbContext context;
private readonly ApplicationDbContext dbContext;
private readonly ClientStore clientStore;
private readonly SiteSettings siteSettings;
public ClientController(ApplicationDbContext context,
ClientStore clientStore,
IdentityServer8.Stores.ValidatingClientStore<ClientStore> validatingClientStore
public ClientController(
ApplicationDbContext dbContext,
ClientStore clientStore, IOptions<SiteSettings> siteSettingsOptions
)
{
this.context = context;
this.dbContext = dbContext;
this.clientStore = clientStore;
this.siteSettings = siteSettingsOptions.Value;
}
// GET: Client
public async Task<IActionResult> Index()
{
return View(await context.Clients.Include(c => c.AllowedGrantTypes)
return View(await dbContext.Clients.Include(c => c.AllowedGrantTypes)
.Include(c => c.RedirectUris).ToListAsync());
}
@ -39,7 +42,7 @@ namespace Yavsc.Controllers
public async Task<IActionResult> Details(int id)
{
Client client = await context.Clients.Include(
Client client = await dbContext.Clients.Include(
c => c.ClientSecrets
).Include(c => c.AllowedGrantTypes)
.Include(c => c.RedirectUris)
@ -59,8 +62,6 @@ namespace Yavsc.Controllers
// GET: Client/Create
public IActionResult Create()
{
Secret s;
SetAppTypesInputValues();
return View();
}
@ -68,6 +69,7 @@ namespace Yavsc.Controllers
// POST: Client/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(Client client)
{
if (ModelState.IsValid)
@ -79,16 +81,39 @@ namespace Yavsc.Controllers
return BadRequest(ModelState);
}
context.Clients.Add(client);
if (client.ClientSecrets != null)
{
foreach (var secret in client.ClientSecrets)
{
context.ClientSecrets.Add(secret);
}
}
await context.SaveChangesAsync();
dbContext.Clients.Add(client);
await dbContext.SaveChangesAsync(User.GetUserId());
dbContext.ClientRedirectUris.Add(new ClientRedirectUri
{
ClientId = client.Id,
RedirectUri = siteSettings.Audience
});
dbContext.ClientCorsOrigins.Add(new ClientCorsOrigin
{
ClientId = client.Id,
Origin = siteSettings.Audience
});
foreach (String credType in new String[] { "code", "client_credentials", "password" })
{
dbContext.ClientGrantTypes.Add(new ClientGrantType
{
ClientId = client.Id,
GrantType = credType
});
}
foreach (String scope in new String[] { "openid", "profile" })
{
dbContext.ClientScopes.Add(new ClientScope
{
ClientId = client.Id,
Scope = scope
});
}
await dbContext.SaveChangesAsync(User.GetUserId());
return RedirectToAction("Index");
}
@ -112,7 +137,7 @@ namespace Yavsc.Controllers
// GET: Client/Edit/5
public async Task<IActionResult> Edit(int id)
{
Client client = await context.Clients.SingleOrDefaultAsync(m => m.Id == id);
Client client = await dbContext.Clients.SingleOrDefaultAsync(m => m.Id == id);
if (client == null)
{
return NotFound();
@ -133,11 +158,11 @@ namespace Yavsc.Controllers
{
foreach (var secret in client.ClientSecrets)
{
context.Update(secret);
dbContext.Update(secret);
}
}
context.Update(client);
await context.SaveChangesAsync();
dbContext.Update(client);
await dbContext.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(client);
@ -148,7 +173,7 @@ namespace Yavsc.Controllers
public async Task<IActionResult> Delete(int id)
{
Client client = await context.Clients.SingleOrDefaultAsync(m => m.Id == id);
Client client = await dbContext.Clients.SingleOrDefaultAsync(m => m.Id == id);
if (client == null)
{
return NotFound();
@ -162,11 +187,11 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Client client = await context.Clients
Client client = await dbContext.Clients
.Include(client => client.ClientSecrets)
.SingleAsync(m => m.Id == id);
context.Clients.Remove(client);
await context.SaveChangesAsync();
dbContext.Clients.Remove(client);
await dbContext.SaveChangesAsync();
return RedirectToAction("Index");
}
}

View file

@ -43,6 +43,7 @@ using IdentityServer8.EntityFramework.Services;
using IdentityServer8.EntityFramework.Interfaces;
using Microsoft.AspNetCore.Authentication.Cookies;
using IdentityServer8.Validation;
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Extensions;
@ -288,7 +289,20 @@ public static class HostingExtensions
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = b => b.UseNpgsql(connectionString,
sql => sql.MigrationsAssembly(migrationsAssembly));
sql => sql.MigrationsAssembly(migrationsAssembly))
.UseSeeding((context, _) =>
{
foreach (String scope in new string[] { "blog", "admin", "contract", "com"})
{
var testBlog = context.Set<ApiScope>().FirstOrDefault(b => b.Name == scope);
if (testBlog == null)
{
context.Set<ApiScope>().Add(new ApiScope { Name = scope });
context.SaveChanges();
}
}
});
})
.AddOperationalStore(options =>
{

View file

@ -0,0 +1,69 @@
@model IdentityServer8.EntityFramework.Entities.ApiScope
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Create</title>
</head>
<body>
<h4>ApiScope</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Enabled" /> @Html.DisplayNameFor(model => model.Enabled)
</label>
</div>
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="DisplayName" class="control-label"></label>
<input asp-for="DisplayName" class="form-control" />
<span asp-validation-for="DisplayName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Required" /> @Html.DisplayNameFor(model => model.Required)
</label>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Emphasize" /> @Html.DisplayNameFor(model => model.Emphasize)
</label>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="ShowInDiscoveryDocument" /> @Html.DisplayNameFor(model => model.ShowInDiscoveryDocument)
</label>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
</body>
</html>

View file

@ -0,0 +1,72 @@
@model Yavsc.Models.YavscApiScope
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Delete</title>
</head>
<body>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>YavscApiScope</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Enabled)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Enabled)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Name)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.DisplayName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.DisplayName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Description)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Description)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Required)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Required)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Emphasize)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Emphasize)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.ShowInDiscoveryDocument)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ShowInDiscoveryDocument)
</dd>
</dl>
<form asp-action="Delete">
<input type="hidden" asp-for="Id" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,69 @@
@model Yavsc.Models.YavscApiScope
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Details</title>
</head>
<body>
<div>
<h4>YavscApiScope</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Enabled)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Enabled)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Name)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.DisplayName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.DisplayName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Description)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Description)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Required)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Required)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Emphasize)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Emphasize)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.ShowInDiscoveryDocument)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ShowInDiscoveryDocument)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model?.Id">Edit</a> |
<a asp-action="Index">Back to List</a>
</div>
</body>
</html>

View file

@ -0,0 +1,70 @@
@model Yavsc.Models.YavscApiScope
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Edit</title>
</head>
<body>
<h4>YavscApiScope</h4>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Enabled" /> @Html.DisplayNameFor(model => model.Enabled)
</label>
</div>
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="DisplayName" class="control-label"></label>
<input asp-for="DisplayName" class="form-control" />
<span asp-validation-for="DisplayName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Required" /> @Html.DisplayNameFor(model => model.Required)
</label>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Emphasize" /> @Html.DisplayNameFor(model => model.Emphasize)
</label>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="ShowInDiscoveryDocument" /> @Html.DisplayNameFor(model => model.ShowInDiscoveryDocument)
</label>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
</body>
</html>

View file

@ -0,0 +1,79 @@
@model IEnumerable<Yavsc.Models.YavscApiScope>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Enabled)
</th>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.DisplayName)
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>
@Html.DisplayNameFor(model => model.Required)
</th>
<th>
@Html.DisplayNameFor(model => model.Emphasize)
</th>
<th>
@Html.DisplayNameFor(model => model.ShowInDiscoveryDocument)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Enabled)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.DisplayName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.Required)
</td>
<td>
@Html.DisplayFor(modelItem => item.Emphasize)
</td>
<td>
@Html.DisplayFor(modelItem => item.ShowInDiscoveryDocument)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</tbody>
</table>
</body>
</html>

View file

@ -1,4 +1,4 @@
@using IdentityServer8.Models
@using IdentityServer8.Models;
@model IEnumerable<IdentityServer8.EntityFramework.Entities.Client>
<h2>@Localizer["Index"]</h2>
@ -7,77 +7,85 @@
<a asp-action="Create">@Localizer["Create New"]</a>
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.ClientId)
</th>
<th>
@Html.DisplayNameFor(model => model.Enabled)
</th>
<th>
@Html.DisplayNameFor(model => model.ClientName)
</th>
<th>
@Html.DisplayNameFor(model => model.FrontChannelLogoutUri)
</th>
<th>
@Html.DisplayNameFor(model => model.RedirectUris)
</th>
<th>
@Html.DisplayNameFor(model => model.AbsoluteRefreshTokenLifetime)
</th>
<th>
@Html.DisplayNameFor(model => model.AllowedGrantTypes)
</th>
<th>
@Html.DisplayNameFor(model => model.AccessTokenType)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<div class="list-item">
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ClientId)
</td>
<td>
@Html.DisplayFor(modelItem => item.Enabled)
</td>
<td>
<div class="card">
<h5 class="card-title">Identifier</h5>
<h6 class="card-subtitle mb-2 text-muted">and activation</h6>
<dl class="card-body">
<dt>
@Html.DisplayNameFor(modelItem => item.ClientName)
</dt>
<dd>
@Html.DisplayFor(modelItem => item.ClientName)
</td>
<td>
@Html.DisplayFor(modelItem => item.FrontChannelLogoutUri)
</td>
<td>
<ul>
@foreach (var uri in item.RedirectUris)
{
<li>@uri.RedirectUri</li>
}
</ul>
</td>
<td>
@Html.DisplayFor(modelItem => item.AbsoluteRefreshTokenLifetime)
</td>
<td>
<ul>
@foreach (var t in item.AllowedGrantTypes)
{
<li>@t.GrantType</li>
}
</ul>
</td>
<td>
</dd>
<dt>
@Html.DisplayNameFor(modelItem => item.ClientId)
</dt>
<dd>
@Html.DisplayFor(modelItem => item.ClientId)
</dd>
<dt>
@Html.DisplayNameFor(modelItem => item.Enabled)
</dt>
<dd>
@Html.DisplayFor(modelItem => item.Enabled)
</dd>
</dl>
</div>
<div class="card">
<h5 class="card-title">Urls</h5>
<h6 class="card-subtitle mb-2 text-muted">login and logout, refresh token</h6>
<dl class="card-body">
<dt>
@Html.DisplayNameFor(model => model.FrontChannelLogoutUri)
</dt>
<dd> @Html.DisplayFor(model => item.FrontChannelLogoutUri)
</dd>
<dt>@Html.DisplayNameFor(model => model.RedirectUris)</dt>
<dd>
@foreach (var uri in item.RedirectUris)
{
<li>@uri.RedirectUri</li>
}
</dd>
<dt>@Html.DisplayNameFor(model => model.AbsoluteRefreshTokenLifetime)</dt>
<dd>@Html.DisplayFor(model => item.AbsoluteRefreshTokenLifetime)</dd>
</dl>
</div>
<div class="card">
<h5 class="card-title">Grants</h5>
<h6 class="card-subtitle mb-2 text-muted">and access type</h6>
<dl class="card-body">
<dt>@Html.DisplayNameFor(model => model.AllowedGrantTypes)</dt>
<dd> @foreach (var t in item.AllowedGrantTypes)
{
<li>@t.GrantType</li>
}
</dd>
<dt>
@Html.DisplayNameFor(model => model.AccessTokenType)
</dt>
<dd>
@Enum.GetName(typeof(AccessTokenType), item.AccessTokenType)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</table>
</dd>
</dl>
</div>
<a class="btn btn-primary btn-lg" asp-action="Edit" asp-route-id="@item.Id">Edit</a>
<a class="btn btn-secondary btn-lg" asp-action="Details" asp-route-id="@item.Id">Details</a>
<a class="btn btn-danger btn-lg" asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</div>
}

View file

@ -8,7 +8,7 @@
<link rel="icon" type="image/x-icon" href="~/favicon.ico" asp-append-version="true"/>
<link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico" asp-append-version="true"/>
<link rel="stylesheet" href="~/lib/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/lib/bootstrap.quartz.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
<script src="~/lib/jquery-ui/external/jquery/jquery.js"></script>
<script src="~/lib/jquery-ui/jquery-ui.js"></script>
@ -36,7 +36,7 @@ background-attachment: fixed;
}
}
@await RenderSectionAsync("subbanner", false)
<div class="container body-container">
<div class="container py-4">
@RenderBody()
</div>
<footer class="border-top footer text-muted">

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
using IdentityServer8.EntityFramework.Entities;
using IdentityServer8.EntityFramework.Interfaces;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
@ -23,8 +22,8 @@ namespace Yavsc.Models
using IT.Fixing;
using Market;
using Messaging;
using Microsoft.AspNetCore.Http;
using Musical;
using Microsoft.AspNetCore.Http;
using Musical;
using Musical.Profiles;
using Payment;
using Relationship;
@ -36,8 +35,7 @@ namespace Yavsc.Models
using Workflow;
using Workflow.Profiles;
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>,
IConfigurationDbContext, IPersistedGrantDbContext
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
{
@ -240,12 +238,12 @@ namespace Yavsc.Models
return await base.SaveChangesAsync(ctoken);
}
public Task<int> SaveChangesAsync()
{
return base.SaveChangesAsync();
}
public Task<int> SaveChangesAsync()
{
return base.SaveChangesAsync();
}
public DbSet<Circle> Circle { get; set; }
public DbSet<Circle> Circle { get; set; }
public DbSet<CircleAuthorizationToBlogPost> CircleAuthorizationToBlogPost { get; set; }
@ -338,8 +336,7 @@ namespace Yavsc.Models
public DbSet<PersistedGrant> PersistedGrants { get; set; }
public DbSet<DeviceFlowCodes> DeviceFlowCodes { get; set; }
public DbSet<YavscApiScope> YavscApiScopes { get; set; }
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiResource : ApiResource
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiResourceClaim : ApiResourceClaim
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiResourceProperty : ApiResourceProperty
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiResourceScope : ApiResourceScope
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiResourceSecret : ApiResourceSecret
{
}
}

View file

@ -0,0 +1,9 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiScope : ApiScope
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiScopeClaim : ApiScopeClaim
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscApiScopeProperty : ApiScopeProperty
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscDeviceFlowCodes : DeviceFlowCodes
{
}
}

View file

@ -0,0 +1,8 @@
using IdentityServer8.EntityFramework.Entities;
namespace Yavsc.Models
{
public class YavscPersistedGrant : PersistedGrant
{
}
}

View file

@ -16,7 +16,7 @@ namespace yavscTests
this.output = output;
}
[Fact]
public void UniquePathsAfterFileNameCleaning()
public void UniqueFilenameAfterCleaning()
{
var name1 = "content:///scanned_files/2020-06-02/00.11.02.JPG";
var name2 = "content:///scanned_files/2020-06-02/00.11.03.JPG";