Compare commits
No commits in common. "8cfbad61fbf5ff116ad815133f94629033337492" and "9a02f0e4d681e71a04a498d2009502bd400ec771" have entirely different histories.
8cfbad61fb
...
9a02f0e4d6
@ -11,7 +11,6 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
public UserAdapter? User { get; set; }
|
public UserAdapter? User { get; set; }
|
||||||
|
|
||||||
public RoleAdapter? Role { get; set; }
|
public RoleAdapter? Role { get; set; }
|
||||||
public TenantAdapter? Tenant { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<PermissionAdapter>? Permissions { get; set; }
|
public IEnumerable<PermissionAdapter>? Permissions { get; set; }
|
||||||
public IEnumerable<ModuleAdapter> Modules { get; set; } = null!;
|
public IEnumerable<ModuleAdapter> Modules { get; set; } = null!;
|
||||||
|
|||||||
@ -16,6 +16,14 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
[CollectionAttributeName("Users")]
|
[CollectionAttributeName("Users")]
|
||||||
public class UserAdapter : Document
|
public class UserAdapter : Document
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the guid of the user.
|
||||||
|
/// </summary>
|
||||||
|
[BsonElement("guid")]
|
||||||
|
[BsonRepresentation(BsonType.String)]
|
||||||
|
[JsonPropertyName("guid")]
|
||||||
|
public string? Guid { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the email address of the user.
|
/// Gets or sets the email address of the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,14 +64,6 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
[JsonPropertyName("displayName")]
|
[JsonPropertyName("displayName")]
|
||||||
public string? DisplayName { get; set; }
|
public string? DisplayName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Tenand ID of the user.
|
|
||||||
/// </summary>
|
|
||||||
[BsonElement("tenantId")]
|
|
||||||
[BsonRepresentation(BsonType.ObjectId)]
|
|
||||||
[JsonPropertyName("tenantId")]
|
|
||||||
public string TenantId { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the role ID of the user.
|
/// Gets or sets the role ID of the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -23,20 +23,10 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Claim name for user's ID.
|
/// Claim name for user's ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Id = "_id";
|
public const string Id = "id";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Claim name for user's tenant name.
|
/// Claim name for user's role ID.
|
||||||
/// </summary>
|
|
||||||
public const string Tenant = "tenant";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Claim name for user's tenant identifier.
|
|
||||||
/// </summary>
|
|
||||||
public const string TenantId = "tenantId";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Claim name for user's role name.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Role = "role";
|
public const string Role = "role";
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,5 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
public const string GoogleClientId = "GoogleClientId";
|
public const string GoogleClientId = "GoogleClientId";
|
||||||
public const string GoogleClientSecret = "GoogleClientSecret";
|
public const string GoogleClientSecret = "GoogleClientSecret";
|
||||||
public const string GoogleRedirectUri = "GoogleRedirectUri";
|
public const string GoogleRedirectUri = "GoogleRedirectUri";
|
||||||
public const string GoogleLocalRedirectUri = "GoogleLocalRedirectUri";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.OpenApi.Any;
|
using Microsoft.OpenApi.Any;
|
||||||
using Microsoft.OpenApi.Interfaces;
|
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||||
@ -115,12 +114,6 @@ namespace Core.Thalos.BuildingBlocks.Configuration
|
|||||||
c.AddSecurityDefinition(googleScheme, new OpenApiSecurityScheme
|
c.AddSecurityDefinition(googleScheme, new OpenApiSecurityScheme
|
||||||
{
|
{
|
||||||
Type = SecuritySchemeType.OAuth2,
|
Type = SecuritySchemeType.OAuth2,
|
||||||
|
|
||||||
Extensions = new Dictionary<string, IOpenApiExtension>
|
|
||||||
{
|
|
||||||
["x-tokenName"] = new OpenApiString("id_token")
|
|
||||||
},
|
|
||||||
|
|
||||||
Flows = new OpenApiOAuthFlows
|
Flows = new OpenApiOAuthFlows
|
||||||
{
|
{
|
||||||
AuthorizationCode = new OpenApiOAuthFlow
|
AuthorizationCode = new OpenApiOAuthFlow
|
||||||
|
|||||||
@ -112,7 +112,7 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
{
|
{
|
||||||
googleSettings.ClientId = (await keyVaultProvider.GetSecretAsync(Secrets.GoogleClientId, new CancellationToken { })).Secret.Value; ;
|
googleSettings.ClientId = (await keyVaultProvider.GetSecretAsync(Secrets.GoogleClientId, new CancellationToken { })).Secret.Value; ;
|
||||||
googleSettings.ClientSecret = (await keyVaultProvider.GetSecretAsync(Secrets.GoogleClientSecret, new CancellationToken { })).Secret.Value;
|
googleSettings.ClientSecret = (await keyVaultProvider.GetSecretAsync(Secrets.GoogleClientSecret, new CancellationToken { })).Secret.Value;
|
||||||
googleSettings.RedirectUri = builder.Configuration.GetSection(Secrets.GoogleLocalRedirectUri).Value;
|
googleSettings.RedirectUri = (await keyVaultProvider.GetSecretAsync(Secrets.GoogleRedirectUri, new CancellationToken { })).Secret.Value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -87,10 +87,8 @@ namespace Core.Thalos.BuildingBlocks
|
|||||||
{
|
{
|
||||||
|
|
||||||
new Claim(Claims.Name, adapter?.User?.DisplayName ?? string.Empty),
|
new Claim(Claims.Name, adapter?.User?.DisplayName ?? string.Empty),
|
||||||
new Claim(Claims.Id, adapter?.User?.Id ?? string.Empty),
|
new Claim(Claims.GUID, adapter?.User?.Guid ?? string.Empty),
|
||||||
new Claim(Claims.Email, adapter?.User?.Email ?? string.Empty),
|
new Claim(Claims.Email, adapter?.User?.Email ?? string.Empty),
|
||||||
new Claim(Claims.Tenant, adapter?.Tenant?.Name ?? string.Empty),
|
|
||||||
new Claim(Claims.Tenant, adapter?.Tenant?.Id ?? string.Empty),
|
|
||||||
new Claim(Claims.Role, adapter?.Role?.Name ?? string.Empty),
|
new Claim(Claims.Role, adapter?.Role?.Name ?? string.Empty),
|
||||||
new Claim(Claims.RoleId, adapter?.Role?.Id ?? string.Empty),
|
new Claim(Claims.RoleId, adapter?.Role?.Id ?? string.Empty),
|
||||||
new Claim(Claims.Applications, JsonSerializer.Serialize(adapter?.Role?.Applications), JsonClaimValueTypes.JsonArray),
|
new Claim(Claims.Applications, JsonSerializer.Serialize(adapter?.Role?.Applications), JsonClaimValueTypes.JsonArray),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user