Web API client connected

This commit is contained in:
Paul Schneider
2024-11-12 08:32:15 +00:00
parent f3a63c9e46
commit 009015ce3c
23 changed files with 228 additions and 342 deletions

View File

@ -13,7 +13,6 @@ namespace Yavsc.Controllers
{
[Produces("application/json")]
[Route("api/blog")]
[AllowAnonymous]
public class BlogApiController : Controller
{

View File

@ -14,7 +14,7 @@ using Yavsc.Models.Billing;
namespace Yavsc.Controllers
{
[Produces("application/json")]
[Route("api/estimate"), Authorize()]
[Route("api/estimate"), Authorize]
public class EstimateApiController : Controller
{
private readonly ApplicationDbContext _context;

View File

@ -135,6 +135,8 @@ internal static class HostingExtensions
public static WebApplication ConfigureServices(this WebApplicationBuilder builder)
{
var siteSection = builder.Configuration.GetSection("Site");
var smtpSection = builder.Configuration.GetSection("Smtp");
var paypalSection = builder.Configuration.GetSection("Authentication:PayPal");
@ -156,7 +158,10 @@ internal static class HostingExtensions
string? googleClientId = builder.Configuration["Authentication:Google:ClientId"];
string? googleClientSecret = builder.Configuration["Authentication:Google:ClientSecret"];
var services = builder.Services;
_ = services.AddControllersWithViews()
.AddNewtonsoftJson();
LoadGoogleConfig(builder.Configuration);
services.Configure<SiteSettings>(siteSection);
services.Configure<SmtpSettings>(smtpSection);
services.Configure<PayPalSettings>(paypalSection);
@ -189,8 +194,11 @@ internal static class HostingExtensions
.AddInMemoryIdentityResources(Config.IdentityResources)
.AddInMemoryApiScopes(Config.ApiScopes)
.AddInMemoryClients(Config.Clients)
.AddDeveloperSigningCredential()
;
services.AddSession();
// TODO .AddServerSideSessionStore<YavscServerSideSessionStore>()
@ -315,9 +323,6 @@ internal static class HostingExtensions
services.AddSingleton<IAuthorizationHandler, PermissionHandler>();
_ = services.AddControllersWithViews()
.AddNewtonsoftJson();
LoadGoogleConfig(builder.Configuration);
return builder.Build();
}
@ -328,11 +333,14 @@ internal static class HostingExtensions
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseIdentityServer();
//app.UseSignalR();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",

View File

@ -9,6 +9,7 @@ namespace Yavsc
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true)

View File

@ -103,3 +103,21 @@ Hello !!!
</asciidoc>
<ul>
<li>
IdentityServer publishes a
<a href="~/.well-known/openid-configuration">discovery document</a>
where you can find metadata and links to all the endpoints, key material, etc.
</li>
<li>
Click <a href="~/diagnostics">here</a> to see the claims for your current session.
</li>
<li>
Click <a href="~/grants">here</a> to manage your stored grants.
</li>
<li>
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/main/samples">ready to use samples</a>.
</li>
</ul>

1
src/Yavsc/tempkey.jwk Normal file
View File

@ -0,0 +1 @@
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"BBXYWCFMOYOt4QTTDtjmvrbhj20p07lIjqZv6kdsEUdkrsc0p2stHYp6yT8SLxPAqMgSiFmr29jHdS56gVUa9FEe1H7DXDZszgZ8JRGWaIa2fe2_2vD-hPzFxJNmS5zlo7mFaH0lL40imi7qyzDt3lmvZnBEhwNpGeg2Ge5rmDsT9w5zeDAfLnOOC4ghUNFfQnmVZQfjsXPt46MDkj94ZInOwqJBxbjhNJSvJWkW9y3PG02bPriBx6bsHdc7yPilsqICnnLRWxb79n6XJHZ-gHO1l-eeXwAj5gJI-CX_V7INjBAuNFTMJrCbf-hpghVadsIKLLK6QOeRbdA_6JzGQQ","DP":"EaH8Zw1B6y4cJTb9EzzzPLW20YXihxB8a1ywnYOekqlRS0vUJI8hh9IayWu56PKnIwVYnWlyIn-YreBTBpRubuyc26cyEYsnqGi44K0nnN3n43LBl5BpenI_AE9gLNmP2TAngPD0vINpg9fqTXNutEsNBF_6BLkqzC52rGLMGNk","DQ":"BWlE0UknVFCZ99HL3170Vz7niIVf9zKTEZACjWfBephHjVgeFFOZCrd_3TRGvaG8FVebYJn_ARiFLYuJOXG7u_VafR5MpXxd6Qzty8B4MF3jPEiYyqAylxPh1Uwk2Dl20evd4UoCWHI6Klb8gAAL54hiqKyoYdR24uAZ8YxWB6k","E":"AQAB","K":null,"KeyId":"131338364F1631C3CFBD59BF8F32A4B0","KeyOps":[],"Kid":"131338364F1631C3CFBD59BF8F32A4B0","Kty":"RSA","N":"xymIJugCkRasJ1zA587Kq5GafxcnVXXNVU-kuwCCpAwNndgn2uXCT4WuEDkFK3gcSQKZT_SdM9rMIeJcQjHybtgJs8A-AwGG2JKpppMJ3EkxD_p_-Q1q9D-_QcsZhRU_yP8i-jO8FgYfez4z0TqJWj3nxo3c83u8tkzO1UC4FBEKGlDG993AeqpmaEeycf5bBWitQQu-xy9NgsqzmtVMZtChMtC50fzmbbKkwuOc7506Lw6vzRkBCI8DpqqN50-yL3t7mbfqwxm0OIQ4mzN-n87gaCAJRzqxFj1nQSzmJSmQ7_-nGPSLH_BR3SaPRBQBrArzZyzU7FsMYdAjrTRGoQ","Oth":[],"P":"8RnoBTdVG4Igi3a_ps36pAX09N_nDeM8uG9Oyt5NWr1k0dv4iwtGSV4W8QTTHf5m9ZxQsQIPDxncSwr_WpwfKGGfxGVcESgtDkf10dq8Ajex4NefjnKtGSRX8dAQCRDcoN_v0k32kj90PImzseYM6S4p81dZLkOX0DX9sf3IU5k","Q":"03gsWqv7Vtlr_YWGXFQ4gyq1kew6tNMCAWLIzYTKeN1evYuXCsoEUoP7OPYRsZvQ13_hgEk2qfvEeZ8HoTIY_PXXKS8iUHNQXAaKaHSeRtfKmO7qDUd5jeMihvE2295FNf3VIM24oK3QJ0FPrt8qOIarcGa-lgj2llyiEId98Ek","QI":"OAdgkRIwrQ4X_91WW7bjC37Atn7yH8YBnjHHLSwmeaXkc4JOhdeXLVYIyVKoWqdRIhaT8q4liGA5F7Lbwg4cFQ8tUEjmIbacaRxpcFYYvhQcKGA-q1MxFK2ZwNUxMjc_20ZcH7ohneGNr63im_cUGT78fMzE_YBTbAp1Sxkd0fk","Use":null,"X":null,"X5c":[],"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true,"SignatureProviderObjectPoolCacheSize":16}}

View File

@ -1,9 +1,8 @@

using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
namespace Mvc.Client.Controllers {
public class AuthenticationController : Controller {
[HttpGet("~/signin")]
@ -13,14 +12,13 @@ namespace Mvc.Client.Controllers {
// But, this redirect URI doesn't need to match the OAuth parameter, it's serialized in the query state,
// to be used once the identification ends.
var properties = new AuthenticationProperties { RedirectUri = returnUrl };
return new ChallengeResult("Yavsc", properties);
return new ChallengeResult("Bearer", properties);
}
[HttpGet("~/signout")]
public async Task<IActionResult> SignOut(string returnUrl="/") {
await HttpContext.Authentication.SignOutAsync("Bearer");
await HttpContext.SignOutAsync("Bearer");
return Redirect(returnUrl);
}
}
}

View File

@ -1,14 +1,15 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Yavsc.Server.Helpers;
using Yavsc.Server.Model;
using Newtonsoft.Json.Linq;
namespace testOauthClient.Controllers
{
@ -52,6 +53,7 @@ namespace testOauthClient.Controllers
}
#if FALSECODE
[HttpPost]
public async Task<IActionResult> PostFiles(string subdir)
{
@ -77,11 +79,10 @@ namespace testOauthClient.Controllers
}
memStream.Seek(0, SeekOrigin.Begin);
args.Add(
new FormFile
new FormFile(memStream, 0, formFile.Length, formFile.Name, formFile.Name )
{
ContentDisposition = formFile.ContentDisposition,
ContentType = formFile.ContentType,
Stream = memStream
ContentType = formFile.ContentType
});
}
string uri = "http://dev.pschneider.fr/api/fs/" + System.Uri.EscapeDataString(subdir);
@ -137,6 +138,7 @@ namespace testOauthClient.Controllers
}
return View("Index", model: result?.ToString());
}
#endif
protected string AccessToken
{
@ -165,9 +167,27 @@ namespace testOauthClient.Controllers
return View();
}
public async Task<IActionResult> CallApi()
{
var accessToken = await HttpContext.GetTokenAsync("access_token");
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var content = await client.GetStringAsync("https://localhost:6001/identity");
ViewBag.Json = JArray.Parse(content).ToString();
return View("json");
}
public IActionResult Logout()
{
return SignOut("Cookies", "oidc");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View();
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@ -1,11 +0,0 @@
FROM microsoft/aspnet:1.0.0-rc1-update2
RUN printf "deb http://ftp2.fr.debian.org/debian/ stable main contrib non-free\n" >> /etc/apt/sources.list
# RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
RUN apt-get -qq update && apt-get install -qqy postgresql-9.5 postgresql-client-9.5 && rm -rf /var/lib/apt/lists/*
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "web"]

View File

@ -1,20 +0,0 @@
CONFIGURATION=Debug
BINTARGET=bin/$(CONFIGURATION)/dnx451/test.dll
SOURCE_DIR=../..
MAKEFILE_DIR=$(SOURCE_DIR)/scripts/make
MSBUILD=msbuild
YAVSCSRC=../../src
include $(MAKEFILE_DIR)/dnx.mk
$(YAVSCSRC)/Yavsc/bin/$(CONFIGURATION)/dnx451/Yavsc.dll:
make -C $(YAVSCSRC)/Yavsc
$(YAVSCSRC)/Yavsc.Abstract/bin/$(CONFIGURATION)/dnx451/Yavsc.Abstract.dll:
make -C $(YAVSCSRC)/Yavsc.Abstract
$(YAVSCSRC)/Yavsc.Server/bin/$(CONFIGURATION)/dnx451/Yavsc.Server.dll:
make -C $(YAVSCSRC)/Yavsc.Server
$(BINTARGET): project.lock.json $(YAVSCSRC)/Yavsc/bin/$(CONFIGURATION)/dnx451/Yavsc.dll $(YAVSCSRC)/Yavsc.Abstract/bin/$(CONFIGURATION)/dnx451/Yavsc.Abstract.dll $(YAVSCSRC)/Yavsc.Server/bin/$(CONFIGURATION)/dnx451/Yavsc.Server.dll
dnu build --configuration $(CONFIGURATION)

View File

@ -0,0 +1,9 @@
using System;
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}

View File

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Authentication.OAuth;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}

View File

@ -0,0 +1,38 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:16967",
"sslPort": 44387
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5164",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7055;http://localhost:5164",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

146
src/sampleWebAsWebApiClient/Startup.cs Executable file → Normal file
View File

@ -1,57 +1,39 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.Extensions.WebEncoders;
using Microsoft.AspNetCore.Authentication.OAuth;
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json.Linq;
using System.Security.Claims;
using Microsoft.Extensions.Hosting;
using System.IdentityModel.Tokens.Jwt;
namespace testOauthClient
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.Configure<SharedAuthenticationOptions>(options =>
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
services.AddAuthentication(options =>
{
options.SignInScheme = "Bearer";
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "Yavsc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("Yavsc", options =>
{
options.Authority = "https://localhost:5001";
options.ClientId = "interactive";
options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0";
options.ResponseType = "code";
options.Scope.Add("scope2");
options.SaveTokens = true;
});
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
services.AddAuthentication();
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
@ -60,83 +42,17 @@ namespace testOauthClient
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler(options =>
{
options.AuthenticationDescriptions.Clear();
});
app.UseStaticFiles();
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
var clientId = authConf.GetSection("ClientId").Value;
var clientSecret = authConf.GetSection("ClientSecret").Value;
var logger = loggerFactory.CreateLogger<Startup>();
logger.LogInformation($"## ClientId: {clientId} ClientSecret: {clientSecret}");
app.UseCookieAuthentication(new CookieAuthenticationOptions
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
AuthenticationScheme = "Bearer",
CookieName = CookieAuthenticationDefaults.CookiePrefix + "Bearer",
ExpireTimeSpan = TimeSpan.FromMinutes(5),
LoginPath = new PathString("/signin"),
LogoutPath = new PathString("/signout")
});
var host = "http://dev.pschneider.fr";
app.UseOAuthAuthentication(
options =>
{
options.AuthenticationScheme = "Yavsc";
options.AuthorizationEndpoint = $"{host}/authorize";
options.TokenEndpoint = $"{host}/token";
options.CallbackPath = new PathString("/signin-yavsc");
options.DisplayName = "Yavsc dev";
options.ClientId = clientId;
options.ClientSecret = clientSecret;
options.Scope.Add("profile");
options.SaveTokensAsClaims = true;
options.UserInformationEndpoint = $"{host}/api/me";
options.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
var request = new HttpRequestMessage(HttpMethod.Get, options.UserInformationEndpoint);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken);
var response = await context.Backchannel.SendAsync(request);
response.EnsureSuccessStatusCode();
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
var identifier = payload.Value<string>("Id");
var givenName = payload.Value<string>("UserName");
var emails = payload.Value<JArray>("EMails");
var roles = payload.Value<JArray>("Roles");
string email = null;
if (emails !=null)
email = emails.First?.Value<string>();
if (identifier!=null)
context.Identity.AddClaim(
new Claim( ClaimTypes.NameIdentifier,identifier));
if (givenName!=null)
context.Identity.AddClaim(
new Claim( ClaimTypes.Name,givenName));
if (email!=null)
context.Identity.AddClaim(
new Claim( ClaimTypes.Email,email));
// TODO add all emails and roles
}
};
}
);
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapDefaultControllerRoute()
.RequireAuthorization();
});
}
// Entry point for the application.
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
}
}

View File

@ -4,13 +4,3 @@
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<address>
Paul Schneider<br />
<abbr title="Adresse postale">A:</abbr> Boulevard Aristide Briand - 92150 Suresnes
<abbr title="Mobile">M:</abbr> 336 51 14 15 64
</address>
<address>
<strong>Support:</strong> <a href="mailto:contact@pschneider.fr">contact@pschneider.fr</a><br />
<strong>Marketing:</strong> <a href="mailto:paul@pschneider.fr">paul@pschneider.fr</a>
</address>

View File

@ -1,3 +1,4 @@
@using Microsoft.AspNetCore.Authentication
@{
ViewData["Title"] = "Home Page";
}
@ -35,3 +36,25 @@
<a class="btn btn-lg btn-success" href="/signin">Sign in</a>
}
</div>
<h2>Claims</h2>
<dl>
@foreach (var claim in User.Claims)
{
<dt>@claim.Type</dt>
<dd>@claim.Value</dd>
}
</dl>
<h2>Properties</h2>
<dl>
@foreach (var prop in (await Context.AuthenticateAsync()).Properties.Items)
{
<dt>@prop.Key</dt>
<dd>@prop.Value</dd>
}
</dl>

View File

@ -1,16 +1,25 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
},
"Authentication": { 
"Yavsc": {
"ClientId": "2a3faf86-26e9-49f5-9473-6e6efaeeeac6",
"ClientSecret": "blahblah"
}
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
},
"AllowedHosts": "*",
"Authentication": {
"Yavsc" : {
"TokenEndpoint": "http://dev.pschneider.fr/connect/token",
"AuthorizationEndpoint": "http://dev.pschneider.fr/connect/authorize",
"ClientId": "interactive",
"ClientSecret": "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0"
}
},
"Kestrel": {
"Endpoints":
{
"http": {
"Url": "https://localhost:5003"
}
}
}
}

View File

@ -1,10 +0,0 @@
{
"name": "testOauthClient",
"private": true,
"dependencies": {
"bootstrap": "3.3.5",
"jquery": "2.1.4",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.4"
}
}

View File

@ -1,64 +0,0 @@
/// <binding Clean='clean' />
"use strict";
var gulp = require("gulp"),
rimraf = require("rimraf"),
concat = require("gulp-concat"),
cssmin = require("gulp-cssmin"),
shell = require("gulp-shell"),
uglify = require("gulp-uglify");
var webroot = "./wwwroot/";
var paths = {
js: webroot + "js/**/*.js",
minJs: webroot + "js/**/*.min.js",
css: webroot + "css/**/*.css",
minCss: webroot + "css/**/*.min.css",
concatJsDest: webroot + "js/site.min.js",
concatCssDest: webroot + "css/site.min.css"
};
gulp.task("clean:js", function (cb) {
rimraf(paths.concatJsDest, cb);
});
gulp.task("clean:css", function (cb) {
rimraf(paths.concatCssDest, cb);
});
gulp.task("clean", ["clean:js", "clean:css"]);
gulp.task("min:js", function () {
return gulp.src([paths.js, "!" + paths.minJs], {
base: "."
})
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest("."));
});
gulp.task("min:css", function () {
return gulp.src([paths.css, "!" + paths.minCss])
.pipe(concat(paths.concatCssDest))
.pipe(cssmin())
.pipe(gulp.dest("."));
});
gulp.task("min", ["min:js", "min:css"]);
gulp.task('watch', shell.task(['MONO_OPTIONS=--debug ASPNET_ENV=Development dnx-watch web --configuration=Debug --server.urls=http://*:5002']))
var program = "testOauthClient";
var port = 55555;
gulp.task('default', ['debug']);
gulp.task('build', function() {
return gulp
.src('./**/*.cs')
.pipe(msc(['-fullpaths', '-debug', '-target:exe', '-out:' + program]));
});
gulp.task('debug', ['build'], function(done) {
return mono.debug({ port: port, program: program}, done);
});

