Merge pull request #179 from meysamhadeli/develop

Develop
This commit is contained in:
Meysam Hadeli 2023-02-13 20:40:47 +03:30 committed by GitHub
commit fa78e341b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 15 deletions

View File

@ -38,11 +38,11 @@ runs:
if: ${{ github.ref == 'refs/heads/main' && success() }}
shell: bash
run: |
docker build -t ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ inputs.tag-name }} -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
docker build -t ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.5.1 -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
- name: Publish Docker Image
if: ${{ github.ref == 'refs/heads/main' && success() }}
shell: bash
run: |
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ inputs.tag-name }}
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.5.1

View File

@ -3,14 +3,19 @@ using Identity.Identity.Models;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Identity.Extensions.Infrastructure;
using System.Net;
using Microsoft.IdentityModel.Logging;
public static class IdentityServerExtensions
{
public static IServiceCollection AddIdentityServer(this IServiceCollection services, IWebHostEnvironment env)
public static IServiceCollection AddCustomIdentityServer(this IServiceCollection services, IWebHostEnvironment env)
{
IdentityModelEventSource.ShowPII = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
services.AddIdentity<User, Role>(config =>
{
config.Password.RequiredLength = 6;

View File

@ -77,7 +77,7 @@ public static class InfrastructureExtensions
SnowFlakIdGenerator.Configure(4);
builder.Services.AddIdentityServer(env);
builder.Services.AddCustomIdentityServer(env);
//ref: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-7.0&viewFallbackFrom=aspnetcore-2.2
//ref: https://medium.com/@christopherlenard/identity-server-and-nginx-ingress-controller-in-kubernetes-7146c22a2466
@ -121,16 +121,6 @@ public static class InfrastructureExtensions
return next();
});
app.Use(async (ctx, next) =>
{
if (ctx.Request.Headers.ContainsKey("from-ingress"))
{
ctx.SetIdentityServerOrigin("https://myidentityserver.com");
}
await next();
});
if (env.IsDevelopment())
{
app.UseCustomSwagger();