Browse Source

Http for identity

jkotalik/newVotingSample
Justin Kotalik 6 years ago
parent
commit
6fc64ddae2
  1. 23
      samples/voting/IdentityServer/Startup.cs
  2. 3
      samples/voting/results/Startup.cs
  3. 15
      samples/voting/tye.yaml

23
samples/voting/IdentityServer/Startup.cs

@ -49,7 +49,6 @@ namespace IdentityServer
// in-memory, code config // in-memory, code config
builder.AddInMemoryIdentityResources(Config.IdentityResources); builder.AddInMemoryIdentityResources(Config.IdentityResources);
// builder.AddInMemoryApiScopes(Config.ApiScopes); // builder.AddInMemoryApiScopes(Config.ApiScopes);
Console.WriteLine(Configuration.GetServiceUri("results:https"));
builder.AddInMemoryClients(new Client[] builder.AddInMemoryClients(new Client[]
{ {
// m2m client credentials flow client // m2m client credentials flow client
@ -61,30 +60,18 @@ namespace IdentityServer
AllowedGrantTypes = GrantTypes.Code, AllowedGrantTypes = GrantTypes.Code,
RedirectUris = { $"{Configuration.GetServiceUri("results:https")}signin-oidc" }, RedirectUris = { $"{Configuration.GetServiceUri("results:http")}signin-oidc" },
FrontChannelLogoutUri = $"{Configuration.GetServiceUri("results:https")}signout-oidc", FrontChannelLogoutUri = $"{Configuration.GetServiceUri("results:http")}signout-oidc",
PostLogoutRedirectUris = { $"{Configuration.GetServiceUri("results:https")}signout-callback-oidc" }, PostLogoutRedirectUris = { $"{Configuration.GetServiceUri("results:http")}signout-callback-oidc" },
AllowOfflineAccess = true, AllowOfflineAccess = true,
// AllowedCorsOrigins = { $"{Configuration.GetServiceUri("results:https")}" }, // AllowedCorsOrigins = { $"{Configuration.GetServiceUri("results")}" },
AllowedScopes = new List<string>{IdentityServerConstants.StandardScopes.OpenId,IdentityServerConstants.StandardScopes.Profile, "scope"} AllowedScopes = new List<string>{IdentityServerConstants.StandardScopes.OpenId,IdentityServerConstants.StandardScopes.Profile, "scope"}
}, },
}); });
// not recommended for production - you need to store your key material somewhere secure // not recommended for production - you need to store your key material somewhere secure
builder.AddDeveloperSigningCredential(); builder.AddDeveloperSigningCredential();
services.AddAuthentication()
.AddGoogle(options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
// register your IdentityServer with Google at https://console.developers.google.com
// enable the Google+ API
// set the redirect URI to https://localhost:5001/signin-google
options.ClientId = "copy client ID from Google here";
options.ClientSecret = "copy client secret from Google here";
});
} }
public void Configure(IApplicationBuilder app) public void Configure(IApplicationBuilder app)
@ -105,4 +92,4 @@ namespace IdentityServer
}); });
} }
} }
} }

3
samples/voting/results/Startup.cs

@ -34,11 +34,12 @@ namespace Results
.AddCookie("Cookies") .AddCookie("Cookies")
.AddOpenIdConnect("oidc", options => .AddOpenIdConnect("oidc", options =>
{ {
options.Authority = Configuration.GetServiceUri("identityserver:https").AbsoluteUri; options.Authority = Configuration.GetServiceUri("identityserver:http").AbsoluteUri;
options.ClientId = "interactive"; options.ClientId = "interactive";
options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0"; options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0";
options.ResponseType = "code"; options.ResponseType = "code";
options.SaveTokens = true; options.SaveTokens = true;
options.RequireHttpsMetadata = false;
}); });
} }

15
samples/voting/tye.yaml

@ -20,10 +20,17 @@ services:
- name: results - name: results
project: results/results.csproj project: results/results.csproj
bindings: bindings:
- name: https - name: http
protocol: https protocol: http
- name: identityserver - name: identityserver
project: IdentityServer/IdentityServer.csproj project: IdentityServer/IdentityServer.csproj
bindings: bindings:
- name: https - name: http
protocol: https protocol: http
# ingress:
# - name: ingress
# rules:
# - path: /vote
# service: vote
# - path: /results
# service: results
Loading…
Cancel
Save