mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-28 00:20:24 +08:00
commit
fa78e341b6
@ -38,11 +38,11 @@ runs:
|
|||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
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
|
- name: Publish Docker Image
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ inputs.tag-name }}
|
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:v1.5.1
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,19 @@ using Identity.Identity.Models;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
|
|
||||||
namespace Identity.Extensions.Infrastructure;
|
namespace Identity.Extensions.Infrastructure;
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
|
using Microsoft.IdentityModel.Logging;
|
||||||
|
|
||||||
public static class IdentityServerExtensions
|
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 =>
|
services.AddIdentity<User, Role>(config =>
|
||||||
{
|
{
|
||||||
config.Password.RequiredLength = 6;
|
config.Password.RequiredLength = 6;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public static class InfrastructureExtensions
|
|||||||
|
|
||||||
SnowFlakIdGenerator.Configure(4);
|
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://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
|
//ref: https://medium.com/@christopherlenard/identity-server-and-nginx-ingress-controller-in-kubernetes-7146c22a2466
|
||||||
@ -121,16 +121,6 @@ public static class InfrastructureExtensions
|
|||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.Use(async (ctx, next) =>
|
|
||||||
{
|
|
||||||
if (ctx.Request.Headers.ContainsKey("from-ingress"))
|
|
||||||
{
|
|
||||||
ctx.SetIdentityServerOrigin("https://myidentityserver.com");
|
|
||||||
}
|
|
||||||
|
|
||||||
await next();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseCustomSwagger();
|
app.UseCustomSwagger();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user