mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-07-14 03:23:48 +08:00
🔄refactor: 使用OpenIddict 重构Identity
This commit is contained in:
@@ -1,82 +0,0 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Consent.ConsentViewModel
|
||||
|
||||
<div class="page-consent">
|
||||
<div class="row page-header">
|
||||
<div class="col-sm-10">
|
||||
@if (Model.ClientLogoUrl != null)
|
||||
{
|
||||
<div class="client-logo"><img src="@Model.ClientLogoUrl"></div>
|
||||
}
|
||||
<h1>
|
||||
@Model.ClientName
|
||||
<small>is requesting your permission</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<partial name="_ValidationSummary" />
|
||||
|
||||
<form asp-action="Index" class="consent-form">
|
||||
<input type="hidden" asp-for="ReturnUrl" />
|
||||
|
||||
<div>Uncheck the permissions you do not wish to grant.</div>
|
||||
|
||||
@if (Model.IdentityScopes.Any())
|
||||
{
|
||||
<div class="panel panel-default consent-buttons">
|
||||
<div class="panel-heading">
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
Personal Information
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach (var scope in Model.IdentityScopes)
|
||||
{
|
||||
<partial name="_ScopeListItem" model="@scope" />
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.ResourceScopes.Any())
|
||||
{
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="glyphicon glyphicon-tasks"></span>
|
||||
Application Access
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach (var scope in Model.ResourceScopes)
|
||||
{
|
||||
<partial name="_ScopeListItem" model="scope" />
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.AllowRememberConsent)
|
||||
{
|
||||
<div class="consent-remember">
|
||||
<label>
|
||||
<input class="consent-scopecheck" asp-for="RememberConsent" />
|
||||
<strong>Remember My Decision</strong>
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="consent-buttons">
|
||||
<button name="button" value="yes" class="btn btn-primary" autofocus>Yes, Allow</button>
|
||||
<button name="button" value="no" class="btn">No, Do Not Allow</button>
|
||||
@if (Model.ClientUrl != null)
|
||||
{
|
||||
<a class="pull-right btn btn-default" target="_blank" href="@Model.ClientUrl">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
<strong>@Model.ClientName</strong>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
Success
|
||||
<small>You have successfully authorized the device</small>
|
||||
</h1>
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
@model string
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
User Code
|
||||
</h1>
|
||||
<p>
|
||||
Please enter the code displayed on your device
|
||||
</p>
|
||||
<form asp-action="UserCodeCapture" method="post">
|
||||
<input for="userCode" name="userCode" />
|
||||
<button class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,93 +0,0 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Device.DeviceAuthorizationViewModel
|
||||
|
||||
<div class="page-header">
|
||||
<div class="row page-header">
|
||||
<div class="col-sm-10">
|
||||
@if (Model.ClientLogoUrl != null)
|
||||
{
|
||||
<div class="client-logo"><img src="@Model.ClientLogoUrl"></div>
|
||||
}
|
||||
<h1>
|
||||
@Model.ClientName
|
||||
<small>is requesting your permission</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Model.ConfirmUserCode)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<p>
|
||||
Please confirm that the authorization request quotes the code: "@Model.UserCode".
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<partial name="_ValidationSummary" />
|
||||
|
||||
<form asp-action="Callback" class="consent-form">
|
||||
<input asp-for="UserCode" type="hidden" value="@Model.UserCode" />
|
||||
|
||||
<div>Uncheck the permissions you do not wish to grant.</div>
|
||||
|
||||
@if (Model.IdentityScopes.Any())
|
||||
{
|
||||
<div class="panel panel-default consent-buttons">
|
||||
<div class="panel-heading">
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
Personal Information
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach (var scope in Model.IdentityScopes)
|
||||
{
|
||||
<partial name="_ScopeListItem" model="@scope" />
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.ResourceScopes.Any())
|
||||
{
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<span class="glyphicon glyphicon-tasks"></span>
|
||||
Application Access
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach (var scope in Model.ResourceScopes)
|
||||
{
|
||||
<partial name="_ScopeListItem" model="scope" />
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.AllowRememberConsent)
|
||||
{
|
||||
<div class="consent-remember">
|
||||
<label>
|
||||
<input class="consent-scopecheck" asp-for="RememberConsent" />
|
||||
<strong>Remember My Decision</strong>
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="consent-buttons">
|
||||
<button name="button" value="yes" class="btn btn-primary" autofocus>Yes, Allow</button>
|
||||
<button name="button" value="no" class="btn">No, Do Not Allow</button>
|
||||
@if (Model.ClientUrl != null)
|
||||
{
|
||||
<a class="pull-right btn btn-default" target="_blank" href="@Model.ClientUrl">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
<strong>@Model.ClientName</strong>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,32 +0,0 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Diagnostics.DiagnosticsViewModel
|
||||
|
||||
<h1>Authentication cookie</h1>
|
||||
|
||||
<h3>Claims</h3>
|
||||
<dl>
|
||||
@foreach (var claim in Model.AuthenticateResult.Principal.Claims)
|
||||
{
|
||||
<dt>@claim.Type</dt>
|
||||
<dd>@claim.Value</dd>
|
||||
}
|
||||
</dl>
|
||||
|
||||
<h3>Properties</h3>
|
||||
<dl>
|
||||
@foreach (var prop in Model.AuthenticateResult.Properties.Items)
|
||||
{
|
||||
<dt>@prop.Key</dt>
|
||||
<dd>@prop.Value</dd>
|
||||
}
|
||||
</dl>
|
||||
|
||||
@if (Model.Clients.Any())
|
||||
{
|
||||
<h3>Clients</h3>
|
||||
<ul>
|
||||
@foreach (var client in Model.Clients)
|
||||
{
|
||||
<li>@client</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Grants.GrantsViewModel
|
||||
|
||||
<div class="grants">
|
||||
<div class="row page-header">
|
||||
<div class="col-sm-10">
|
||||
<h1>
|
||||
Client Application Access
|
||||
</h1>
|
||||
<div>Below is the list of applications you have given access to and the names of the resources they have access to.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Model.Grants.Any() == false)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<div class="alert alert-info">
|
||||
You have not given access to any applications
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var grant in Model.Grants)
|
||||
{
|
||||
<div class="row grant">
|
||||
<div class="col-sm-2">
|
||||
@if (grant.ClientLogoUrl != null)
|
||||
{
|
||||
<img src="@grant.ClientLogoUrl">
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="clientname">@grant.ClientName</div>
|
||||
<div>
|
||||
<span class="created">Created:</span> @grant.Created.ToString("yyyy-MM-dd")
|
||||
</div>
|
||||
@if (grant.Expires.HasValue)
|
||||
{
|
||||
<div>
|
||||
<span class="expires">Expires:</span> @grant.Expires.Value.ToString("yyyy-MM-dd")
|
||||
</div>
|
||||
}
|
||||
@if (grant.IdentityGrantNames.Any())
|
||||
{
|
||||
<div>
|
||||
<div class="granttype">Identity Grants</div>
|
||||
<ul>
|
||||
@foreach (var name in grant.IdentityGrantNames)
|
||||
{
|
||||
<li>@name</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
@if (grant.ApiGrantNames.Any())
|
||||
{
|
||||
<div>
|
||||
<div class="granttype">API Grants</div>
|
||||
<ul>
|
||||
@foreach (var name in grant.ApiGrantNames)
|
||||
{
|
||||
<li>@name</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<form asp-action="Revoke">
|
||||
<input type="hidden" name="clientId" value="@grant.ClientId">
|
||||
<button class="btn btn-danger">Revoke Access</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -1,14 +1,10 @@
|
||||
@{
|
||||
var version = typeof(IdentityServer4.Hosting.IdentityServerMiddleware).Assembly.GetName().Version.ToString();
|
||||
}
|
||||
|
||||
<div class="welcome-page">
|
||||
<div class="row page-header">
|
||||
<div class="col-sm-10">
|
||||
<h1>
|
||||
<img class="icon" src="~/icon.jpg">
|
||||
Welcome to IdentityServer4
|
||||
<small>(version @version)</small>
|
||||
Welcome to OpenAuth.Net IdentityServer
|
||||
<small>(OpenIddict)</small>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,19 +17,5 @@
|
||||
where you can find metadata and links to all the endpoints, key material, etc.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<p>
|
||||
Click <a href="~/grants">here</a> to manage your stored grants.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<p>
|
||||
Here are links to the
|
||||
<a href="https://github.com/identityserver/IdentityServer4">source code repository</a>,
|
||||
and <a href="https://github.com/IdentityServer/IdentityServer4/tree/master/samples">ready to use samples</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Home.ErrorViewModel
|
||||
|
||||
@{
|
||||
var error = Model?.Error?.Error;
|
||||
var errorDescription = Model?.Error?.ErrorDescription;
|
||||
var request_id = Model?.Error?.RequestId;
|
||||
}
|
||||
|
||||
<div class="error-page">
|
||||
<div class="page-header">
|
||||
<h1>Error</h1>
|
||||
@@ -16,25 +10,16 @@
|
||||
<div class="alert alert-danger">
|
||||
Sorry, there was an error
|
||||
|
||||
@if (error != null)
|
||||
@if (!string.IsNullOrEmpty(Model?.ErrorId))
|
||||
{
|
||||
<strong>
|
||||
<em>
|
||||
: @error
|
||||
</em>
|
||||
</strong>
|
||||
<div>Error Id: @Model.ErrorId</div>
|
||||
}
|
||||
|
||||
if (errorDescription != null)
|
||||
{
|
||||
<div>@errorDescription</div>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(Model?.ErrorMessage))
|
||||
{
|
||||
<div>@Model.ErrorMessage</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (request_id != null)
|
||||
{
|
||||
<div class="request-id">Request Id: @request_id</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
@using IdentityServer4.Extensions
|
||||
@{
|
||||
@{
|
||||
string name = null;
|
||||
if (!true.Equals(ViewData["signed-out"]))
|
||||
{
|
||||
name = Context.User?.GetDisplayName();
|
||||
name = Context.User?.Identity?.IsAuthenticated == true ? Context.User.Identity.Name : null;
|
||||
}
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
@model OpenAuth.IdentityServer.Quickstart.Consent.ScopeViewModel
|
||||
|
||||
<li class="list-group-item">
|
||||
<label>
|
||||
<input class="consent-scopecheck"
|
||||
type="checkbox"
|
||||
name="ScopesConsented"
|
||||
id="scopes_@Model.Name"
|
||||
value="@Model.Name"
|
||||
checked="@Model.Checked"
|
||||
disabled="@Model.Required" />
|
||||
@if (Model.Required)
|
||||
{
|
||||
<input type="hidden"
|
||||
name="ScopesConsented"
|
||||
value="@Model.Name" />
|
||||
}
|
||||
<strong>@Model.DisplayName</strong>
|
||||
@if (Model.Emphasize)
|
||||
{
|
||||
<span class="glyphicon glyphicon-exclamation-sign"></span>
|
||||
}
|
||||
</label>
|
||||
@if (Model.Required)
|
||||
{
|
||||
<span><em>(required)</em></span>
|
||||
}
|
||||
@if (Model.Description != null)
|
||||
{
|
||||
<div class="consent-description">
|
||||
<label for="scopes_@Model.Name">@Model.Description</label>
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
Reference in New Issue
Block a user