Browse Source

install curl to web image

pull/51/head
Halil İbrahim Kalkan 5 years ago
parent
commit
f56fe32e75
  1. 13
      etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml
  2. 12
      src/EventHub.IdentityServer/EventHubIdentityServerModule.cs
  3. 1
      src/EventHub.Web/Dockerfile
  4. 3
      src/EventHub.Web/EventHubWebModule.cs

13
etc/k8s/helm-chart/eventhub/charts/account/templates/account-ingress.yaml

@ -5,13 +5,26 @@ metadata:
annotations: annotations:
nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_input_headers "fromingress: true";
spec: spec:
tls: tls:
- hosts: - hosts:
- {{ .Values.accountUrl }} - {{ .Values.accountUrl }}
- accounttemp
secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls secretName: {{ .Release.Name }}-{{ .Chart.Name }}-tls
rules: rules:
- host: "{{ .Values.accountUrl }}" - host: "{{ .Values.accountUrl }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Chart.Name }}
port:
number: 80
- host: "accounttemp"
http: http:
paths: paths:
- path: / - path: /

12
src/EventHub.IdentityServer/EventHubIdentityServerModule.cs

@ -14,6 +14,7 @@ using EventHub.Web;
using EventHub.Web.Theme; using EventHub.Web.Theme;
using EventHub.Web.Theme.Bundling; using EventHub.Web.Theme.Bundling;
using IdentityServer4.Configuration; using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
@ -186,6 +187,7 @@ namespace EventHub
{ {
var app = context.GetApplicationBuilder(); var app = context.GetApplicationBuilder();
var env = context.GetEnvironment(); var env = context.GetEnvironment();
var conf = context.ServiceProvider.GetRequiredService<IConfiguration>();
/* /*
app.Use((context, next) => app.Use((context, next) =>
@ -195,6 +197,16 @@ namespace EventHub
}); });
*/ */
app.Use(async (ctx, next) =>
{
if (ctx.Request.Headers.ContainsKey("fromingress"))
{
ctx.SetIdentityServerOrigin(conf["App:SelfUrl"]);
}
await next();
});
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();

1
src/EventHub.Web/Dockerfile

@ -1,4 +1,5 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0 FROM mcr.microsoft.com/dotnet/aspnet:5.0
COPY bin/Release/net5.0/publish/ app/ COPY bin/Release/net5.0/publish/ app/
RUN apt-get update && apt-get install -y curl
WORKDIR /app WORKDIR /app
ENTRYPOINT ["dotnet", "EventHub.Web.dll"] ENTRYPOINT ["dotnet", "EventHub.Web.dll"]

3
src/EventHub.Web/EventHubWebModule.cs

@ -151,12 +151,13 @@ namespace EventHub.Web
options.Scope.Add("email"); options.Scope.Add("email");
options.Scope.Add("phone"); options.Scope.Add("phone");
options.Scope.Add("EventHub"); options.Scope.Add("EventHub");
/*
options.Events.OnRedirectToIdentityProvider = redirectContext => options.Events.OnRedirectToIdentityProvider = redirectContext =>
{ {
redirectContext.ProtocolMessage.RedirectUri = $"{configuration["App:SelfUrl"]}/signin-oidc"; redirectContext.ProtocolMessage.RedirectUri = $"{configuration["App:SelfUrl"]}/signin-oidc";
return Task.CompletedTask; return Task.CompletedTask;
}; };
*/
}); });
} }

Loading…
Cancel
Save