re-indentity
parent
f14b44ecd0
commit
86dc1b8a2b
@ -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"
|
|
||||||
|
|
||||||
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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"
|
|
||||||
;
|
|
||||||
Loading…
Reference in New Issue