Skip to content

Commit

Permalink
merge hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Jul 15, 2022
2 parents 6a3a903 + 8d42bf0 commit b9bf791
Show file tree
Hide file tree
Showing 9 changed files with 744 additions and 787 deletions.
8 changes: 4 additions & 4 deletions src/EthernaSSO.Domain/EthernaSSO.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

<ItemGroup>
<PackageReference Include="Etherna.DomainEvents" Version="1.3.1" />
<PackageReference Include="EthernaACR" Version="0.3.0" />
<PackageReference Include="EthernaACR" Version="0.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Etherna" Version="0.3.0-alpha.7" />
<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" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.7" />
<PackageReference Include="MongODM.Core" Version="0.23.0" />
<PackageReference Include="Nethereum.Accounts" Version="4.6.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/EthernaSSO.Services/EthernaSSO.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<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.106" />
<PackageReference Include="MongODM.Hangfire" Version="0.23.0" />
</ItemGroup>

<ItemGroup>
Expand Down
26 changes: 13 additions & 13 deletions src/EthernaSSO/EthernaSSO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.1">
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<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.Authentication.Facebook" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.6.4"> <!--Installed only for hide warning-->
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.7.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="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="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.7" />
<PackageReference Include="MongODM" Version="0.23.0" />
<PackageReference Include="MongODM.AspNetCore.UI" Version="0.23.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.2.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.3.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/EthernaSSO/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">
<img src="/images/etherna-header-symbol-colors.png" style="padding-right:4px" /> Etherna SSO Server
<img src="/images/etherna-header-symbol-colors.png" style="padding-right:5px" /> Etherna SSO Server
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
Expand Down
60 changes: 36 additions & 24 deletions src/EthernaSSO/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,31 +187,43 @@ static Task unauthorizedApiCallHandler(RedirectContext<CookieAuthenticationOptio
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();

// Configure authentication.
services.AddAuthentication()
.AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"] ?? throw new ServiceConfigurationException();
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"] ?? throw new ServiceConfigurationException();
})
.AddFacebook(options =>
{
options.AppId = Configuration["Authentication:Facebook:ClientId"] ?? throw new ServiceConfigurationException();
options.AppSecret = Configuration["Authentication:Facebook:ClientSecret"] ?? throw new ServiceConfigurationException();
})
.AddTwitter(options =>
var authBuilder = services.AddAuthentication();

//add external login providers
if (Configuration["Authentication:Google:ClientId"] is not null &&
Configuration["Authentication:Google:ClientSecret"] is not null)
authBuilder.AddGoogle(options =>
{
options.ConsumerKey = Configuration["Authentication:Twitter:ClientId"] ?? throw new ServiceConfigurationException();
options.ConsumerSecret = Configuration["Authentication:Twitter:ClientSecret"] ?? throw new ServiceConfigurationException();
})
.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options =>
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

if (Configuration["Authentication:Facebook:ClientId"] is not null &&
Configuration["Authentication:Facebook:ClientSecret"] is not null)
authBuilder.AddFacebook(options =>
{
options.Audience = "ethernaSsoServiceInteract";
options.Authority = Configuration["IdServer:SsoServer:BaseUrl"] ?? throw new ServiceConfigurationException();
options.AppId = Configuration["Authentication:Facebook:ClientId"];
options.AppSecret = Configuration["Authentication:Facebook:ClientSecret"];
});

if (bool.TryParse(Configuration["IdServer:SsoServer:AllowUnsafeConnection"], out var allowUnsafeConnection))
options.RequireHttpsMetadata = !allowUnsafeConnection;
if (Configuration["Authentication:Twitter:ClientId"] is not null &&
Configuration["Authentication:Twitter:ClientSecret"] is not null)
authBuilder.AddTwitter(options =>
{
options.ConsumerKey = Configuration["Authentication:Twitter:ClientId"];
options.ConsumerSecret = Configuration["Authentication:Twitter:ClientSecret"];
});

//add JWT
authBuilder.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options =>
{
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.
//policy and requirements
services.AddAuthorization(options =>
Expand Down Expand Up @@ -392,7 +404,7 @@ public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider ap
}
else
{
builder.WithOrigins("https://app.etherna.io")
builder.WithOrigins("https://etherna.io")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
Expand All @@ -408,9 +420,6 @@ public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider ap
app.UseAuthentication();
app.UseAuthorization();

// Seed db if required.
app.UseDbContextsSeeding();

// Add Hangfire.
app.UseHangfireDashboard(CommonConsts.HangfireAdminPath,
new Hangfire.DashboardOptions
Expand Down Expand Up @@ -446,6 +455,9 @@ public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider ap
DeleteOldInvitationsTask.TaskId,
task => task.RunAsync(),
"0 5 * * *"); //at 05:00 every day

// Seed db.
app.SeedDbContexts();
}
}
}
2 changes: 1 addition & 1 deletion src/EthernaSSO/Static/scss/base/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $container-max-widths: (
xl: 1140px,
);

$primary: #03B994;
$primary: #27b9d2;

$blue: #1e77eb;
$indigo: #6610f2;
Expand Down
Loading

0 comments on commit b9bf791

Please sign in to comment.