47 changed files with 268 additions and 22181 deletions
@ -0,0 +1,134 @@ |
|||
/* |
|||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|||
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|||
* the license and the contributors participating to this project. |
|||
*/ |
|||
|
|||
using System; |
|||
using System.Security.Claims; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using AspNet.Security.OpenIdConnect.Extensions; |
|||
using AspNet.Security.OpenIdConnect.Server; |
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Http.Authentication; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Mvc.Server.Models; |
|||
using Mvc.Server.ViewModels.Authorization; |
|||
using OpenIddict; |
|||
|
|||
namespace Mvc.Server { |
|||
public class AuthorizationController : Controller { |
|||
private readonly OpenIddictApplicationManager<OpenIddictApplication<Guid>> _applicationManager; |
|||
private readonly SignInManager<ApplicationUser> _signInManager; |
|||
private readonly OpenIddictUserManager<ApplicationUser> _userManager; |
|||
|
|||
public AuthorizationController( |
|||
OpenIddictApplicationManager<OpenIddictApplication<Guid>> applicationManager, |
|||
SignInManager<ApplicationUser> signInManager, |
|||
OpenIddictUserManager<ApplicationUser> userManager) { |
|||
_applicationManager = applicationManager; |
|||
_signInManager = signInManager; |
|||
_userManager = userManager; |
|||
} |
|||
|
|||
[Authorize, HttpGet, Route("~/connect/authorize")] |
|||
public async Task<IActionResult> Authorize() { |
|||
// Extract the authorization request from the ASP.NET environment.
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
|
|||
// Retrieve the application details from the database.
|
|||
var application = await _applicationManager.FindByClientIdAsync(request.ClientId); |
|||
if (application == null) { |
|||
return View("Error", new ErrorViewModel { |
|||
Error = OpenIdConnectConstants.Errors.InvalidClient, |
|||
ErrorDescription = "Details concerning the calling client application cannot be found in the database" |
|||
}); |
|||
} |
|||
|
|||
return View(new AuthorizeViewModel { |
|||
ApplicationName = application.DisplayName, |
|||
Parameters = request.Parameters, |
|||
Scope = request.Scope |
|||
}); |
|||
} |
|||
|
|||
[Authorize, HttpPost("~/connect/authorize/accept"), ValidateAntiForgeryToken] |
|||
public async Task<IActionResult> Accept() { |
|||
// Extract the authorization request from the ASP.NET environment.
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
|
|||
// Retrieve the profile of the logged in user.
|
|||
var user = await _userManager.GetUserAsync(User); |
|||
if (user == null) { |
|||
return View("Error", new ErrorViewModel { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
}); |
|||
} |
|||
|
|||
// Create a new ClaimsIdentity containing the claims that
|
|||
// will be used to create an id_token, a token or a code.
|
|||
var identity = await _userManager.CreateIdentityAsync(user, request.GetScopes()); |
|||
|
|||
// Create a new authentication ticket holding the user identity.
|
|||
var ticket = new AuthenticationTicket( |
|||
new ClaimsPrincipal(identity), |
|||
new AuthenticationProperties(), |
|||
OpenIdConnectServerDefaults.AuthenticationScheme); |
|||
|
|||
ticket.SetResources(request.GetResources()); |
|||
ticket.SetScopes(request.GetScopes()); |
|||
|
|||
// Returning a SignInResult will ask OpenIddict to issue the appropriate access/identity tokens.
|
|||
return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme); |
|||
} |
|||
|
|||
[Authorize, HttpPost("~/connect/authorize/deny"), ValidateAntiForgeryToken] |
|||
public IActionResult Deny() { |
|||
// Notify OpenIddict that the authorization grant has been denied by the resource owner
|
|||
// to redirect the user agent to the client application using the appropriate response_mode.
|
|||
return Forbid(OpenIdConnectServerDefaults.AuthenticationScheme); |
|||
} |
|||
|
|||
[HttpGet("~/connect/logout")] |
|||
public IActionResult Logout() { |
|||
// Extract the authorization request from the ASP.NET environment.
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
|
|||
return View(new LogoutViewModel { |
|||
Parameters = request.Parameters |
|||
}); |
|||
} |
|||
|
|||
[HttpPost("~/connect/logout"), ValidateAntiForgeryToken] |
|||
public async Task<IActionResult> Logout(CancellationToken cancellationToken) { |
|||
// Ask ASP.NET Core Identity to delete the local and external cookies created
|
|||
// when the user agent is redirected from the external identity provider
|
|||
// after a successful authentication flow (e.g Google or Facebook).
|
|||
await _signInManager.SignOutAsync(); |
|||
|
|||
// Returning a SignOutResult will ask OpenIddict to redirect the user agent
|
|||
// to the post_logout_redirect_uri specified by the client application.
|
|||
return SignOut(OpenIdConnectServerDefaults.AuthenticationScheme); |
|||
} |
|||
|
|||
[HttpGet, HttpPost, Route("~/connect/error")] |
|||
public IActionResult Error() { |
|||
var response = HttpContext.GetOpenIdConnectResponse(); |
|||
if (response == null) { |
|||
return View(new ErrorViewModel { |
|||
Error = OpenIdConnectConstants.Errors.InvalidRequest |
|||
}); |
|||
} |
|||
|
|||
return View(new ErrorViewModel { |
|||
Error = response.Error, |
|||
ErrorDescription = response.ErrorDescription |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Microsoft.AspNetCore.Mvc.ModelBinding; |
|||
|
|||
namespace Mvc.Server.ViewModels.Authorization { |
|||
public class AuthorizeViewModel { |
|||
[Display(Name = "Application")] |
|||
public string ApplicationName { get; set; } |
|||
|
|||
[BindNever] |
|||
public IDictionary<string, string> Parameters { get; set; } |
|||
|
|||
[Display(Name = "Scope")] |
|||
public string Scope { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Mvc.Server.ViewModels.Authorization { |
|||
public class ErrorViewModel { |
|||
[Display(Name = "Error")] |
|||
public string Error { get; set; } |
|||
|
|||
[Display(Name = "Description")] |
|||
public string ErrorDescription { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System.Collections.Generic; |
|||
using Microsoft.AspNetCore.Mvc.ModelBinding; |
|||
|
|||
namespace Mvc.Server.ViewModels.Authorization { |
|||
public class LogoutViewModel { |
|||
[BindNever] |
|||
public IDictionary<string, string> Parameters { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
@model AuthorizeViewModel |
|||
|
|||
<div class="jumbotron"> |
|||
<h1>Authorization</h1> |
|||
|
|||
<p class="lead text-left">Do you want to grant <strong>@Model.ApplicationName</strong> access to your data? (scopes requested: @Model.Scope)</p> |
|||
|
|||
<form method="post"> |
|||
@Html.AntiForgeryToken() |
|||
|
|||
@foreach (var parameter in Model.Parameters) { |
|||
<input type="hidden" name="@parameter.Key" value="@parameter.Value" /> |
|||
} |
|||
|
|||
<input formaction="@Url.Action("Accept")" class="btn btn-lg btn-success" name="Authorize" type="submit" value="Yes" /> |
|||
<input formaction="@Url.Action("Deny")" class="btn btn-lg btn-danger" name="Deny" type="submit" value="No" /> |
|||
</form> |
|||
</div> |
|||
@ -1,10 +1,10 @@ |
|||
@using Microsoft.IdentityModel.Protocols.OpenIdConnect |
|||
@model OpenIdConnectMessage |
|||
@model ErrorViewModel |
|||
|
|||
<div class="jumbotron"> |
|||
<h2>Ooooops, something went really bad with your OpenID Connect request! :(</h2> |
|||
<p class="lead text-left"> |
|||
<strong>@Model.Error</strong> |
|||
|
|||
@if (!string.IsNullOrEmpty(Model.ErrorDescription)) { |
|||
<small>@Model.ErrorDescription</small> |
|||
} |
|||
@ -1,14 +1,8 @@ |
|||
@using Microsoft.IdentityModel.Protocols.OpenIdConnect |
|||
@model OpenIdConnectMessage |
|||
|
|||
<div class="jumbotron"> |
|||
<div class="jumbotron"> |
|||
<h1>Log out</h1> |
|||
<p class="lead text-left">Are you sure you want to sign out?</p> |
|||
|
|||
<form action="@Url.Action("Signout", "Authorization")" enctype="application/x-www-form-urlencoded" method="post"> |
|||
@Html.AntiForgeryToken() |
|||
|
|||
@* Flow the logout request *@ |
|||
<form asp-controller="Authorization" asp-action="Logout" method="post"> |
|||
@foreach (var parameter in Model.Parameters) { |
|||
<input type="hidden" name="@parameter.Key" value="@parameter.Value" /> |
|||
} |
|||
@ -1,6 +1,7 @@ |
|||
@using Mvc.Server |
|||
@using Mvc.Server.Models |
|||
@using Mvc.Server.ViewModels.Account |
|||
@using Mvc.Server.ViewModels.Authorization |
|||
@using Mvc.Server.ViewModels.Manage |
|||
@using Microsoft.AspNetCore.Identity |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
|
|||
@ -1,18 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> |
|||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> |
|||
<PropertyGroup Label="Globals"> |
|||
<ProjectGuid>86293e11-dd31-4d54-bcad-8788b5c9972f</ProjectGuid> |
|||
<RootNamespace>OpenIddict.Assets</RootNamespace> |
|||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> |
|||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> |
|||
</Project> |
|||
@ -1,31 +0,0 @@ |
|||
/* |
|||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|||
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|||
* the license and the contributors participating to this project. |
|||
*/ |
|||
|
|||
using System; |
|||
using System.Reflection; |
|||
using JetBrains.Annotations; |
|||
using Microsoft.Extensions.FileProviders; |
|||
|
|||
namespace Microsoft.AspNetCore.Builder { |
|||
public static class OpenIddictExtensions { |
|||
/// <summary>
|
|||
/// Registers the assets module, including the default HTML/CSS files used by the MVC module.
|
|||
/// </summary>
|
|||
/// <param name="builder">The services builder used by OpenIddict to register new services.</param>
|
|||
/// <returns>The <see cref="OpenIddictBuilder"/>.</returns>
|
|||
public static OpenIddictBuilder AddAssets([NotNull] this OpenIddictBuilder builder) { |
|||
if (builder == null) { |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
return builder.AddModule("Assets", -20, app => app.UseStaticFiles(new StaticFileOptions { |
|||
FileProvider = new EmbeddedFileProvider( |
|||
assembly: Assembly.Load(new AssemblyName("OpenIddict.Assets")), |
|||
baseNamespace: "OpenIddict.Assets") |
|||
})); |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
Binary file not shown.
@ -1,60 +0,0 @@ |
|||
{ |
|||
"version": "1.0.0-alpha2-*", |
|||
|
|||
"description": "Contains the default assets used by OpenIddict.", |
|||
"authors": [ "Kévin Chalet" ], |
|||
|
|||
"packOptions": { |
|||
"owners": [ "Kévin Chalet" ], |
|||
|
|||
"projectUrl": "https://github.com/openiddict/openiddict-core", |
|||
"iconUrl": "https://avatars3.githubusercontent.com/u/13908567?s=64", |
|||
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html", |
|||
|
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/openiddict/openiddict-core" |
|||
}, |
|||
|
|||
"tags": [ |
|||
"aspnetcore", |
|||
"authentication", |
|||
"jwt", |
|||
"openidconnect", |
|||
"openiddict", |
|||
"security" |
|||
] |
|||
}, |
|||
|
|||
"buildOptions": { |
|||
"warningsAsErrors": true, |
|||
"nowarn": [ "CS1591" ], |
|||
"xmlDoc": true, |
|||
|
|||
"embed": { |
|||
"include": [ |
|||
"fonts/*", |
|||
"scripts/*", |
|||
"stylesheets/*" |
|||
] |
|||
} |
|||
}, |
|||
|
|||
"dependencies": { |
|||
"JetBrains.Annotations": { "type": "build", "version": "10.1.4" }, |
|||
"Microsoft.AspNetCore.StaticFiles": "1.0.0", |
|||
"Microsoft.Extensions.FileProviders.Embedded": "1.0.0", |
|||
"OpenIddict.Core": { "target": "project" } |
|||
}, |
|||
|
|||
"frameworks": { |
|||
"net451": { }, |
|||
|
|||
"netstandard1.4": { |
|||
"imports": [ |
|||
"dotnet5.5", |
|||
"portable-net451+win8" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,442 +0,0 @@ |
|||
/*! |
|||
* Bootstrap v3.2.0 (http://getbootstrap.com) |
|||
* Copyright 2011-2014 Twitter, Inc. |
|||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
|||
*/ |
|||
|
|||
.btn-default, |
|||
.btn-primary, |
|||
.btn-success, |
|||
.btn-info, |
|||
.btn-warning, |
|||
.btn-danger { |
|||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); |
|||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); |
|||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); |
|||
} |
|||
.btn-default:active, |
|||
.btn-primary:active, |
|||
.btn-success:active, |
|||
.btn-info:active, |
|||
.btn-warning:active, |
|||
.btn-danger:active, |
|||
.btn-default.active, |
|||
.btn-primary.active, |
|||
.btn-success.active, |
|||
.btn-info.active, |
|||
.btn-warning.active, |
|||
.btn-danger.active { |
|||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); |
|||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); |
|||
} |
|||
.btn:active, |
|||
.btn.active { |
|||
background-image: none; |
|||
} |
|||
.btn-default { |
|||
text-shadow: 0 1px 0 #fff; |
|||
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); |
|||
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0)); |
|||
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #dbdbdb; |
|||
border-color: #ccc; |
|||
} |
|||
.btn-default:hover, |
|||
.btn-default:focus { |
|||
background-color: #e0e0e0; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-default:active, |
|||
.btn-default.active { |
|||
background-color: #e0e0e0; |
|||
border-color: #dbdbdb; |
|||
} |
|||
.btn-default:disabled, |
|||
.btn-default[disabled] { |
|||
background-color: #e0e0e0; |
|||
background-image: none; |
|||
} |
|||
.btn-primary { |
|||
background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%); |
|||
background-image: -o-linear-gradient(top, #428bca 0%, #2d6ca2 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#2d6ca2)); |
|||
background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #2b669a; |
|||
} |
|||
.btn-primary:hover, |
|||
.btn-primary:focus { |
|||
background-color: #2d6ca2; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-primary:active, |
|||
.btn-primary.active { |
|||
background-color: #2d6ca2; |
|||
border-color: #2b669a; |
|||
} |
|||
.btn-primary:disabled, |
|||
.btn-primary[disabled] { |
|||
background-color: #2d6ca2; |
|||
background-image: none; |
|||
} |
|||
.btn-success { |
|||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); |
|||
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641)); |
|||
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #3e8f3e; |
|||
} |
|||
.btn-success:hover, |
|||
.btn-success:focus { |
|||
background-color: #419641; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-success:active, |
|||
.btn-success.active { |
|||
background-color: #419641; |
|||
border-color: #3e8f3e; |
|||
} |
|||
.btn-success:disabled, |
|||
.btn-success[disabled] { |
|||
background-color: #419641; |
|||
background-image: none; |
|||
} |
|||
.btn-info { |
|||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); |
|||
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2)); |
|||
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #28a4c9; |
|||
} |
|||
.btn-info:hover, |
|||
.btn-info:focus { |
|||
background-color: #2aabd2; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-info:active, |
|||
.btn-info.active { |
|||
background-color: #2aabd2; |
|||
border-color: #28a4c9; |
|||
} |
|||
.btn-info:disabled, |
|||
.btn-info[disabled] { |
|||
background-color: #2aabd2; |
|||
background-image: none; |
|||
} |
|||
.btn-warning { |
|||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); |
|||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316)); |
|||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #e38d13; |
|||
} |
|||
.btn-warning:hover, |
|||
.btn-warning:focus { |
|||
background-color: #eb9316; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-warning:active, |
|||
.btn-warning.active { |
|||
background-color: #eb9316; |
|||
border-color: #e38d13; |
|||
} |
|||
.btn-warning:disabled, |
|||
.btn-warning[disabled] { |
|||
background-color: #eb9316; |
|||
background-image: none; |
|||
} |
|||
.btn-danger { |
|||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); |
|||
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a)); |
|||
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-color: #b92c28; |
|||
} |
|||
.btn-danger:hover, |
|||
.btn-danger:focus { |
|||
background-color: #c12e2a; |
|||
background-position: 0 -15px; |
|||
} |
|||
.btn-danger:active, |
|||
.btn-danger.active { |
|||
background-color: #c12e2a; |
|||
border-color: #b92c28; |
|||
} |
|||
.btn-danger:disabled, |
|||
.btn-danger[disabled] { |
|||
background-color: #c12e2a; |
|||
background-image: none; |
|||
} |
|||
.thumbnail, |
|||
.img-thumbnail { |
|||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); |
|||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075); |
|||
} |
|||
.dropdown-menu > li > a:hover, |
|||
.dropdown-menu > li > a:focus { |
|||
background-color: #e8e8e8; |
|||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); |
|||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); |
|||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.dropdown-menu > .active > a, |
|||
.dropdown-menu > .active > a:hover, |
|||
.dropdown-menu > .active > a:focus { |
|||
background-color: #357ebd; |
|||
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); |
|||
background-image: -o-linear-gradient(top, #428bca 0%, #357ebd 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#357ebd)); |
|||
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.navbar-default { |
|||
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%); |
|||
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8)); |
|||
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
border-radius: 4px; |
|||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); |
|||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); |
|||
} |
|||
.navbar-default .navbar-nav > .active > a { |
|||
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%); |
|||
background-image: -o-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f3f3f3)); |
|||
background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); |
|||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); |
|||
} |
|||
.navbar-brand, |
|||
.navbar-nav > li > a { |
|||
text-shadow: 0 1px 0 rgba(255, 255, 255, .25); |
|||
} |
|||
.navbar-inverse { |
|||
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%); |
|||
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222)); |
|||
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.navbar-inverse .navbar-nav > .active > a { |
|||
background-image: -webkit-linear-gradient(top, #222 0%, #282828 100%); |
|||
background-image: -o-linear-gradient(top, #222 0%, #282828 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#222), to(#282828)); |
|||
background-image: linear-gradient(to bottom, #222 0%, #282828 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); |
|||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); |
|||
} |
|||
.navbar-inverse .navbar-brand, |
|||
.navbar-inverse .navbar-nav > li > a { |
|||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25); |
|||
} |
|||
.navbar-static-top, |
|||
.navbar-fixed-top, |
|||
.navbar-fixed-bottom { |
|||
border-radius: 0; |
|||
} |
|||
.alert { |
|||
text-shadow: 0 1px 0 rgba(255, 255, 255, .2); |
|||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); |
|||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); |
|||
} |
|||
.alert-success { |
|||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); |
|||
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc)); |
|||
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #b2dba1; |
|||
} |
|||
.alert-info { |
|||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); |
|||
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0)); |
|||
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #9acfea; |
|||
} |
|||
.alert-warning { |
|||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); |
|||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0)); |
|||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #f5e79e; |
|||
} |
|||
.alert-danger { |
|||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); |
|||
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3)); |
|||
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #dca7a7; |
|||
} |
|||
.progress { |
|||
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); |
|||
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5)); |
|||
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar { |
|||
background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%); |
|||
background-image: -o-linear-gradient(top, #428bca 0%, #3071a9 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#3071a9)); |
|||
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar-success { |
|||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); |
|||
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44)); |
|||
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar-info { |
|||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); |
|||
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5)); |
|||
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar-warning { |
|||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); |
|||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f)); |
|||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar-danger { |
|||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); |
|||
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c)); |
|||
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.progress-bar-striped { |
|||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); |
|||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); |
|||
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); |
|||
} |
|||
.list-group { |
|||
border-radius: 4px; |
|||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); |
|||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075); |
|||
} |
|||
.list-group-item.active, |
|||
.list-group-item.active:hover, |
|||
.list-group-item.active:focus { |
|||
text-shadow: 0 -1px 0 #3071a9; |
|||
background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%); |
|||
background-image: -o-linear-gradient(top, #428bca 0%, #3278b3 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#3278b3)); |
|||
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #3278b3; |
|||
} |
|||
.panel { |
|||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05); |
|||
box-shadow: 0 1px 2px rgba(0, 0, 0, .05); |
|||
} |
|||
.panel-default > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); |
|||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); |
|||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.panel-primary > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%); |
|||
background-image: -o-linear-gradient(top, #428bca 0%, #357ebd 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#357ebd)); |
|||
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.panel-success > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); |
|||
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6)); |
|||
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.panel-info > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); |
|||
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3)); |
|||
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.panel-warning > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); |
|||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc)); |
|||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.panel-danger > .panel-heading { |
|||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); |
|||
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc)); |
|||
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
} |
|||
.well { |
|||
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); |
|||
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); |
|||
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5)); |
|||
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); |
|||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); |
|||
background-repeat: repeat-x; |
|||
border-color: #dcdcdc; |
|||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); |
|||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); |
|||
} |
|||
/*# sourceMappingURL=bootstrap-theme.css.map */ |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,79 +0,0 @@ |
|||
/* Space out content a bit */ |
|||
body { |
|||
padding-top: 20px; |
|||
padding-bottom: 20px; |
|||
} |
|||
|
|||
/* Everything but the jumbotron gets side spacing for mobile first views */ |
|||
.header, |
|||
.marketing, |
|||
.footer { |
|||
padding-right: 15px; |
|||
padding-left: 15px; |
|||
} |
|||
|
|||
/* Custom page header */ |
|||
.header { |
|||
border-bottom: 1px solid #e5e5e5; |
|||
} |
|||
/* Make the masthead heading the same height as the navigation */ |
|||
.header h3 { |
|||
padding-bottom: 19px; |
|||
margin-top: 0; |
|||
margin-bottom: 0; |
|||
line-height: 40px; |
|||
} |
|||
|
|||
/* Custom page footer */ |
|||
.footer { |
|||
padding-top: 19px; |
|||
color: #777; |
|||
border-top: 1px solid #e5e5e5; |
|||
} |
|||
|
|||
/* Customize container */ |
|||
@media (min-width: 768px) { |
|||
.container { |
|||
max-width: 730px; |
|||
} |
|||
} |
|||
.container-narrow > hr { |
|||
margin: 30px 0; |
|||
} |
|||
|
|||
/* Main marketing message and sign up button */ |
|||
.jumbotron { |
|||
text-align: center; |
|||
border-bottom: 1px solid #e5e5e5; |
|||
} |
|||
.jumbotron .btn { |
|||
padding: 14px 24px; |
|||
font-size: 21px; |
|||
} |
|||
|
|||
/* Supporting marketing content */ |
|||
.marketing { |
|||
margin: 40px 0; |
|||
} |
|||
.marketing p + h4 { |
|||
margin-top: 28px; |
|||
} |
|||
|
|||
/* Responsive: Portrait tablets and up */ |
|||
@media screen and (min-width: 768px) { |
|||
/* Remove the padding we set earlier */ |
|||
.header, |
|||
.marketing, |
|||
.footer { |
|||
padding-right: 0; |
|||
padding-left: 0; |
|||
} |
|||
/* Space out the masthead */ |
|||
.header { |
|||
margin-bottom: 30px; |
|||
} |
|||
/* Remove the bottom border on the jumbotron for visual effect */ |
|||
.jumbotron { |
|||
border-bottom: 0; |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> |
|||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> |
|||
<PropertyGroup Label="Globals"> |
|||
<ProjectGuid>7ae46e2f-e93b-4ff9-b941-6cd7a3e1bf84</ProjectGuid> |
|||
<RootNamespace>OpenIddict.Mvc</RootNamespace> |
|||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> |
|||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> |
|||
</Project> |
|||
@ -1,167 +0,0 @@ |
|||
/* |
|||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|||
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|||
* the license and the contributors participating to this project. |
|||
*/ |
|||
|
|||
using System; |
|||
using System.Security.Claims; |
|||
using System.Threading.Tasks; |
|||
using AspNet.Security.OpenIdConnect.Extensions; |
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Http.Authentication; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Options; |
|||
using Microsoft.IdentityModel.Protocols.OpenIdConnect; |
|||
|
|||
namespace OpenIddict.Mvc { |
|||
// Note: this controller is generic and doesn't need to be marked as internal to prevent MVC from discovering it.
|
|||
public class OpenIddictController<TUser, TApplication, TAuthorization, TToken> : Controller |
|||
where TUser : class where TApplication : class where TAuthorization : class where TToken : class { |
|||
[Authorize, HttpGet, HttpPost] |
|||
public virtual async Task<IActionResult> Authorize([FromServices] OpenIddictApplicationManager<TApplication> applications) { |
|||
// Note: when a fatal error occurs during the request processing, an OpenID Connect response
|
|||
// is prematurely forged and added to the ASP.NET Core context by OpenIdConnectServerHandler.
|
|||
var response = HttpContext.GetOpenIdConnectResponse(); |
|||
if (response != null) { |
|||
return View("Error", response); |
|||
} |
|||
|
|||
// Extract the authorization request from the ASP.NET environment.
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
if (request == null) { |
|||
return View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
}); |
|||
} |
|||
|
|||
// Note: the OpenID Connect server middleware automatically ensures an application
|
|||
// corresponds to the client_id specified in the authorization request using
|
|||
// IOpenIdConnectServerProvider.ValidateAuthorizationRequest (see OpenIddictProvider.cs).
|
|||
var application = await applications.FindByClientIdAsync(request.ClientId); |
|||
if (application == null) { |
|||
return View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.InvalidClient, |
|||
ErrorDescription = "Details concerning the calling client application cannot be found in the database" |
|||
}); |
|||
} |
|||
|
|||
return View("Authorize", Tuple.Create(request, await applications.GetDisplayNameAsync(application))); |
|||
} |
|||
|
|||
[Authorize, HttpPost, ValidateAntiForgeryToken] |
|||
public virtual async Task<IActionResult> Accept( |
|||
[FromServices] OpenIddictUserManager<TUser> users, |
|||
[FromServices] OpenIddictApplicationManager<TApplication> applications, |
|||
[FromServices] IOptions<OpenIddictOptions> options) { |
|||
var response = HttpContext.GetOpenIdConnectResponse(); |
|||
if (response != null) { |
|||
return View("Error", response); |
|||
} |
|||
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
if (request == null) { |
|||
return View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
}); |
|||
} |
|||
|
|||
// Retrieve the user data using the unique identifier.
|
|||
var user = await users.GetUserAsync(User); |
|||
if (user == null) { |
|||
return View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
}); |
|||
} |
|||
|
|||
// Create a new ClaimsIdentity containing the claims that
|
|||
// will be used to create an id_token, a token or a code.
|
|||
var identity = await users.CreateIdentityAsync(user, request.GetScopes()); |
|||
if (identity == null) { |
|||
throw new InvalidOperationException("The authorization request was aborted because the user manager returned " + |
|||
$"a null identity for user '{await users.GetUserNameAsync(user)}'."); |
|||
} |
|||
|
|||
var application = await applications.FindByClientIdAsync(request.ClientId); |
|||
if (application == null) { |
|||
return View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.InvalidClient, |
|||
ErrorDescription = "Details concerning the calling client application cannot be found in the database" |
|||
}); |
|||
} |
|||
|
|||
// Create a new authentication ticket holding the user identity.
|
|||
var ticket = new AuthenticationTicket( |
|||
new ClaimsPrincipal(identity), |
|||
new AuthenticationProperties(), |
|||
options.Value.AuthenticationScheme); |
|||
|
|||
ticket.SetResources(request.GetResources()); |
|||
ticket.SetScopes(request.GetScopes()); |
|||
|
|||
// Returning a SignInResult will ask the OpenID Connect server middleware to issue the appropriate tokens.
|
|||
// Note: you should always make sure the identities you return contain ClaimTypes.NameIdentifier claim.
|
|||
// In this sample, the identity always contains the name identifier returned by the external provider.
|
|||
return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme); |
|||
} |
|||
|
|||
[Authorize, HttpPost, ValidateAntiForgeryToken] |
|||
public virtual Task<IActionResult> Deny([FromServices] IOptions<OpenIddictOptions> options) { |
|||
var response = HttpContext.GetOpenIdConnectResponse(); |
|||
if (response != null) { |
|||
return Task.FromResult<IActionResult>(View("Error", response)); |
|||
} |
|||
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
if (request == null) { |
|||
return Task.FromResult<IActionResult>(View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
})); |
|||
} |
|||
|
|||
// Notify the OpenID Connect server middleware that the authorization grant
|
|||
// has been denied by the resource owner to redirect user agent to
|
|||
// the client application using the appropriate response_mode.
|
|||
return Task.FromResult<IActionResult>(Forbid(options.Value.AuthenticationScheme)); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public virtual Task<IActionResult> Logout() { |
|||
var response = HttpContext.GetOpenIdConnectResponse(); |
|||
if (response != null) { |
|||
return Task.FromResult<IActionResult>(View("Error", response)); |
|||
} |
|||
|
|||
var request = HttpContext.GetOpenIdConnectRequest(); |
|||
if (request == null) { |
|||
return Task.FromResult<IActionResult>(View("Error", new OpenIdConnectMessage { |
|||
Error = OpenIdConnectConstants.Errors.ServerError, |
|||
ErrorDescription = "An internal error has occurred" |
|||
})); |
|||
} |
|||
|
|||
return Task.FromResult<IActionResult>(View("Logout", request)); |
|||
} |
|||
|
|||
[ActionName(nameof(Logout)), HttpPost, ValidateAntiForgeryToken] |
|||
public virtual async Task<IActionResult> Signout( |
|||
[FromServices] SignInManager<TUser> signin, |
|||
[FromServices] IOptions<OpenIddictOptions> options) { |
|||
// Instruct the cookies middleware to delete the local cookie created
|
|||
// when the user agent is redirected from the external identity provider
|
|||
// after a successful authentication flow (e.g Google or Facebook).
|
|||
await signin.SignOutAsync(); |
|||
|
|||
// Returning a SignOutResult will ask the OpenID Connect server middleware to redirect
|
|||
// the user agent to the post_logout_redirect_uri specified by the client application.
|
|||
return SignOut(options.Value.AuthenticationScheme); |
|||
} |
|||
} |
|||
} |
|||
@ -1,258 +0,0 @@ |
|||
/* |
|||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|||
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|||
* the license and the contributors participating to this project. |
|||
*/ |
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using AspNet.Security.OpenIdConnect.Server; |
|||
using JetBrains.Annotations; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.ApplicationModels; |
|||
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.DependencyModel; |
|||
using Microsoft.Extensions.FileProviders; |
|||
using Microsoft.Extensions.Options; |
|||
using OpenIddict; |
|||
using OpenIddict.Infrastructure; |
|||
using OpenIddict.Mvc; |
|||
|
|||
namespace Microsoft.AspNetCore.Builder { |
|||
public static class OpenIddictExtensions { |
|||
/// <summary>
|
|||
/// Registers the MVC module, including the built-in
|
|||
/// authorization controller and the default consent views.
|
|||
/// </summary>
|
|||
/// <param name="builder">The services builder used by OpenIddict to register new services.</param>
|
|||
/// <returns>The <see cref="OpenIddictBuilder"/>.</returns>
|
|||
public static OpenIddictBuilder AddMvc([NotNull] this OpenIddictBuilder builder) { |
|||
if (builder == null) { |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
builder.Services.AddMvc(); |
|||
|
|||
builder.Configure(options => { |
|||
// Set ApplicationCanDisplayErrors to true to allow OpenIddictController
|
|||
// to intercept the error responses returned by the OpenID Connect server.
|
|||
options.ApplicationCanDisplayErrors = true; |
|||
|
|||
if (!options.AuthorizationEndpointPath.HasValue) { |
|||
// Restore the default authorization endpoint path in the OpenIddict options.
|
|||
options.AuthorizationEndpointPath = OpenIdConnectServerDefaults.AuthorizationEndpointPath; |
|||
} |
|||
|
|||
if (!options.LogoutEndpointPath.HasValue) { |
|||
// Restore the default logout endpoint path in the OpenIddict options.
|
|||
options.LogoutEndpointPath = OpenIdConnectServerDefaults.LogoutEndpointPath; |
|||
} |
|||
}); |
|||
|
|||
// Run the MVC module in an isolated environment.
|
|||
return builder.AddModule("MVC", 10, app => app.Isolate(map => map.UseMvc(routes => { |
|||
var options = app.ApplicationServices.GetRequiredService<IOptions<OpenIddictOptions>>().Value; |
|||
|
|||
// Register the actions corresponding to the authorization endpoint.
|
|||
if (options.AuthorizationEndpointPath.HasValue) { |
|||
routes.MapRoute("{D97891B4}", options.AuthorizationEndpointPath.Value.Substring(1), new { |
|||
controller = "OpenIddict", action = nameof(OpenIddictController<object, object, object, object>.Authorize) |
|||
}); |
|||
|
|||
routes.MapRoute("{7148DB83}", options.AuthorizationEndpointPath.Value.Substring(1) + "/accept", new { |
|||
controller = "OpenIddict", action = nameof(OpenIddictController<object, object, object, object>.Accept) |
|||
}); |
|||
|
|||
routes.MapRoute("{23438BCC}", options.AuthorizationEndpointPath.Value.Substring(1) + "/deny", new { |
|||
controller = "OpenIddict", action = nameof(OpenIddictController<object, object, object, object>.Deny) |
|||
}); |
|||
} |
|||
|
|||
// Register the action corresponding to the logout endpoint.
|
|||
if (options.LogoutEndpointPath.HasValue) { |
|||
routes.MapRoute("{C7DB102A}", options.LogoutEndpointPath.Value.Substring(1), new { |
|||
controller = "OpenIddict", action = nameof(OpenIddictController<object, object, object, object>.Logout) |
|||
}); |
|||
} |
|||
}), services => { |
|||
services.AddMvc() |
|||
// Note: ConfigureApplicationPartManager() must be
|
|||
// called before AddControllersAsServices().
|
|||
.ConfigureApplicationPartManager(manager => { |
|||
var parts = manager.ApplicationParts.ToArray(); |
|||
|
|||
manager.ApplicationParts.Clear(); |
|||
manager.ApplicationParts.Add(new OpenIddictPart(builder, parts)); |
|||
}) |
|||
|
|||
.AddControllersAsServices() |
|||
|
|||
// Add an OpenIddict-specific convention to ensure that the generic
|
|||
// OpenIddictController gets an appropriate controller name.
|
|||
.AddMvcOptions(options => options.Conventions.Add(new OpenIddictConvention())) |
|||
|
|||
.AddRazorOptions(options => { |
|||
// Update the Razor options to also use an embedded file provider that
|
|||
// falls back to the current assembly when searching for views.
|
|||
options.FileProviders.Add(new EmbeddedFileProvider( |
|||
assembly: typeof(OpenIddictController<,,,>).GetTypeInfo().Assembly, |
|||
baseNamespace: typeof(OpenIddictController<,,,>).Namespace)); |
|||
}); |
|||
|
|||
// Register the application manager in the isolated container.
|
|||
services.AddScoped(typeof(OpenIddictApplicationManager<>).MakeGenericType(builder.ApplicationType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the application manager from the parent container.
|
|||
return container.GetRequiredService(typeof(OpenIddictApplicationManager<>).MakeGenericType(builder.ApplicationType)); |
|||
}); |
|||
|
|||
// Register the authorization manager in the isolated container.
|
|||
services.AddScoped(typeof(OpenIddictAuthorizationManager<>).MakeGenericType(builder.AuthorizationType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the authorization manager from the parent container.
|
|||
return container.GetRequiredService(typeof(OpenIddictAuthorizationManager<>).MakeGenericType(builder.AuthorizationType)); |
|||
}); |
|||
|
|||
// Register the token manager in the isolated container.
|
|||
services.AddScoped(typeof(OpenIddictTokenManager<>).MakeGenericType(builder.TokenType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the token manager from the parent container.
|
|||
return container.GetRequiredService(typeof(OpenIddictTokenManager<>).MakeGenericType(builder.TokenType)); |
|||
}); |
|||
|
|||
// Register the user manager in the isolated container.
|
|||
services.AddScoped(typeof(OpenIddictUserManager<>).MakeGenericType(builder.UserType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the user manager from the parent container.
|
|||
return container.GetRequiredService(typeof(OpenIddictUserManager<>).MakeGenericType(builder.UserType)); |
|||
}); |
|||
|
|||
// Register the sign-in manager in the isolated container.
|
|||
services.AddScoped(typeof(SignInManager<>).MakeGenericType(builder.UserType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the sign-in manager from the parent container.
|
|||
return container.GetRequiredService(typeof(SignInManager<>).MakeGenericType(builder.UserType)); |
|||
}); |
|||
|
|||
// Register the user manager in the isolated container.
|
|||
services.AddScoped(typeof(UserManager<>).MakeGenericType(builder.UserType), provider => { |
|||
return provider.GetRequiredService(typeof(OpenIddictUserManager<>).MakeGenericType(builder.UserType)); |
|||
}); |
|||
|
|||
// Register the OpenIddict services in the isolated container.
|
|||
services.AddScoped(typeof(OpenIddictServices<,,,,>).MakeGenericType( |
|||
/* TUser: */ builder.UserType, |
|||
/* TApplication: */ builder.ApplicationType, |
|||
/* TAuthorization: */ builder.AuthorizationType, |
|||
/* TScope: */ builder.ScopeType, |
|||
/* TToken: */ builder.TokenType), provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the OpenIddict services from the parent container.
|
|||
return container.GetRequiredService(typeof(OpenIddictServices<,,,,>).MakeGenericType( |
|||
/* TUser: */ builder.UserType, |
|||
/* TApplication: */ builder.ApplicationType, |
|||
/* TAuthorization: */ builder.AuthorizationType, |
|||
/* TScope: */ builder.ScopeType, |
|||
/* TToken: */ builder.TokenType)); |
|||
}); |
|||
|
|||
// Register the options in the isolated container.
|
|||
services.AddSingleton(provider => { |
|||
var accessor = provider.GetRequiredService<IHttpContextAccessor>(); |
|||
var container = (IServiceProvider) accessor.HttpContext.Items[typeof(IServiceProvider)]; |
|||
Debug.Assert(container != null, "The parent DI container cannot be resolved from the HTTP context."); |
|||
|
|||
// Resolve the user manager from the parent container.
|
|||
return container.GetRequiredService<IOptions<OpenIddictOptions>>(); |
|||
}); |
|||
})); |
|||
} |
|||
|
|||
private class OpenIddictConvention : IControllerModelConvention { |
|||
public void Apply(ControllerModel controller) { |
|||
// Ensure the convention is only applied to the intended controller.
|
|||
if (controller.ControllerType != null && |
|||
controller.ControllerType.IsGenericType && |
|||
controller.ControllerType.GetGenericTypeDefinition() == typeof(OpenIddictController<,,,>)) { |
|||
// Note: manually updating the controller name is required
|
|||
// to remove the ending markers added to the generic type name.
|
|||
controller.ControllerName = "OpenIddict"; |
|||
} |
|||
} |
|||
} |
|||
|
|||
private class OpenIddictPart : ApplicationPart, IApplicationPartTypeProvider, ICompilationReferencesProvider { |
|||
public OpenIddictPart(OpenIddictBuilder builder, IEnumerable<ApplicationPart> parts) { |
|||
var types = new List<TypeInfo> { |
|||
typeof(OpenIddictController<,,,>).MakeGenericType( |
|||
/* TUser: */ builder.UserType, |
|||
/* TApplication: */ builder.ApplicationType, |
|||
/* TAuthorization: */ builder.AuthorizationType, |
|||
/* TToken: */ builder.TokenType).GetTypeInfo() |
|||
}; |
|||
|
|||
var assemblies = new List<Assembly>(); |
|||
|
|||
foreach (var part in parts.OfType<AssemblyPart>()) { |
|||
assemblies.Add(part.Assembly); |
|||
|
|||
foreach (var type in part.Types) { |
|||
if (typeof(ControllerBase).GetTypeInfo().IsAssignableFrom(type)) { |
|||
continue; |
|||
} |
|||
|
|||
types.Add(type); |
|||
} |
|||
} |
|||
|
|||
Assemblies = assemblies; |
|||
Types = types; |
|||
} |
|||
|
|||
public override string Name { get; } = "OpenIddict.Mvc"; |
|||
|
|||
public IEnumerable<Assembly> Assemblies { get; } |
|||
|
|||
public IEnumerable<TypeInfo> Types { get; } |
|||
|
|||
public IEnumerable<string> GetReferencePaths() { |
|||
foreach (var assembly in Assemblies) { |
|||
var context = DependencyContext.Load(assembly); |
|||
if (context == null) { |
|||
continue; |
|||
} |
|||
|
|||
foreach (var library in context.CompileLibraries) { |
|||
foreach (var path in library.ResolveReferencePaths()) { |
|||
yield return path; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
@using AspNet.Security.OpenIdConnect.Extensions |
|||
@using Microsoft.IdentityModel.Protocols.OpenIdConnect |
|||
|
|||
@model Tuple<OpenIdConnectMessage, string> |
|||
|
|||
<div class="jumbotron"> |
|||
<h1>Authorization</h1> |
|||
|
|||
<p class="lead text-left">Do you want to grant <strong>@Model.Item2</strong> access to your data? (scopes requested: @Model.Item1.Scope)</p> |
|||
|
|||
@if (!string.IsNullOrEmpty(Model.Item1.Resource)) { |
|||
<p class="lead text-left"><strong>@Model.Item2</strong> will be able to access the following endpoints: @string.Join(" ; ", Model.Item1.GetResources())</p> |
|||
} |
|||
|
|||
<form enctype="application/x-www-form-urlencoded" method="post"> |
|||
@Html.AntiForgeryToken() |
|||
|
|||
@foreach (var parameter in Model.Item1.Parameters) { |
|||
<input type="hidden" name="@parameter.Key" value="@parameter.Value" /> |
|||
} |
|||
|
|||
<input formaction="@Url.Action("Accept")" class="btn btn-lg btn-success" name="Authorize" type="submit" value="Yes" /> |
|||
<input formaction="@Url.Action("Deny")" class="btn btn-lg btn-danger" name="Deny" type="submit" value="No" /> |
|||
</form> |
|||
</div> |
|||
@ -1,12 +0,0 @@ |
|||
@using Microsoft.IdentityModel.Protocols.OpenIdConnect |
|||
@model OpenIdConnectMessage |
|||
|
|||
<div class="jumbotron"> |
|||
<h1>An OpenID Connect error has occurred</h1> |
|||
<p class="lead text-left"> |
|||
<strong>@Model.Error</strong> |
|||
@if (!string.IsNullOrEmpty(Model.ErrorDescription)) { |
|||
<small>@Model.ErrorDescription</small> |
|||
} |
|||
</p> |
|||
</div> |
|||
@ -1,16 +0,0 @@ |
|||
@using Microsoft.AspNetCore.Http.Authentication |
|||
@model IEnumerable<AuthenticationDescription> |
|||
|
|||
<div class="jumbotron"> |
|||
<h1>Authentication</h1> |
|||
<p class="lead text-left">Sign in using one of these external providers:</p> |
|||
|
|||
@foreach (var description in Model) { |
|||
<form action="/signin" method="post"> |
|||
<input type="hidden" name="Provider" value="@description.AuthenticationScheme" /> |
|||
<input type="hidden" name="ReturnUrl" value="@ViewBag.ReturnUrl" /> |
|||
|
|||
<button class="btn btn-lg btn-success" type="submit">Connect using @description.DisplayName</button> |
|||
</form> |
|||
} |
|||
</div> |
|||
@ -1,30 +0,0 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
|||
<meta name="description" content="" /> |
|||
<meta name="author" content="" /> |
|||
|
|||
<title>Mvc.Server (OSOS sample)</title> |
|||
|
|||
<link href="~/stylesheets/bootstrap.min.css" rel="stylesheet" /> |
|||
<link href="~/stylesheets/jumbotron-narrow.css" rel="stylesheet" /> |
|||
</head> |
|||
|
|||
<body> |
|||
<div class="container"> |
|||
<div class="header"> |
|||
<h3 class="text-muted">Your application (Mvc.Server)</h3> |
|||
</div> |
|||
|
|||
@RenderBody() |
|||
|
|||
<div class="footer"> |
|||
<p>© Your company 2014</p> |
|||
</div> |
|||
|
|||
</div> |
|||
</body> |
|||
</html> |
|||
@ -1,3 +0,0 @@ |
|||
@{ |
|||
Layout = "_Layout"; |
|||
} |
|||
@ -1,59 +0,0 @@ |
|||
{ |
|||
"version": "1.0.0-alpha2-*", |
|||
|
|||
"description": "ASP.NET Core MVC module for OpenIddict.", |
|||
"authors": [ "Kévin Chalet" ], |
|||
|
|||
"packOptions": { |
|||
"owners": [ "Kévin Chalet" ], |
|||
|
|||
"projectUrl": "https://github.com/openiddict/openiddict-core", |
|||
"iconUrl": "https://avatars3.githubusercontent.com/u/13908567?s=64", |
|||
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html", |
|||
|
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/openiddict/openiddict-core" |
|||
}, |
|||
|
|||
"tags": [ |
|||
"aspnetcore", |
|||
"authentication", |
|||
"jwt", |
|||
"openidconnect", |
|||
"openiddict", |
|||
"security" |
|||
] |
|||
}, |
|||
|
|||
"buildOptions": { |
|||
"warningsAsErrors": true, |
|||
"nowarn": [ "CS1591" ], |
|||
"xmlDoc": true, |
|||
"preserveCompilationContext": true, |
|||
|
|||
"embed": { |
|||
"include": [ "Views/**" ] |
|||
} |
|||
}, |
|||
|
|||
"dependencies": { |
|||
"AspNet.Hosting.Extensions": "1.0.0-alpha3-final", |
|||
"JetBrains.Annotations": { "type": "build", "version": "10.1.4" }, |
|||
"Microsoft.AspNetCore.Mvc": "1.0.0", |
|||
"Microsoft.Extensions.FileProviders.Embedded": "1.0.0", |
|||
"Microsoft.Extensions.FileProviders.Composite": "1.0.0", |
|||
"OpenIddict.Core": { "target": "project" } |
|||
}, |
|||
|
|||
"frameworks": { |
|||
"net451": { }, |
|||
|
|||
"netstandard1.6": { |
|||
"imports": [ |
|||
"dotnet5.7", |
|||
"portable-net451+win8" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> |
|||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |
|||
</PropertyGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> |
|||
<PropertyGroup Label="Globals"> |
|||
<ProjectGuid>3744b1bc-3498-4958-b020-b2688a78b989</ProjectGuid> |
|||
<RootNamespace>OpenIddict.Security</RootNamespace> |
|||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> |
|||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<SchemaVersion>2.0</SchemaVersion> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<DnxInvisibleContent Include="bower.json" /> |
|||
<DnxInvisibleContent Include=".bowerrc" /> |
|||
<DnxInvisibleContent Include="package.json" /> |
|||
</ItemGroup> |
|||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> |
|||
</Project> |
|||
@ -1,92 +0,0 @@ |
|||
/* |
|||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|||
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|||
* the license and the contributors participating to this project. |
|||
*/ |
|||
|
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Microsoft.AspNetCore.Cors.Infrastructure; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using NWebsec.AspNetCore.Middleware; |
|||
|
|||
namespace Microsoft.AspNetCore.Builder { |
|||
public static class OpenIddictExtensions { |
|||
/// <summary>
|
|||
/// Registers the NWebsec module using the default Content Security Policy.
|
|||
/// </summary>
|
|||
/// <param name="builder">The services builder used by OpenIddict to register new services.</param>
|
|||
/// <returns>The <see cref="OpenIddictBuilder"/>.</returns>
|
|||
public static OpenIddictBuilder AddNWebsec([NotNull] this OpenIddictBuilder builder) { |
|||
if (builder == null) { |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
return builder.AddNWebsec(options => { |
|||
options.DefaultSources(directive => directive.Self()) |
|||
.ImageSources(directive => directive.Self()) |
|||
.ScriptSources(directive => directive.Self()) |
|||
.StyleSources(directive => directive.Self()); |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Registers the NWebsec module using the specified Content Security Policy.
|
|||
/// </summary>
|
|||
/// <param name="builder">The services builder used by OpenIddict to register new services.</param>
|
|||
/// <param name="configuration">The delegate used to configure the Content Security Policy options.</param>
|
|||
/// <returns>The <see cref="OpenIddictBuilder"/>.</returns>
|
|||
public static OpenIddictBuilder AddNWebsec( |
|||
[NotNull] this OpenIddictBuilder builder, |
|||
[NotNull] Action<IFluentCspOptions> configuration) { |
|||
if (builder == null) { |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
if (configuration == null) { |
|||
throw new ArgumentNullException(nameof(configuration)); |
|||
} |
|||
|
|||
return builder.AddModule("NWebsec", 5, app => { |
|||
// Insert a new middleware responsible of setting the Content-Security-Policy header.
|
|||
// See https://nwebsec.codeplex.com/wikipage?title=Configuring%20Content%20Security%20Policy&referringTitle=NWebsec
|
|||
app.UseCsp(configuration); |
|||
|
|||
// Insert a new middleware responsible of setting the X-Content-Type-Options header.
|
|||
// See https://nwebsec.codeplex.com/wikipage?title=Configuring%20security%20headers&referringTitle=NWebsec
|
|||
app.UseXContentTypeOptions(); |
|||
|
|||
// Insert a new middleware responsible of setting the X-Frame-Options header.
|
|||
// See https://nwebsec.codeplex.com/wikipage?title=Configuring%20security%20headers&referringTitle=NWebsec
|
|||
app.UseXfo(xfo => xfo.Deny()); |
|||
|
|||
// Insert a new middleware responsible of setting the X-Xss-Protection header.
|
|||
// See https://nwebsec.codeplex.com/wikipage?title=Configuring%20security%20headers&referringTitle=NWebsec
|
|||
app.UseXXssProtection(xss => xss.EnabledWithBlockMode()); |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Registers the CORS module.
|
|||
/// </summary>
|
|||
/// <param name="builder">The services builder used by OpenIddict to register new services.</param>
|
|||
/// <param name="configuration">The delegate used to configure the CORS policy.</param>
|
|||
/// <returns>The <see cref="OpenIddictBuilder"/>.</returns>
|
|||
public static OpenIddictBuilder AddCors( |
|||
[NotNull] this OpenIddictBuilder builder, |
|||
[NotNull] Action<CorsPolicyBuilder> configuration) { |
|||
if (builder == null) { |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
if (configuration == null) { |
|||
throw new ArgumentNullException(nameof(configuration)); |
|||
} |
|||
|
|||
builder.Services.AddCors(); |
|||
builder.AddModule("CORS", -10, map => map.UseCors(configuration)); |
|||
|
|||
return builder; |
|||
} |
|||
} |
|||
} |
|||
@ -1,52 +0,0 @@ |
|||
{ |
|||
"version": "1.0.0-alpha2-*", |
|||
|
|||
"description": "Security headers module for OpenIddict.", |
|||
"authors": [ "Kévin Chalet" ], |
|||
|
|||
"packOptions": { |
|||
"owners": [ "Kévin Chalet" ], |
|||
|
|||
"projectUrl": "https://github.com/openiddict/openiddict-core", |
|||
"iconUrl": "https://avatars3.githubusercontent.com/u/13908567?s=64", |
|||
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html", |
|||
|
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/openiddict/openiddict-core" |
|||
}, |
|||
|
|||
"tags": [ |
|||
"aspnetcore", |
|||
"authentication", |
|||
"jwt", |
|||
"openidconnect", |
|||
"openiddict", |
|||
"security" |
|||
] |
|||
}, |
|||
|
|||
"buildOptions": { |
|||
"warningsAsErrors": true, |
|||
"nowarn": [ "CS1591" ], |
|||
"xmlDoc": true |
|||
}, |
|||
|
|||
"dependencies": { |
|||
"JetBrains.Annotations": { "type": "build", "version": "10.1.4" }, |
|||
"Microsoft.AspNetCore.Cors": "1.0.0", |
|||
"NWebsec.AspNetCore.Middleware": "1.0.0-gamma1-15", |
|||
"OpenIddict.Core": { "target": "project" } |
|||
}, |
|||
|
|||
"frameworks": { |
|||
"net451": { }, |
|||
|
|||
"netstandard1.4": { |
|||
"imports": [ |
|||
"dotnet5.5", |
|||
"portable-net451+win8" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue