Browse Source

Moved the fully qualified namespace on top

pull/1742/head
Sumit Ghosh 3 years ago
parent
commit
916549360a
5 changed files with 43 additions and 37 deletions
  1. +32
    -30
      src/Services/Identity/Identity.API/Configuration/Config.cs
  2. +3
    -1
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  3. +0
    -2
      src/Services/Identity/Identity.API/GlobalUsings.cs
  4. +5
    -3
      src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs
  5. +3
    -1
      src/Services/Identity/Identity.API/Startup.cs

+ 32
- 30
src/Services/Identity/Identity.API/Configuration/Config.cs View File

@ -1,26 +1,28 @@
namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
using IdentityServer4.Models;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
{
public class Config
{
// ApiResources define the apis in your system
public static IEnumerable<IdentityServer4.Models.ApiResource> GetApis()
public static IEnumerable<ApiResource> GetApis()
{
return new List<IdentityServer4.Models.ApiResource>
return new List<ApiResource>
{
new IdentityServer4.Models.ApiResource("orders", "Orders Service"),
new IdentityServer4.Models.ApiResource("basket", "Basket Service"),
new IdentityServer4.Models.ApiResource("mobileshoppingagg", "Mobile Shopping Aggregator"),
new IdentityServer4.Models.ApiResource("webshoppingagg", "Web Shopping Aggregator"),
new IdentityServer4.Models.ApiResource("orders.signalrhub", "Ordering Signalr Hub"),
new IdentityServer4.Models.ApiResource("webhooks", "Webhooks registration Service"),
new ApiResource("orders", "Orders Service"),
new ApiResource("basket", "Basket Service"),
new ApiResource("mobileshoppingagg", "Mobile Shopping Aggregator"),
new ApiResource("webshoppingagg", "Web Shopping Aggregator"),
new ApiResource("orders.signalrhub", "Ordering Signalr Hub"),
new ApiResource("webhooks", "Webhooks registration Service"),
};
}
// Identity resources are data like user ID, name, or email address of a user
// see: http://docs.identityserver.io/en/release/configuration/resources.html
public static IEnumerable<IdentityServer4.Models.IdentityResource> GetResources()
public static IEnumerable<IdentityResource> GetResources()
{
return new List<IdentityServer4.Models.IdentityResource>
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile()
@ -28,12 +30,12 @@
}
// client want to access resources (aka scopes)
public static IEnumerable<IdentityServer4.Models.Client> GetClients(Dictionary<string, string> clientsUrl)
public static IEnumerable<Client> GetClients(Dictionary<string, string> clientsUrl)
{
return new List<IdentityServer4.Models.Client>
return new List<Client>
{
// JavaScript Client
new IdentityServer4.Models.Client
new Client
{
ClientId = "js",
ClientName = "eShop SPA OpenId Client",
@ -54,7 +56,7 @@
"webhooks"
},
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "xamarin",
ClientName = "eShop Xamarin OpenId Client",
@ -62,7 +64,7 @@
//Used to retrieve the access token on the back channel.
ClientSecrets =
{
new IdentityServer4.Models.Secret("secret".Sha256())
new Secret("secret".Sha256())
},
RedirectUris = { clientsUrl["Xamarin"] },
RequireConsent = false,
@ -83,14 +85,14 @@
AllowOfflineAccess = true,
AllowAccessTokensViaBrowser = true
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "mvc",
ClientName = "MVC Client",
ClientSecrets = new List<IdentityServer4.Models.Secret>
ClientSecrets = new List<Secret>
{
new IdentityServer4.Models.Secret("secret".Sha256())
new Secret("secret".Sha256())
},
ClientUri = $"{clientsUrl["Mvc"]}", // public uri of the client
AllowedGrantTypes = GrantTypes.Hybrid,
@ -120,13 +122,13 @@
AccessTokenLifetime = 60*60*2, // 2 hours
IdentityTokenLifetime= 60*60*2 // 2 hours
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "webhooksclient",
ClientName = "Webhooks Client",
ClientSecrets = new List<IdentityServer4.Models.Secret>
ClientSecrets = new List<Secret>
{
new IdentityServer4.Models.Secret("secret".Sha256())
new Secret("secret".Sha256())
},
ClientUri = $"{clientsUrl["WebhooksWeb"]}", // public uri of the client
AllowedGrantTypes = GrantTypes.Hybrid,
@ -152,13 +154,13 @@
AccessTokenLifetime = 60*60*2, // 2 hours
IdentityTokenLifetime= 60*60*2 // 2 hours
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "mvctest",
ClientName = "MVC Client Test",
ClientSecrets = new List<IdentityServer4.Models.Secret>
ClientSecrets = new List<Secret>
{
new IdentityServer4.Models.Secret("secret".Sha256())
new Secret("secret".Sha256())
},
ClientUri = $"{clientsUrl["Mvc"]}", // public uri of the client
AllowedGrantTypes = GrantTypes.Hybrid,
@ -184,7 +186,7 @@
"webhooks"
},
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "basketswaggerui",
ClientName = "Basket Swagger UI",
@ -199,7 +201,7 @@
"basket"
}
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "orderingswaggerui",
ClientName = "Ordering Swagger UI",
@ -214,7 +216,7 @@
"orders"
}
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "mobileshoppingaggswaggerui",
ClientName = "Mobile Shopping Aggregattor Swagger UI",
@ -229,7 +231,7 @@
"mobileshoppingagg"
}
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "webshoppingaggswaggerui",
ClientName = "Web Shopping Aggregattor Swagger UI",
@ -245,7 +247,7 @@
"basket"
}
},
new IdentityServer4.Models.Client
new Client
{
ClientId = "webhooksswaggerui",
ClientName = "WebHooks Service Swagger UI",


+ 3
- 1
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -1,4 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
using IdentityServer4.EntityFramework.Entities;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
{
public class ConfigurationDbContextSeed
{


+ 0
- 2
src/Services/Identity/Identity.API/GlobalUsings.cs View File

@ -7,7 +7,6 @@ global using Azure.Identity;
global using HealthChecks.UI.Client;
global using IdentityModel;
global using IdentityServer4.EntityFramework.DbContexts;
global using IdentityServer4.EntityFramework.Entities;
global using IdentityServer4.EntityFramework.Mappers;
global using IdentityServer4.EntityFramework.Options;
global using IdentityServer4.Models;
@ -18,7 +17,6 @@ global using IdentityServer4;
global using Microsoft.AspNetCore.Authentication;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.DataProtection;
global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.Identity.EntityFrameworkCore;


+ 5
- 3
src/Services/Identity/Identity.API/Models/AccountViewModels/ConsentViewModel.cs View File

@ -1,8 +1,10 @@
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
using IdentityServer4.Models;
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
{
public record ConsentViewModel : ConsentInputModel
{
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, IdentityServer4.Models.Client client, Resources resources)
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources)
{
RememberConsent = model?.RememberConsent ?? true;
ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty<string>();
@ -39,7 +41,7 @@
Checked = check || scope.Required;
}
public ScopeViewModel(IdentityServer4.Models.IdentityResource identity, bool check)
public ScopeViewModel(IdentityResource identity, bool check)
{
Name = identity.Name;
DisplayName = identity.DisplayName;


+ 3
- 1
src/Services/Identity/Identity.API/Startup.cs View File

@ -1,4 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Identity.API
using Microsoft.AspNetCore.DataProtection;
namespace Microsoft.eShopOnContainers.Services.Identity.API
{
public class Startup
{


Loading…
Cancel
Save