Merge branch 'fix/webclient' into release/1.0.0
commit
e94a82e3d9
@ -1,67 +0,0 @@
|
|||||||
# Please find the full example project here:
|
|
||||||
# https://gitlab.com/tobiaskoch/gitlab-ci-example-mono
|
|
||||||
|
|
||||||
# see https://hub.docker.com/_/mono/
|
|
||||||
image: mono:4.6.2.7
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- . /opt/mono-4.6/mono-env
|
|
||||||
- export GIT_SSL_NO_VERIFY=true
|
|
||||||
- curl --insecure -sSL https://lua.pschneider.fr/files/Paul/pub/dnx-install.sh | bash
|
|
||||||
- DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh
|
|
||||||
- cd src/OAuth.AspNet.Token && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../OAuth.AspNet.AuthServer && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc.Abstract && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc.Server && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../cli && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../../test/yavscTests && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../..
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
|
|
||||||
debug:
|
|
||||||
stage: build
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- test/yavscTests/bin
|
|
||||||
script:
|
|
||||||
- cd test/yavscTests
|
|
||||||
- dnu build
|
|
||||||
|
|
||||||
non_reg:
|
|
||||||
stage: test
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- test/yavscTests/test-results.xml
|
|
||||||
when: always
|
|
||||||
script:
|
|
||||||
- cd test/yavscTests
|
|
||||||
- cp $yavsc_client_secret_json yavsc-client-secret.json
|
|
||||||
- ASPNET_ENV=Development dnx test -trait ategory=non_reg -maxthreads 1 -xml test-results.xml
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: deploy
|
|
||||||
only:
|
|
||||||
- vnext
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- binaries/Debug
|
|
||||||
script:
|
|
||||||
- make packages
|
|
||||||
|
|
||||||
deploy_staging:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- echo "Deploy to staging server"
|
|
||||||
- make strip_yavscd
|
|
||||||
- make packages
|
|
||||||
- isn push -s $ISNSOURCE -k $NUGETSOURCEAPIKEY src/Yavsc.Abstract/bin/*/*.nupkg
|
|
||||||
environment:
|
|
||||||
name: staging
|
|
||||||
url: https://yavscpre.pschneider.fr
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<apikeys>
|
|
||||||
</apikeys>
|
|
||||||
<packageSources>
|
|
||||||
<add key="opt" value="/opt/nuget/pkgs/" />
|
|
||||||
<add key="Official NuGet Gallery" value="https://www.nuget.org/api/v2/" />
|
|
||||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
|
||||||
<add key="xamarin-forms-ci" value="https://www.myget.org/F/xamarinforms-ci/api/v2" />
|
|
||||||
</packageSources> <activePackageSource> <add key="myLocal" value="/home/paul/Nupkgs" /> </activePackageSource>
|
|
||||||
</configuration>
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Machine.Specifications.Runner.Console" version="0.9.0" />
|
|
||||||
</packages>
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
language: csharp
|
|
||||||
os: linux
|
|
||||||
mono:
|
|
||||||
- beta
|
|
||||||
sudo: false
|
|
||||||
install:
|
|
||||||
- curl --insecure -sSL https://lua.pschneider.fr/files/Paul/pub/dnx-install.sh | bash
|
|
||||||
- DNX_USER_HOME=`pwd -P`/dnx . ./dnx/dnvm/dnvm.sh
|
|
||||||
- cd src/OAuth.AspNet.Token && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../OAuth.AspNet.AuthServer && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc.Abstract && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc.Server && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../Yavsc && dnu restore --ignore-failed-sources
|
|
||||||
- cd ../test
|
|
||||||
- make restore
|
|
||||||
- make
|
|
||||||
- cd ../..
|
|
||||||
- make
|
|
||||||
|
|
||||||
script:
|
|
||||||
- "dnu build"
|
|
||||||
|
|
||||||
@ -1,11 +1,6 @@
|
|||||||
{
|
{
|
||||||
"projects": [
|
|
||||||
"src",
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"runtime": "dotnet",
|
"runtime": "dotnet",
|
||||||
"version": "8.0.405"
|
"version": "8.0.405"
|
||||||
},
|
}
|
||||||
"packages": "packages"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
using System.Security.Claims;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Blog;
|
||||||
|
|
||||||
|
namespace Yavsc.Api.Helpers
|
||||||
|
{
|
||||||
|
public static class UserHelpers
|
||||||
|
{
|
||||||
|
public static string GetUserId(this ClaimsPrincipal user)
|
||||||
|
{
|
||||||
|
return user.FindFirstValue("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "https://localhost:5001",
|
||||||
|
"sslPort": 6001
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "https://localhost:6001;",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace Yavsc.Helpers
|
||||||
|
{
|
||||||
|
public static class UserHelpers
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
Support for ASP.NET Core Identity was added to your project.
|
|
||||||
|
|
||||||
For setup and configuration information, see https://go.microsoft.com/fwlink/?linkid=2116645.
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "yavsc",
|
|
||||||
"version": "1.0.7",
|
|
||||||
"description": "Yet Another Very Small Company",
|
|
||||||
"repository": {
|
|
||||||
"type": "Git",
|
|
||||||
"url": "https://github.com/pazof/yavsc"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"devDependencies": {},
|
|
||||||
"dependencies": {
|
|
||||||
"paypal-permissions-sdk": "^1.0.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,19 +1,62 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.OAuth;
|
/*
|
||||||
|
Copyright (c) 2024 HigginsSoft, Alexander Higgins - https://github.com/alexhiggins732/
|
||||||
|
|
||||||
|
Copyright (c) 2018, Brock Allen & Dominick Baier. All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||||
|
Source code and license this software can be found
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
public class Program
|
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
|
||||||
|
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.Services.AddControllersWithViews();
|
||||||
|
builder.Services
|
||||||
|
.AddAuthentication(options =>
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
options.DefaultScheme = "Cookies";
|
||||||
|
options.DefaultChallengeScheme = "oidc";
|
||||||
|
})
|
||||||
|
.AddCookie("Cookies")
|
||||||
|
.AddOpenIdConnect("oidc", options =>
|
||||||
{
|
{
|
||||||
CreateHostBuilder(args).Build().Run();
|
options.Authority = "https://localhost:5001";
|
||||||
}
|
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
options.ClientId = "mvc";
|
||||||
Host.CreateDefaultBuilder(args)
|
options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0";
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
options.ResponseType = "code";
|
||||||
{
|
|
||||||
webBuilder.UseStartup<Startup>();
|
options.Scope.Add("openid");
|
||||||
|
options.Scope.Add("profile");
|
||||||
|
options.Scope.Add("scope2");
|
||||||
|
options.MapInboundClaims = true;
|
||||||
|
options.ClaimActions.MapUniqueJsonKey("preferred_username","preferred_username");
|
||||||
|
options.ClaimActions.MapUniqueJsonKey("gender", "gender");
|
||||||
|
|
||||||
|
options.SaveTokens = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
using (var app = builder.Build())
|
||||||
|
{
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
else
|
||||||
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
app.UseRouting();
|
||||||
|
app.UseAuthentication();
|
||||||
|
app.UseAuthorization();
|
||||||
|
app.MapDefaultControllerRoute().RequireAuthorization();
|
||||||
|
|
||||||
|
await app.RunAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
|
|
||||||
public class Startup
|
|
||||||
{
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
|
||||||
|
|
||||||
services.AddControllersWithViews();
|
|
||||||
services
|
|
||||||
.AddAuthentication(options =>
|
|
||||||
{
|
|
||||||
options.DefaultScheme = "Cookies";
|
|
||||||
options.DefaultChallengeScheme = "oidc";
|
|
||||||
})
|
|
||||||
.AddCookie("Cookies")
|
|
||||||
.AddOpenIdConnect("oidc", options =>
|
|
||||||
{
|
|
||||||
options.Authority = "https://localhost:5001";
|
|
||||||
|
|
||||||
options.ClientId = "mvc";
|
|
||||||
options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0";
|
|
||||||
options.ResponseType = "code";
|
|
||||||
|
|
||||||
options.Scope.Add("scope2");
|
|
||||||
|
|
||||||
options.SaveTokens = true;
|
|
||||||
|
|
||||||
options.GetClaimsFromUserInfoEndpoint = true;
|
|
||||||
options.SaveTokens = true;
|
|
||||||
options.ClaimActions.MapUniqueJsonKey(
|
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role",
|
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
||||||
options.ClaimActions.MapUniqueJsonKey("role",
|
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
||||||
options.ClaimActions.MapUniqueJsonKey("roles",
|
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
||||||
options.TokenValidationParameters = new TokenValidationParameters
|
|
||||||
{
|
|
||||||
NameClaimType = "name",
|
|
||||||
RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
||||||
{
|
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
app.UseExceptionHandler("/Home/Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseStaticFiles();
|
|
||||||
|
|
||||||
app.UseRouting();
|
|
||||||
app.UseAuthentication();
|
|
||||||
app.UseAuthorization();
|
|
||||||
|
|
||||||
app.UseEndpoints(endpoints =>
|
|
||||||
{
|
|
||||||
endpoints.MapDefaultControllerRoute()
|
|
||||||
.RequireAuthorization();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"folders": [
|
|
||||||
{
|
|
||||||
"path": ".vscode"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/test"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/Yavsc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/cli"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/GoogleCode"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/OAuth.AspNet.AuthServer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/OAuth.AspNet.Token"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/Yavsc.Abstract"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "src/Yavsc.Server"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"settings": {
|
|
||||||
"mocha.enabled": true,
|
|
||||||
"git.ignoreLimitWarning": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue