re-indentity
This commit is contained in:
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# config
|
|
||||||
export DNX_USER_HOME="`pwd -P`/dnx"
|
|
||||||
|
|
||||||
# rt
|
|
||||||
mkdir -p dnx/runtimes
|
|
||||||
cd dnx/runtimes
|
|
||||||
curl --insecure -sSL https://freespeech.pschneider.fr/files/Paul/dnx-mono.1.0.0-rc1-update2.tar.bz2 |tar xj
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# dnvm
|
|
||||||
mkdir -p dnvm
|
|
||||||
cd dnvm
|
|
||||||
curl --insecure -sSL https://freespeech.pschneider.fr/files/Paul/dnvm.sh >dnvm.sh
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# alias
|
|
||||||
mkdir -p alias
|
|
||||||
echo "dnx-mono.1.0.0-rc1-update2" >alias/default.alias
|
|
||||||
. dnvm/dnvm.sh
|
|
||||||
|
|
||||||
# end
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo "DNX a été ressucité dans $DNX_USER_HOME"
|
|
||||||
echo "Pour utiliser dnx et dnu:"
|
|
||||||
echo " . ${DNX_USER_HOME}/dnvm/dnvm.sh"
|
|
||||||
|
|
@ -14,10 +14,10 @@ using System.Threading.Tasks;
|
|||||||
using IdentityServer4.Validation;
|
using IdentityServer4.Validation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
using Yavsc.Models.Access;
|
using Yavsc;
|
||||||
using Yavsc.Extensions;
|
using Yavsc.Extensions;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This controller processes the consent UI
|
/// This controller processes the consent UI
|
||||||
@ -69,7 +69,6 @@ namespace Yavsc.Controllers
|
|||||||
if (result.IsRedirect)
|
if (result.IsRedirect)
|
||||||
{
|
{
|
||||||
var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl);
|
var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl);
|
||||||
|
|
||||||
if (context?.IsNativeClient() == true)
|
if (context?.IsNativeClient() == true)
|
||||||
{
|
{
|
||||||
// The client is native, so this change in how to
|
// The client is native, so this change in how to
|
||||||
|
17
src/Yavsc/Controllers/Consent/ConsentInputModel.cs
Normal file
17
src/Yavsc/Controllers/Consent/ConsentInputModel.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
public class ConsentInputModel
|
||||||
|
{
|
||||||
|
public string Button { get; set; }
|
||||||
|
public IEnumerable<string> ScopesConsented { get; set; }
|
||||||
|
public bool RememberConsent { get; set; }
|
||||||
|
public string ReturnUrl { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
16
src/Yavsc/Controllers/Consent/ConsentOptions.cs
Normal file
16
src/Yavsc/Controllers/Consent/ConsentOptions.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
public class ConsentOptions
|
||||||
|
{
|
||||||
|
public static bool EnableOfflineAccess = true;
|
||||||
|
public static string OfflineAccessDisplayName = "Offline Access";
|
||||||
|
public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline";
|
||||||
|
|
||||||
|
public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission";
|
||||||
|
public static readonly string InvalidSelectionErrorMessage = "Invalid selection";
|
||||||
|
}
|
||||||
|
}
|
19
src/Yavsc/Controllers/Consent/ConsentViewModel.cs
Normal file
19
src/Yavsc/Controllers/Consent/ConsentViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
public class ConsentViewModel : ConsentInputModel
|
||||||
|
{
|
||||||
|
public string ClientName { get; set; }
|
||||||
|
public string ClientUrl { get; set; }
|
||||||
|
public string ClientLogoUrl { get; set; }
|
||||||
|
public bool AllowRememberConsent { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<ScopeViewModel> IdentityScopes { get; set; }
|
||||||
|
public IEnumerable<ScopeViewModel> ApiScopes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
src/Yavsc/Controllers/Consent/ProcessConsentResult.cs
Normal file
21
src/Yavsc/Controllers/Consent/ProcessConsentResult.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
using IdentityServer4.Models;
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
public class ProcessConsentResult
|
||||||
|
{
|
||||||
|
public bool IsRedirect => RedirectUri != null;
|
||||||
|
public string RedirectUri { get; set; }
|
||||||
|
public Client Client { get; set; }
|
||||||
|
|
||||||
|
public bool ShowView => ViewModel != null;
|
||||||
|
public ConsentViewModel ViewModel { get; set; }
|
||||||
|
|
||||||
|
public bool HasValidationError => ValidationError != null;
|
||||||
|
public string ValidationError { get; set; }
|
||||||
|
}
|
||||||
|
}
|
16
src/Yavsc/Controllers/Consent/ScopeViewModel.cs
Normal file
16
src/Yavsc/Controllers/Consent/ScopeViewModel.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
public class ScopeViewModel
|
||||||
|
{
|
||||||
|
public string Value { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool Emphasize { get; set; }
|
||||||
|
public bool Required { get; set; }
|
||||||
|
public bool Checked { get; set; }
|
||||||
|
}
|
||||||
|
}
|
99
src/Yavsc/Controllers/GrantsController.cs
Normal file
99
src/Yavsc/Controllers/GrantsController.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
|
||||||
|
|
||||||
|
using IdentityServer4.Services;
|
||||||
|
using IdentityServer4.Stores;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using IdentityServer4.Events;
|
||||||
|
using IdentityServer4.Extensions;
|
||||||
|
using Yavsc;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
|
namespace IdentityServerHost.Quickstart.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This sample controller allows a user to revoke grants given to clients
|
||||||
|
/// </summary>
|
||||||
|
[SecurityHeaders]
|
||||||
|
[Authorize]
|
||||||
|
public class GrantsController : Controller
|
||||||
|
{
|
||||||
|
private readonly IIdentityServerInteractionService _interaction;
|
||||||
|
private readonly IClientStore _clients;
|
||||||
|
private readonly IResourceStore _resources;
|
||||||
|
private readonly IEventService _events;
|
||||||
|
|
||||||
|
public GrantsController(IIdentityServerInteractionService interaction,
|
||||||
|
IClientStore clients,
|
||||||
|
IResourceStore resources,
|
||||||
|
IEventService events)
|
||||||
|
{
|
||||||
|
_interaction = interaction;
|
||||||
|
_clients = clients;
|
||||||
|
_resources = resources;
|
||||||
|
_events = events;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show list of grants
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Index()
|
||||||
|
{
|
||||||
|
return View("Index", await BuildViewModelAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle postback to revoke a client
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> Revoke(string clientId)
|
||||||
|
{
|
||||||
|
await _interaction.RevokeUserConsentAsync(clientId);
|
||||||
|
await _events.RaiseAsync(new GrantsRevokedEvent(User.GetSubjectId(), clientId));
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<GrantsViewModel> BuildViewModelAsync()
|
||||||
|
{
|
||||||
|
var grants = await _interaction.GetAllUserGrantsAsync();
|
||||||
|
|
||||||
|
var list = new List<GrantViewModel>();
|
||||||
|
foreach(var grant in grants)
|
||||||
|
{
|
||||||
|
var client = await _clients.FindClientByIdAsync(grant.ClientId);
|
||||||
|
if (client != null)
|
||||||
|
{
|
||||||
|
var resources = await _resources.FindResourcesByScopeAsync(grant.Scopes);
|
||||||
|
|
||||||
|
var item = new GrantViewModel()
|
||||||
|
{
|
||||||
|
ClientId = client.ClientId,
|
||||||
|
ClientName = client.ClientName ?? client.ClientId,
|
||||||
|
ClientLogoUrl = client.LogoUri,
|
||||||
|
ClientUrl = client.ClientUri,
|
||||||
|
Description = grant.Description,
|
||||||
|
Created = grant.CreationTime,
|
||||||
|
Expires = grant.Expiration,
|
||||||
|
IdentityGrantNames = resources.IdentityResources.Select(x => x.DisplayName ?? x.Name).ToArray(),
|
||||||
|
ApiGrantNames = resources.ApiScopes.Select(x => x.DisplayName ?? x.Name).ToArray()
|
||||||
|
};
|
||||||
|
|
||||||
|
list.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new GrantsViewModel
|
||||||
|
{
|
||||||
|
Grants = list
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,10 +10,10 @@ namespace Yavsc
|
|||||||
{
|
{
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
builder.Configuration
|
builder.Configuration
|
||||||
.AddEnvironmentVariables()
|
|
||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json")
|
||||||
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true)
|
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true)
|
||||||
.AddEnvironmentVariables().Build();
|
.AddEnvironmentVariables()
|
||||||
|
.Build();
|
||||||
var app = builder.ConfigureServices().ConfigurePipeline();
|
var app = builder.ConfigureServices().ConfigurePipeline();
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
app.Run();
|
app.Run();
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|
||||||
<script src="~/lib/microsoft/signalr/dist/browser/signalr.min.js" asp-append-version="true"></script>
|
<script src="~/lib/microsoft/signalr/dist/browser/signalr.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/chat.js" asp-append-version="true"></script>
|
<script src="~/js/chat.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
|
@ -70,16 +70,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if (multipleact) {
|
|
||||||
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
|
||||||
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
|
||||||
<span class="sr-only">Précédent</span>
|
|
||||||
</a>
|
|
||||||
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
|
||||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
|
||||||
<span class="sr-only">Suivant</span>
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
|
||||||
<link rel="icon" type="image/x-icon" href="~/favicon.ico" />
|
<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" />
|
<link rel="shortcut icon" type="image/x-icon" href="~/favicon.ico" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
|
||||||
|
<!-- #region jQuery Slim
|
||||||
|
<script src="~/lib/jquery/dist/jquery.slim.min.js"></script>
|
||||||
|
-->
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||||
@await RenderSectionAsync("header", false)
|
@await RenderSectionAsync("header", false)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -38,10 +42,9 @@
|
|||||||
© 2024 - Yavsc - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
© 2024 - Yavsc - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/lib/jquery/dist/jquery.slim.min.js"></script>
|
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
@await RenderSectionAsync("scripts", false)
|
@await RenderSectionAsync("scripts", false)
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
Manage your account
|
Manage your account
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="dropdown-item" asp-controller="Grants" asp-action="Index">Your Grants</a></li>
|
||||||
<li><a class="dropdown-item" asp-controller="Account" asp-action="Logout">Logout</a></li>
|
<li><a class="dropdown-item" asp-controller="Account" asp-action="Logout">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
# using mono > 4.6.2 breaks the dnx behaviour
|
|
||||||
|
|
||||||
```term
|
|
||||||
SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.
|
|
||||||
in (wrapper managed-to-native) System.Threading.Monitor.Exit(object)
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
@ -1,6 +0,0 @@
|
|||||||
-- select * from "AspNetRoles";
|
|
||||||
-- select * from "AspNetUserRoles";
|
|
||||||
select "AspNetUsers"."UserName", "AspNetRoles"."Name" from "AspNetUsers"
|
|
||||||
inner join "AspNetUserRoles" on "AspNetUserRoles"."UserId" = "AspNetUsers"."Id"
|
|
||||||
inner join "AspNetRoles" on "AspNetRoles"."Id" = "AspNetUserRoles"."RoleId"
|
|
||||||
;
|
|
@ -13,4 +13,22 @@
|
|||||||
.navbar-dark .navbar-toggler-icon {
|
.navbar-dark .navbar-toggler-icon {
|
||||||
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
|
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); }
|
||||||
|
|
||||||
/*# sourceMappingURL=site.css.map */
|
/* bootstrap.css | http://localhost:5000/lib/bootstrap/css/bootstrap.css */
|
||||||
|
.nav-link {
|
||||||
|
/* background-color: var(--bs-nav-tabs-link-active-bg); */
|
||||||
|
background-color: black; }
|
||||||
|
|
||||||
|
.dropdown-item {
|
||||||
|
/* background-color: transparent; */
|
||||||
|
background-color: black; }
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
/* background-color: var(--bs-dropdown-bg); */
|
||||||
|
background-color: black; }
|
||||||
|
|
||||||
|
div.carousel-inner > div.item > div.carousel-caption-s {
|
||||||
|
margin: .5em;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
color: #ffffc8;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: .5em; }
|
||||||
|
@ -40,3 +40,11 @@
|
|||||||
/* background-color: var(--bs-dropdown-bg); */
|
/* background-color: var(--bs-dropdown-bg); */
|
||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.carousel-inner > div.item > div.carousel-caption-s {
|
||||||
|
margin: .5em;
|
||||||
|
background-color: rgba(0,0,0,.6);
|
||||||
|
color: rgb(255,255,200);
|
||||||
|
font-weight: bold;
|
||||||
|
padding: .5em;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user