-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move IdentityServer to UserModule Infrastructure (#296)
Move IdentityServer to UserModule Infrastructure
- Loading branch information
Showing
8 changed files
with
62 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/Modules/UserAccess/Application/Contracts/CustomClaimTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
namespace CompanyName.MyMeetings.Modules.UserAccess.Application.Contracts | ||
{ | ||
internal class CustomClaimTypes | ||
public class CustomClaimTypes | ||
{ | ||
internal const string Roles = "roles"; | ||
internal const string Email = "email"; | ||
internal const string Name = "name"; | ||
public const string Roles = "roles"; | ||
public const string Email = "email"; | ||
public const string Name = "name"; | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
...UserAccess/Infrastructure/CompanyName.MyMeetings.Modules.UserAccess.Infrastructure.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
<Project Sdk="Microsoft.NET.Sdk" /> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<PackageReference Include="IdentityServer4" Version="4.1.2" /> | ||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> | ||
</ItemGroup> | ||
</Project> |
40 changes: 40 additions & 0 deletions
40
src/Modules/UserAccess/Infrastructure/Configuration/Identity/IdentityConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using CompanyName.MyMeetings.Modules.UserAccess.Infrastructure.IdentityServer; | ||
using IdentityServer4.AccessTokenValidation; | ||
using IdentityServer4.Validation; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace CompanyName.MyMeetings.Modules.UserAccess.Infrastructure.Configuration.Identity; | ||
|
||
public static class IdentityConfiguration | ||
{ | ||
public static IServiceCollection ConfigureIdentityService(this IServiceCollection services) | ||
{ | ||
services.AddIdentityServer() | ||
.AddInMemoryIdentityResources(IdentityServerConfig.GetIdentityResources()) | ||
.AddInMemoryApiScopes(IdentityServerConfig.GetApiScopes()) | ||
.AddInMemoryApiResources(IdentityServerConfig.GetApis()) | ||
.AddInMemoryClients(IdentityServerConfig.GetClients()) | ||
.AddInMemoryPersistedGrants() | ||
.AddProfileService<ProfileService>() | ||
.AddDeveloperSigningCredential(); | ||
|
||
services.AddTransient<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>(); | ||
|
||
services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme) | ||
.AddIdentityServerAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme, x => | ||
{ | ||
x.Authority = "http://localhost:5000"; | ||
x.ApiName = "myMeetingsAPI"; | ||
x.RequireHttpsMetadata = false; | ||
}); | ||
|
||
return services; | ||
} | ||
|
||
public static IApplicationBuilder AddIdentityService(this IApplicationBuilder app) | ||
{ | ||
app.UseIdentityServer(); | ||
return app; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters