Skip to content

Commit

Permalink
merge hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed May 24, 2022
2 parents fcc997a + 1102d9f commit 206f243
Show file tree
Hide file tree
Showing 15 changed files with 1,776 additions and 2,283 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
WORKDIR /src
Expand Down
10 changes: 5 additions & 5 deletions src/EthernaSSO.Domain/EthernaSSO.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Etherna.SSOServer.Domain</RootNamespace>

<Authors>Etherna Sagl</Authors>
Expand All @@ -13,12 +13,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Etherna.DomainEvents" Version="1.3.0" />
<PackageReference Include="Etherna.DomainEvents" Version="1.3.1" />
<PackageReference Include="EthernaACR" Version="0.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Etherna" Version="0.3.0-alpha.7" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="5.0.12" />
<PackageReference Include="MongODM.Core" Version="0.23.0-alpha.74" />
<PackageReference Include="Nethereum.Accounts" Version="4.1.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.5" />
<PackageReference Include="MongODM.Core" Version="0.23.0-alpha.106" />
<PackageReference Include="Nethereum.Accounts" Version="4.5.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/EthernaSSO.Domain/Models/EntityModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override bool Equals(object? obj)
if (ReferenceEquals(this, obj)) return true;
if (obj is null) return false;
if (EqualityComparer<TKey>.Default.Equals(Id, default) ||
!(obj is IEntityModel<TKey>) ||
obj is not IEntityModel<TKey> ||
EqualityComparer<TKey>.Default.Equals((obj as IEntityModel<TKey>)!.Id, default)) return false;
return GetType() == obj.GetType() &&
EqualityComparer<TKey>.Default.Equals(Id, (obj as IEntityModel<TKey>)!.Id);
Expand Down
2 changes: 1 addition & 1 deletion src/EthernaSSO.Persistence/EthernaSSO.Persistence.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Etherna.SSOServer.Persistence</RootNamespace>

<Authors>Etherna Sagl</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public DomainCollectionRepository(CollectionRepositoryOptions<TModel> options)

public override void Initialize(IDbContext dbContext)
{
if (!(dbContext is IEventDispatcherDbContext))
if (dbContext is not IEventDispatcherDbContext)
throw new InvalidOperationException($"DbContext needs to implement {nameof(IEventDispatcherDbContext)}");

base.Initialize(dbContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DomainGridFSRepository(GridFSRepositoryOptions<TModel> options)

public override void Initialize(IDbContext dbContext)
{
if (!(dbContext is IEventDispatcherDbContext))
if (dbContext is not IEventDispatcherDbContext)
throw new InvalidOperationException($"DbContext needs to implement {nameof(IEventDispatcherDbContext)}");

base.Initialize(dbContext);
Expand Down
6 changes: 3 additions & 3 deletions src/EthernaSSO.Services/EthernaSSO.Services.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<RootNamespace>Etherna.SSOServer.Services</RootNamespace>

Expand All @@ -18,9 +18,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Etherna.DomainEvents.AspNetCore" Version="1.3.0" />
<PackageReference Include="Etherna.DomainEvents.AspNetCore" Version="1.3.1" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.2" />
<PackageReference Include="MongODM.Hangfire" Version="0.23.0-alpha.74" />
<PackageReference Include="MongODM.Hangfire" Version="0.23.0-alpha.106" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ public async Task<IActionResult> OnPostGenerateAndSendAsync()
invitationCode = invitations[i].Code
});

if (link is null)
throw new InvalidOperationException();

var emailBody = await razorViewRenderer.RenderViewToStringAsync(
"Views/Emails/InvitationLetter.cshtml",
new InvitationLetterModel(link));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -79,6 +80,9 @@ public async Task<IActionResult> OnPostAsync()
values: new { area = CommonConsts.IdentityArea, code },
protocol: Request.Scheme);

if (callbackUrl is null)
throw new InvalidOperationException();

// Send email.
var emailBody = await razorViewRenderer.RenderViewToStringAsync(
"Views/Emails/ResetPassword.cshtml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -102,6 +103,9 @@ public async Task<IActionResult> OnPostChangeEmailAsync()
code
});

if (callbackUrl is null)
throw new InvalidOperationException();

var emailBody = await razorViewRenderer.RenderViewToStringAsync(
"Views/Emails/ConfirmEmailChange.cshtml",
new Services.Views.Emails.ConfirmEmailChangeModel(callbackUrl));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@{
if (ViewData.TryGetValue("ParentLayout", out var parentLayout))
{
Layout = (string)parentLayout;
Layout = (string)parentLayout!;
}
else
{
Expand Down
28 changes: 14 additions & 14 deletions src/EthernaSSO/EthernaSSO.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Etherna.SSOServer</RootNamespace>

<Authors>Etherna Sagl</Authors>
Expand All @@ -20,28 +20,28 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.8.1">
<PackageReference Include="GitVersion.MsBuild" Version="5.10.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.4.4"> <!--Installed only for hide warning-->
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.6.4"> <!--Installed only for hide warning-->
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="MongODM" Version="0.23.0-alpha.74" />
<PackageReference Include="MongODM.AspNetCore.UI" Version="0.23.0-alpha.74" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.5" />
<PackageReference Include="MongODM" Version="0.23.0-alpha.106" />
<PackageReference Include="MongODM.AspNetCore.UI" Version="0.23.0-alpha.106" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.0.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.2.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/EthernaSSO/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ static Task unauthorizedApiCallHandler(RedirectContext<CookieAuthenticationOptio
{
options.Audience = "ethernaSsoServiceInteract";
options.Authority = Configuration["IdServer:SsoServer:BaseUrl"] ?? throw new ServiceConfigurationException();

if (bool.TryParse(Configuration["IdServer:SsoServer:AllowUnsafeConnection"], out var allowUnsafeConnection))
options.RequireHttpsMetadata = !allowUnsafeConnection;
});

// Configure authorization.
Expand Down Expand Up @@ -291,6 +294,8 @@ static Task unauthorizedApiCallHandler(RedirectContext<CookieAuthenticationOptio
services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>();
services.AddSwaggerGen(options =>
{
options.SupportNonNullableReferenceTypes();

//add a custom operation filter which sets default values
options.OperationFilter<SwaggerDefaultValues>();

Expand Down
1 change: 1 addition & 0 deletions src/EthernaSSO/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
},

"SsoServer": {
//"AllowUnsafeConnection": false,
"BaseUrl": "https://localhost:44379"
}
}
Expand Down
Loading

0 comments on commit 206f243

Please sign in to comment.