Browse Source

Move basic auth server configuration to appsettings.json files.

pull/765/head
Halil ibrahim Kalkan 8 years ago
parent
commit
55726526e9
  1. 10
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs
  2. 5
      samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json
  3. 10
      samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs
  4. 5
      samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json
  5. 5
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs
  6. 4
      samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json
  7. 5
      samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs
  8. 4
      samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json
  9. 5
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs
  10. 4
      samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json
  11. 5
      samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs
  12. 4
      samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json
  13. 5
      samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs
  14. 4
      samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json
  15. 5
      samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs
  16. 4
      samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json

10
samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs

@ -47,23 +47,19 @@ namespace BackendAdminApp.Host
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.RequireHttpsMetadata = false;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = "backend-admin-app-client";
options.ClientSecret = "1q2w3e*";
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("role");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("BackendAdminAppGateway");
options.Scope.Add("IdentityService");
options.Scope.Add("ProductService");
options.ClaimActions.MapAbpClaimTypes();
});

5
samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json

@ -1,4 +1,9 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ClientId": "backend-admin-app-client",
"ClientSecret": "1q2w3e*"
},
"RemoteServices": {
"Default": {
"BaseUrl": "http://localhost:65115/"

10
samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs

@ -50,23 +50,19 @@ namespace PublicWebSite.Host
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.RequireHttpsMetadata = false;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = "public-website-client";
options.ClientSecret = "1q2w3e*";
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("role");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("PublicWebSiteGateway");
options.Scope.Add("ProductService");
options.Scope.Add("BloggingService");
options.ClaimActions.MapAbpClaimTypes();
});

5
samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json

@ -1,4 +1,9 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ClientId": "public-website-client",
"ClientSecret": "1q2w3e*"
},
"RemoteServices": {
"Default": {
"BaseUrl": "http://localhost:64897/"

5
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs

@ -33,10 +33,9 @@ namespace BackendAdminAppGateway.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "BackendAdminAppGateway";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "BackendAdminAppGateway"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},

5
samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs

@ -33,10 +33,9 @@ namespace InternalGateway.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "InternalGateway";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "InternalGateway"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},

5
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs

@ -33,10 +33,9 @@ namespace PublicWebSiteGateway.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "PublicWebSiteGateway";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "PublicWebSiteGateway"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},

5
samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs

@ -42,10 +42,9 @@ namespace BloggingService.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "BloggingService";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "BloggingService"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"Blogging": "mongodb://localhost|MsDemo_Blogging"

5
samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs

@ -37,10 +37,9 @@ namespace IdentityService.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "IdentityService";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "IdentityService"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true"
},

5
samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs

@ -37,10 +37,9 @@ namespace ProductService.Host
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.Authority = configuration["AuthServer:Authority"];
options.ApiName = configuration["AuthServer:ApiName"];
options.RequireHttpsMetadata = false;
options.ApiName = "ProductService";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;

4
samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json

@ -1,4 +1,8 @@
{
"AuthServer": {
"Authority": "http://localhost:64999",
"ApiName": "ProductService"
},
"ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true"

Loading…
Cancel
Save