View File

@ -1,12 +0,0 @@
{
"licence": "GNU GPL v3",
"name": "test-oauth-client",
"version": "0.0.0",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0",
"gulp-uglify": "^3.0.0",
"rimraf": "^2.6.2"
}
}

View File

@ -1,68 +0,0 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "testOauthClient"
},
"dependencies": {
"Yavsc.Abstract": {
"target": "project",
"type": "build"
},
"Yavsc.Server": {
"target": "project",
"type": "build"
},
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Newtonsoft.Json": "7.0.1"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://*:5002"
},
"frameworks": {
"dnx451": {
"dependencies": {
"System.Json": "4.0.20126.16343"
}
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [
"npm install",
"bower install",
"gulp clean",
"gulp min"
],
"postrestore": [
"grep -v '\\.\\.dll' project.lock.json > new.project.lock.json",
"mv new.project.lock.json project.lock.json"
]
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<ProjectReference Include="..\Yavsc.Abstract\Yavsc.Abstract.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore" Version="4.3.0" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -4,6 +4,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{503DDD6B-BE10-4235-9EBD-E9B1FA6067DF}"
ProjectSection(SolutionItems) = preProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Abstract", "src\Yavsc.Abstract\Yavsc.Abstract.csproj", "{5AFB6255-CF1B-4660-BB35-F24C8C75FECE}"
EndProject
@ -11,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Server", "src\Yavsc.S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc", "src\Yavsc\Yavsc.csproj", "{87DABC88-C38C-45DB-8F72-53B7C95ABC89}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sampleWebAsWebApiClient", "src\sampleWebAsWebApiClient\sampleWebAsWebApiClient.csproj", "{38AA74FE-3932-49C3-A382-338E7C861BB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -32,10 +36,15 @@ Global
{87DABC88-C38C-45DB-8F72-53B7C95ABC89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87DABC88-C38C-45DB-8F72-53B7C95ABC89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87DABC88-C38C-45DB-8F72-53B7C95ABC89}.Release|Any CPU.Build.0 = Release|Any CPU
{38AA74FE-3932-49C3-A382-338E7C861BB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38AA74FE-3932-49C3-A382-338E7C861BB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38AA74FE-3932-49C3-A382-338E7C861BB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38AA74FE-3932-49C3-A382-338E7C861BB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5AFB6255-CF1B-4660-BB35-F24C8C75FECE} = {503DDD6B-BE10-4235-9EBD-E9B1FA6067DF}
{830F5A71-0192-4288-9F4D-D7849D958970} = {503DDD6B-BE10-4235-9EBD-E9B1FA6067DF}
{87DABC88-C38C-45DB-8F72-53B7C95ABC89} = {503DDD6B-BE10-4235-9EBD-E9B1FA6067DF}
{38AA74FE-3932-49C3-A382-338E7C861BB1} = {503DDD6B-BE10-4235-9EBD-E9B1FA6067DF}
EndGlobalSection
EndGlobal