bug rename seance
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dotnet": {
|
||||||
|
"projects": "*/project.json",
|
||||||
|
"enablePackageRestore": false
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,11 @@
|
|||||||
{
|
{
|
||||||
"dotnet": {
|
"DotNet": {
|
||||||
"projects": "src/*/project.json;test/*/project.json;scripts/*/project.json",
|
"projectskjad": "src/*/project.json;test/*/project.json;scripts/*/project.json",
|
||||||
"enable": true,
|
"enabled": true,
|
||||||
"projects": ".",
|
"enablePackageRestore": false,
|
||||||
"enablePackageRestore": false,
|
"script": {
|
||||||
"script": {
|
"enableScriptNuGetReferences": true,
|
||||||
"enableScriptNuGetReferences": true,
|
"defaultTargetFramework": "dnx451"
|
||||||
"defaultTargetFramework": "dnx451"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"directory": "wwwroot/lib"
|
"directory": "wwwroot/lib"
|
||||||
}
|
}
|
@ -1,168 +1,168 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Json;
|
using System.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Yavsc.Server.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Server.Model;
|
using Yavsc.Server.Model;
|
||||||
|
|
||||||
namespace testOauthClient.Controllers
|
namespace testOauthClient.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
ILogger _logger;
|
ILogger _logger;
|
||||||
|
|
||||||
public class GCMRegistrationRecord {
|
public class GCMRegistrationRecord {
|
||||||
public string GCMRegistrationId { get; set; } = "testGoogleRegistrationIdValue";
|
public string GCMRegistrationId { get; set; } = "testGoogleRegistrationIdValue";
|
||||||
public string DeviceId { get; set; }= "TestDeviceId";
|
public string DeviceId { get; set; }= "TestDeviceId";
|
||||||
public string Model { get; set; }= "TestModel";
|
public string Model { get; set; }= "TestModel";
|
||||||
public string Platform { get; set; }= "External Web";
|
public string Platform { get; set; }= "External Web";
|
||||||
public string Version { get; set; }= "0.0.1-rc1";
|
public string Version { get; set; }= "0.0.1-rc1";
|
||||||
}
|
}
|
||||||
|
|
||||||
public HomeController(ILoggerFactory loggerFactory)
|
public HomeController(ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_logger=loggerFactory.CreateLogger<HomeController>();
|
_logger=loggerFactory.CreateLogger<HomeController>();
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> GetUserInfo(CancellationToken cancellationToken)
|
public async Task<IActionResult> GetUserInfo(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, "http://dev.pschneider.fr/api/me");
|
var request = new HttpRequestMessage(HttpMethod.Get, "http://dev.pschneider.fr/api/me");
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
|
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
|
||||||
|
|
||||||
|
|
||||||
var response = await client.SendAsync(request, cancellationToken);
|
var response = await client.SendAsync(request, cancellationToken);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
return View("Index", model: await response.Content.ReadAsStringAsync());
|
return View("Index", model: await response.Content.ReadAsStringAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> PostFiles(string subdir)
|
public async Task<IActionResult> PostFiles(string subdir)
|
||||||
{
|
{
|
||||||
string results = null;
|
string results = null;
|
||||||
_logger.LogInformation($"{Request.Form.Files.Count} file(s) to send");
|
_logger.LogInformation($"{Request.Form.Files.Count} file(s) to send");
|
||||||
|
|
||||||
// TODO better uri construction in production environment
|
// TODO better uri construction in production environment
|
||||||
List<FormFile> args = new List<FormFile>();
|
List<FormFile> args = new List<FormFile>();
|
||||||
foreach (var formFile in Request.Form.Files)
|
foreach (var formFile in Request.Form.Files)
|
||||||
{
|
{
|
||||||
_logger.LogWarning($"Treating {formFile.ContentDisposition}");
|
_logger.LogWarning($"Treating {formFile.ContentDisposition}");
|
||||||
var memStream = new MemoryStream();
|
var memStream = new MemoryStream();
|
||||||
const int sz = 1024*64;
|
const int sz = 1024*64;
|
||||||
byte [] buffer = new byte[sz];
|
byte [] buffer = new byte[sz];
|
||||||
using (var innerStream = formFile.OpenReadStream()) {
|
using (var innerStream = formFile.OpenReadStream()) {
|
||||||
int szRead = 0;
|
int szRead = 0;
|
||||||
do {
|
do {
|
||||||
szRead = innerStream.Read(buffer,0,sz);
|
szRead = innerStream.Read(buffer,0,sz);
|
||||||
memStream.Write(buffer,0,szRead);
|
memStream.Write(buffer,0,szRead);
|
||||||
} while (szRead>0);
|
} while (szRead>0);
|
||||||
}
|
}
|
||||||
memStream.Seek(0,SeekOrigin.Begin);
|
memStream.Seek(0,SeekOrigin.Begin);
|
||||||
args.Add(
|
args.Add(
|
||||||
new FormFile {
|
new FormFile {
|
||||||
ContentDisposition = formFile.ContentDisposition,
|
ContentDisposition = formFile.ContentDisposition,
|
||||||
ContentType = formFile.ContentType,
|
ContentType = formFile.ContentType,
|
||||||
Stream = memStream
|
Stream = memStream
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
string uri = "http://dev.pschneider.fr/api/fs/"+System.Uri.EscapeDataString(subdir);
|
string uri = "http://dev.pschneider.fr/api/fs/"+System.Uri.EscapeDataString(subdir);
|
||||||
_logger.LogInformation($"Posting data to '{uri}'...");
|
_logger.LogInformation($"Posting data to '{uri}'...");
|
||||||
|
|
||||||
results = await RequestHelper.PostMultipart(uri, args.ToArray(), AccessToken);
|
results = await RequestHelper.PostMultipart(uri, args.ToArray(), AccessToken);
|
||||||
_logger.LogInformation("Data posted.");
|
_logger.LogInformation("Data posted.");
|
||||||
|
|
||||||
return View("Index", model: results);
|
return View("Index", model: results);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> PostDeviceInfo(CancellationToken cancellationToken)
|
public async Task<IActionResult> PostDeviceInfo(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
using (var client = new HttpClient()) {
|
using (var client = new HttpClient()) {
|
||||||
var request = new HttpRequestMessage(HttpMethod.Post, "http://dev.pschneider.fr/api/gcm/register");
|
var request = new HttpRequestMessage(HttpMethod.Post, "http://dev.pschneider.fr/api/gcm/register");
|
||||||
|
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
|
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
|
||||||
var json = JsonConvert.
|
var json = JsonConvert.
|
||||||
SerializeObject(new Yavsc.Models.Identity.GoogleCloudMobileDeclaration { DeviceId= "devid01", GCMRegistrationId = "1234" } );
|
SerializeObject(new Yavsc.Models.Identity.GoogleCloudMobileDeclaration { DeviceId= "devid01", GCMRegistrationId = "1234" } );
|
||||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
var response = await client.SendAsync(request, cancellationToken);
|
var response = await client.SendAsync(request, cancellationToken);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
return View("Index", model: await response.Content.ReadAsStringAsync());
|
return View("Index", model: await response.Content.ReadAsStringAsync());
|
||||||
}*/
|
}*/
|
||||||
GCMRegistrationRecord result = null;
|
GCMRegistrationRecord result = null;
|
||||||
var authHeader = $"Bearer {AccessToken}";
|
var authHeader = $"Bearer {AccessToken}";
|
||||||
_logger.LogWarning($"using authorization Header {authHeader}");
|
_logger.LogWarning($"using authorization Header {authHeader}");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
using (var request = new SimpleJsonPostMethod(
|
using (var request = new SimpleJsonPostMethod(
|
||||||
"http://dev.pschneider.fr/api/gcm/register", authHeader))
|
"http://dev.pschneider.fr/api/gcm/register", authHeader))
|
||||||
{
|
{
|
||||||
result = await request.Invoke<GCMRegistrationRecord>(new
|
result = await request.Invoke<GCMRegistrationRecord>(new
|
||||||
GCMRegistrationRecord {
|
GCMRegistrationRecord {
|
||||||
GCMRegistrationId = "testGoogleRegistrationIdValue",
|
GCMRegistrationId = "testGoogleRegistrationIdValue",
|
||||||
DeviceId = "TestDeviceId",
|
DeviceId = "TestDeviceId",
|
||||||
Model = "TestModel",
|
Model = "TestModel",
|
||||||
Platform = "External Web",
|
Platform = "External Web",
|
||||||
Version = "0.0.1-rc1"
|
Version = "0.0.1-rc1"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
return View("Index", model: new { error = ex.Message });
|
return View("Index", model: new { error = ex.Message });
|
||||||
}
|
}
|
||||||
return View("Index", model: result?.ToString());
|
return View("Index", model: result?.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string AccessToken
|
protected string AccessToken
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var claim = HttpContext.User?.FindFirst("access_token");
|
var claim = HttpContext.User?.FindFirst("access_token");
|
||||||
if (claim == null)
|
if (claim == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("no access_token");
|
throw new InvalidOperationException("no access_token");
|
||||||
}
|
}
|
||||||
|
|
||||||
return claim.Value;
|
return claim.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IActionResult About()
|
public IActionResult About()
|
||||||
{
|
{
|
||||||
ViewData["Message"] = "Your application description page.";
|
ViewData["Message"] = "Your application description page.";
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Contact()
|
public IActionResult Contact()
|
||||||
{
|
{
|
||||||
ViewData["Message"] = "Your contact page.";
|
ViewData["Message"] = "Your contact page.";
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,142 +1,142 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.AspNet.Authentication;
|
using Microsoft.AspNet.Authentication;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Authentication.Cookies;
|
using Microsoft.AspNet.Authentication.Cookies;
|
||||||
using Microsoft.Extensions.WebEncoders;
|
using Microsoft.Extensions.WebEncoders;
|
||||||
using Microsoft.AspNet.Authentication.OAuth;
|
using Microsoft.AspNet.Authentication.OAuth;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace testOauthClient
|
namespace testOauthClient
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
// Set up configuration sources.
|
// Set up configuration sources.
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; set; }
|
public IConfigurationRoot Configuration { get; set; }
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
services.Configure<SharedAuthenticationOptions>(options =>
|
services.Configure<SharedAuthenticationOptions>(options =>
|
||||||
{
|
{
|
||||||
options.SignInScheme = "Bearer";
|
options.SignInScheme = "Bearer";
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
|
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
|
||||||
|
|
||||||
services.AddAuthentication();
|
services.AddAuthentication();
|
||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// 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, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
loggerFactory.AddDebug();
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
}
|
}
|
||||||
app.UseIISPlatformHandler(options =>
|
app.UseIISPlatformHandler(options =>
|
||||||
{
|
{
|
||||||
options.AuthenticationDescriptions.Clear();
|
options.AuthenticationDescriptions.Clear();
|
||||||
});
|
});
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
|
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
|
||||||
var clientId = authConf.GetSection("ClientId").Value;
|
var clientId = authConf.GetSection("ClientId").Value;
|
||||||
var clientSecret = authConf.GetSection("ClientSecret").Value;
|
var clientSecret = authConf.GetSection("ClientSecret").Value;
|
||||||
var logger = loggerFactory.CreateLogger<Startup>();
|
var logger = loggerFactory.CreateLogger<Startup>();
|
||||||
logger.LogInformation($"## ClientId: {clientId} ClientSecret: {clientSecret}");
|
logger.LogInformation($"## ClientId: {clientId} ClientSecret: {clientSecret}");
|
||||||
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
app.UseCookieAuthentication(new CookieAuthenticationOptions
|
||||||
{
|
{
|
||||||
AutomaticAuthenticate = true,
|
AutomaticAuthenticate = true,
|
||||||
AutomaticChallenge = true,
|
AutomaticChallenge = true,
|
||||||
AuthenticationScheme = "Bearer",
|
AuthenticationScheme = "Bearer",
|
||||||
CookieName = CookieAuthenticationDefaults.CookiePrefix + "Bearer",
|
CookieName = CookieAuthenticationDefaults.CookiePrefix + "Bearer",
|
||||||
ExpireTimeSpan = TimeSpan.FromMinutes(5),
|
ExpireTimeSpan = TimeSpan.FromMinutes(5),
|
||||||
LoginPath = new PathString("/signin"),
|
LoginPath = new PathString("/signin"),
|
||||||
LogoutPath = new PathString("/signout")
|
LogoutPath = new PathString("/signout")
|
||||||
});
|
});
|
||||||
var host = "http://dev.pschneider.fr";
|
var host = "http://dev.pschneider.fr";
|
||||||
app.UseOAuthAuthentication(
|
app.UseOAuthAuthentication(
|
||||||
options =>
|
options =>
|
||||||
{
|
{
|
||||||
options.AuthenticationScheme = "Yavsc";
|
options.AuthenticationScheme = "Yavsc";
|
||||||
options.AuthorizationEndpoint = $"{host}/authorize";
|
options.AuthorizationEndpoint = $"{host}/authorize";
|
||||||
options.TokenEndpoint = $"{host}/token";
|
options.TokenEndpoint = $"{host}/token";
|
||||||
options.CallbackPath = new PathString("/signin-yavsc");
|
options.CallbackPath = new PathString("/signin-yavsc");
|
||||||
options.DisplayName = "Yavsc dev";
|
options.DisplayName = "Yavsc dev";
|
||||||
options.ClientId = clientId;
|
options.ClientId = clientId;
|
||||||
options.ClientSecret = clientSecret;
|
options.ClientSecret = clientSecret;
|
||||||
options.Scope.Add("profile");
|
options.Scope.Add("profile");
|
||||||
options.SaveTokensAsClaims = true;
|
options.SaveTokensAsClaims = true;
|
||||||
options.UserInformationEndpoint = $"{host}/api/me";
|
options.UserInformationEndpoint = $"{host}/api/me";
|
||||||
|
|
||||||
options.Events = new OAuthEvents
|
options.Events = new OAuthEvents
|
||||||
{
|
{
|
||||||
OnCreatingTicket = async context =>
|
OnCreatingTicket = async context =>
|
||||||
{
|
{
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, options.UserInformationEndpoint);
|
var request = new HttpRequestMessage(HttpMethod.Get, options.UserInformationEndpoint);
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken);
|
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken);
|
||||||
var response = await context.Backchannel.SendAsync(request);
|
var response = await context.Backchannel.SendAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
|
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
|
||||||
var identifier = payload.Value<string>("Id");
|
var identifier = payload.Value<string>("Id");
|
||||||
var givenName = payload.Value<string>("UserName");
|
var givenName = payload.Value<string>("UserName");
|
||||||
var emails = payload.Value<JArray>("EMails");
|
var emails = payload.Value<JArray>("EMails");
|
||||||
var roles = payload.Value<JArray>("Roles");
|
var roles = payload.Value<JArray>("Roles");
|
||||||
string email = null;
|
string email = null;
|
||||||
if (emails !=null)
|
if (emails !=null)
|
||||||
email = emails.First?.Value<string>();
|
email = emails.First?.Value<string>();
|
||||||
if (identifier!=null)
|
if (identifier!=null)
|
||||||
context.Identity.AddClaim(
|
context.Identity.AddClaim(
|
||||||
new Claim( ClaimTypes.NameIdentifier,identifier));
|
new Claim( ClaimTypes.NameIdentifier,identifier));
|
||||||
if (givenName!=null)
|
if (givenName!=null)
|
||||||
context.Identity.AddClaim(
|
context.Identity.AddClaim(
|
||||||
new Claim( ClaimTypes.Name,givenName));
|
new Claim( ClaimTypes.Name,givenName));
|
||||||
if (email!=null)
|
if (email!=null)
|
||||||
context.Identity.AddClaim(
|
context.Identity.AddClaim(
|
||||||
new Claim( ClaimTypes.Email,email));
|
new Claim( ClaimTypes.Email,email));
|
||||||
// TODO add all emails and roles
|
// TODO add all emails and roles
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry point for the application.
|
// Entry point for the application.
|
||||||
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
|
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "About";
|
ViewData["Title"] = "About";
|
||||||
}
|
}
|
||||||
<h2>@ViewData["Title"].</h2>
|
<h2>@ViewData["Title"].</h2>
|
||||||
<h3>@ViewData["Message"]</h3>
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
<p>Use this area to provide additional information.</p>
|
<p>Use this area to provide additional information.</p>
|
@ -1,16 +1,16 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Contact";
|
ViewData["Title"] = "Contact";
|
||||||
}
|
}
|
||||||
<h2>@ViewData["Title"].</h2>
|
<h2>@ViewData["Title"].</h2>
|
||||||
<h3>@ViewData["Message"]</h3>
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
<address>
|
<address>
|
||||||
Paul Schneider<br />
|
Paul Schneider<br />
|
||||||
<abbr title="Adresse postale">A:</abbr> Boulevard Aristide Briand - 92150 Suresnes
|
<abbr title="Adresse postale">A:</abbr> Boulevard Aristide Briand - 92150 Suresnes
|
||||||
<abbr title="Mobile">M:</abbr> 336 51 14 15 64
|
<abbr title="Mobile">M:</abbr> 336 51 14 15 64
|
||||||
</address>
|
</address>
|
||||||
|
|
||||||
<address>
|
<address>
|
||||||
<strong>Support:</strong> <a href="mailto:contact@pschneider.fr">contact@pschneider.fr</a><br />
|
<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>
|
<strong>Marketing:</strong> <a href="mailto:paul@pschneider.fr">paul@pschneider.fr</a>
|
||||||
</address>
|
</address>
|
@ -1,37 +1,37 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
@if (User?.Identity?.IsAuthenticated ?? false) {
|
@if (User?.Identity?.IsAuthenticated ?? false) {
|
||||||
<h1>Welcome, @User.Identity.Name</h1>
|
<h1>Welcome, @User.Identity.Name</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@foreach (var claim in Context.User.Claims) {
|
@foreach (var claim in Context.User.Claims) {
|
||||||
<div>@claim.Type: <b>@claim.Value</b></div>
|
<div>@claim.Type: <b>@claim.Value</b></div>
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
if (Model!=null) {
|
if (Model!=null) {
|
||||||
<h3>Message received from the resource controller: @Model</h3>
|
<h3>Message received from the resource controller: @Model</h3>
|
||||||
}
|
}
|
||||||
|
|
||||||
<form action="~/Home/GetUserInfo" method="post">
|
<form action="~/Home/GetUserInfo" method="post">
|
||||||
<button class="btn btn-lg btn-warning" type="submit">Get user info</button>
|
<button class="btn btn-lg btn-warning" type="submit">Get user info</button>
|
||||||
</form>
|
</form>
|
||||||
<form action="~/Home/PostDeviceInfo" method="post">
|
<form action="~/Home/PostDeviceInfo" method="post">
|
||||||
<button class="btn btn-lg btn-warning" type="submit">Post device info</button>
|
<button class="btn btn-lg btn-warning" type="submit">Post device info</button>
|
||||||
</form>
|
</form>
|
||||||
<form action="~/Home/PostFiles/?subdir=test" method="post" enctype="multipart/form-data">
|
<form action="~/Home/PostFiles/?subdir=test" method="post" enctype="multipart/form-data">
|
||||||
Envoyer vers le dossier "test" <input type="file" name="file" multiple/>
|
Envoyer vers le dossier "test" <input type="file" name="file" multiple/>
|
||||||
<button class="btn btn-lg btn-warning" type="submit">Post files</button>
|
<button class="btn btn-lg btn-warning" type="submit">Post files</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<a class="btn btn-lg btn-danger" href="/signout">Sign out</a>
|
<a class="btn btn-lg btn-danger" href="/signout">Sign out</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
<h1>Welcome, anonymous</h1>
|
<h1>Welcome, anonymous</h1>
|
||||||
<a class="btn btn-lg btn-success" href="/signin">Sign in</a>
|
<a class="btn btn-lg btn-success" href="/signin">Sign in</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
@ -1,6 +1,6 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Error";
|
ViewData["Title"] = "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
<h1 class="text-danger">Error.</h1>
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
@ -1,46 +1,46 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - testOauthClient</title>
|
<title>@ViewData["Title"] - testOauthClient</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a asp-controller="Home" asp-action="Index" class="navbar-brand">testOauthClient</a>
|
<a asp-controller="Home" asp-action="Index" class="navbar-brand">testOauthClient</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
<li><a asp-controller="Home" asp-action="About">About</a></li>
|
<li><a asp-controller="Home" asp-action="About">About</a></li>
|
||||||
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
|
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container body-content">
|
<div class="container body-content">
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2016 - testOauthClient</p>
|
<p>© 2016 - testOauthClient</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
@RenderSection("scripts", required: false)
|
@RenderSection("scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,2 +1,2 @@
|
|||||||
@using testOauthClient
|
@using testOauthClient
|
||||||
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
@ -1,3 +1,3 @@
|
|||||||
@{
|
@{
|
||||||
Layout = "_Layout";
|
Layout = "_Layout";
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "testOauthClient",
|
"name": "testOauthClient",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "3.3.5",
|
"bootstrap": "3.3.5",
|
||||||
"jquery": "2.1.4",
|
"jquery": "2.1.4",
|
||||||
"jquery-validation": "1.14.0",
|
"jquery-validation": "1.14.0",
|
||||||
"jquery-validation-unobtrusive": "3.2.4"
|
"jquery-validation-unobtrusive": "3.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,64 +1,64 @@
|
|||||||
/// <binding Clean='clean' />
|
/// <binding Clean='clean' />
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var gulp = require("gulp"),
|
var gulp = require("gulp"),
|
||||||
rimraf = require("rimraf"),
|
rimraf = require("rimraf"),
|
||||||
concat = require("gulp-concat"),
|
concat = require("gulp-concat"),
|
||||||
cssmin = require("gulp-cssmin"),
|
cssmin = require("gulp-cssmin"),
|
||||||
shell = require("gulp-shell"),
|
shell = require("gulp-shell"),
|
||||||
uglify = require("gulp-uglify");
|
uglify = require("gulp-uglify");
|
||||||
|
|
||||||
var webroot = "./wwwroot/";
|
var webroot = "./wwwroot/";
|
||||||
|
|
||||||
var paths = {
|
var paths = {
|
||||||
js: webroot + "js/**/*.js",
|
js: webroot + "js/**/*.js",
|
||||||
minJs: webroot + "js/**/*.min.js",
|
minJs: webroot + "js/**/*.min.js",
|
||||||
css: webroot + "css/**/*.css",
|
css: webroot + "css/**/*.css",
|
||||||
minCss: webroot + "css/**/*.min.css",
|
minCss: webroot + "css/**/*.min.css",
|
||||||
concatJsDest: webroot + "js/site.min.js",
|
concatJsDest: webroot + "js/site.min.js",
|
||||||
concatCssDest: webroot + "css/site.min.css"
|
concatCssDest: webroot + "css/site.min.css"
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task("clean:js", function (cb) {
|
gulp.task("clean:js", function (cb) {
|
||||||
rimraf(paths.concatJsDest, cb);
|
rimraf(paths.concatJsDest, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("clean:css", function (cb) {
|
gulp.task("clean:css", function (cb) {
|
||||||
rimraf(paths.concatCssDest, cb);
|
rimraf(paths.concatCssDest, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("clean", ["clean:js", "clean:css"]);
|
gulp.task("clean", ["clean:js", "clean:css"]);
|
||||||
|
|
||||||
gulp.task("min:js", function () {
|
gulp.task("min:js", function () {
|
||||||
return gulp.src([paths.js, "!" + paths.minJs], {
|
return gulp.src([paths.js, "!" + paths.minJs], {
|
||||||
base: "."
|
base: "."
|
||||||
})
|
})
|
||||||
.pipe(concat(paths.concatJsDest))
|
.pipe(concat(paths.concatJsDest))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(gulp.dest("."));
|
.pipe(gulp.dest("."));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("min:css", function () {
|
gulp.task("min:css", function () {
|
||||||
return gulp.src([paths.css, "!" + paths.minCss])
|
return gulp.src([paths.css, "!" + paths.minCss])
|
||||||
.pipe(concat(paths.concatCssDest))
|
.pipe(concat(paths.concatCssDest))
|
||||||
.pipe(cssmin())
|
.pipe(cssmin())
|
||||||
.pipe(gulp.dest("."));
|
.pipe(gulp.dest("."));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("min", ["min:js", "min:css"]);
|
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']))
|
gulp.task('watch', shell.task(['MONO_OPTIONS=--debug ASPNET_ENV=Development dnx-watch web --configuration=Debug --server.urls=http://*:5002']))
|
||||||
|
|
||||||
var program = "testOauthClient";
|
var program = "testOauthClient";
|
||||||
var port = 55555;
|
var port = 55555;
|
||||||
|
|
||||||
gulp.task('default', ['debug']);
|
gulp.task('default', ['debug']);
|
||||||
|
|
||||||
gulp.task('build', function() {
|
gulp.task('build', function() {
|
||||||
return gulp
|
return gulp
|
||||||
.src('./**/*.cs')
|
.src('./**/*.cs')
|
||||||
.pipe(msc(['-fullpaths', '-debug', '-target:exe', '-out:' + program]));
|
.pipe(msc(['-fullpaths', '-debug', '-target:exe', '-out:' + program]));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('debug', ['build'], function(done) {
|
gulp.task('debug', ['build'], function(done) {
|
||||||
return mono.debug({ port: port, program: program}, done);
|
return mono.debug({ port: port, program: program}, done);
|
||||||
});
|
});
|
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"licence": "GNU GPL v3",
|
"licence": "GNU GPL v3",
|
||||||
"name": "test-oauth-client",
|
"name": "test-oauth-client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-cssmin": "^0.2.0",
|
"gulp-cssmin": "^0.2.0",
|
||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.0",
|
||||||
"rimraf": "^2.6.2"
|
"rimraf": "^2.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,24 +1,24 @@
|
|||||||
body {
|
body {
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapping element */
|
/* Wrapping element */
|
||||||
/* Set some basic padding to keep content from hitting the edges */
|
/* Set some basic padding to keep content from hitting the edges */
|
||||||
.body-content {
|
.body-content {
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set widths on the form inputs since otherwise they're 100% wide */
|
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||||
input,
|
input,
|
||||||
select,
|
select,
|
||||||
textarea {
|
textarea {
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Carousel */
|
/* Carousel */
|
||||||
.carousel-caption p {
|
.carousel-caption p {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -1 +1 @@
|
|||||||
// Write your Javascript code.
|
// Write your Javascript code.
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |