Sort Ordering Usings and Add Support for User ID in OpenActions ...
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xIds.Models;
|
||||||
|
using xIds.Constants;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using xIds.Configurations;
|
||||||
|
using xCommons.Extensions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using xIdentityModels.Configurations;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using MySql.EntityFrameworkCore.Infrastructure;
|
using MySql.EntityFrameworkCore.Infrastructure;
|
||||||
using xCommons.Extensions;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using xIdentityModels.Configurations;
|
|
||||||
using xIds.Configurations;
|
|
||||||
using xIds.Constants;
|
|
||||||
using xIds.Models;
|
|
||||||
|
|
||||||
namespace xIds.Extensions
|
namespace xIds.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
using xIds.Constants;
|
||||||
|
using xCommons.Models;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using xCommons.Extensions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using xCommons.Extensions;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using xCommons.Models;
|
|
||||||
using xIds.Constants;
|
|
||||||
|
|
||||||
namespace xIds.Extensions
|
namespace xIds.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using xCommons.Extensions;
|
|
||||||
using xExceptions.Constants;
|
|
||||||
using xModels.Base;
|
|
||||||
using xIds.Constants;
|
|
||||||
|
|
||||||
namespace xIds.Extensions
|
|
||||||
{
|
|
||||||
public static class IQueryableExtensions
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using xIds.Models;
|
||||||
|
using xIds.Constants;
|
||||||
|
using xIds.Interfaces;
|
||||||
|
using xCommons.Extensions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using IdentityServer4.EntityFramework.DbContexts;
|
using System.Collections.Generic;
|
||||||
using IdentityServer4.EntityFramework.Mappers;
|
using xIdentityModels.Extensions;
|
||||||
|
using xIdentityModels.Descriptors;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using IdentityServer4.EntityFramework.Mappers;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using IdentityServer4.EntityFramework.DbContexts;
|
||||||
using xCommons.Extensions;
|
|
||||||
using xIdentityModels.Descriptors;
|
|
||||||
using xIdentityModels.Extensions;
|
|
||||||
using xIds.Constants;
|
|
||||||
using xIds.Interfaces;
|
|
||||||
using xIds.Models;
|
|
||||||
|
|
||||||
namespace xIds.Extensions
|
namespace xIds.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xDataService.Configuration;
|
using System.Threading.Tasks;
|
||||||
using xIdentityModels.Models;
|
using xIdentityModels.Models;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using xDataService.Configuration;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace xIds.Extensions
|
namespace xIds.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ namespace xIds.Helpers
|
|||||||
var result = new TokenValidationParameters
|
var result = new TokenValidationParameters
|
||||||
{
|
{
|
||||||
ValidIssuer = issuer,
|
ValidIssuer = issuer,
|
||||||
ValidAudience = audience,
|
IssuerSigningKey = key,
|
||||||
ValidateLifetime = true,
|
ValidateLifetime = true,
|
||||||
IssuerSigningKey = key
|
ValidAudience = audience,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using IdentityModel;
|
|
||||||
using xIds.Interfaces;
|
using xIds.Interfaces;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using xCommons.Constants;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xExceptions.Constants;
|
using xExceptions.Constants;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
@@ -11,12 +9,10 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using xIdentityModels.Constants;
|
using xIdentityModels.Constants;
|
||||||
using xIdentityService.Constants;
|
using xIdentityService.Constants;
|
||||||
using System.Collections.Generic;
|
using xIdentityModels.Extensions;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using xIdentityModels.Dtos;
|
|
||||||
using xIdentityService.Extensions;
|
|
||||||
|
|
||||||
namespace xIds.Providers
|
namespace xIds.Providers
|
||||||
{
|
{
|
||||||
@@ -142,29 +138,7 @@ namespace xIds.Providers
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Creating Claims ...
|
// Creating Claims ...
|
||||||
var claims = new List<Claim> {
|
var claims = validationResult.ToXClaims();
|
||||||
//
|
|
||||||
// Owner Identifier of API Key ...
|
|
||||||
new(ClaimTypes.Name, validationResult.OwnerId),
|
|
||||||
new(JwtClaimTypes.Subject, validationResult.OwnerId),
|
|
||||||
//
|
|
||||||
// Application Id ...
|
|
||||||
new(XCustomClaims.ApplicationId, validationResult.ApplicationId.ToString()),
|
|
||||||
//
|
|
||||||
// Authentication Type ...
|
|
||||||
new(XCustomClaims.AuthType, apiKeyAuthentication),
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add Scopes ...
|
|
||||||
if (validationResult.Scopes != null)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
foreach (var scope in validationResult.Scopes)
|
|
||||||
{
|
|
||||||
claims.Add(new Claim(JwtClaimTypes.Scope, scope));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Principal and Ticket ...
|
// Create Principal and Ticket ...
|
||||||
|
|||||||
@@ -537,6 +537,27 @@ namespace xIds.Providers
|
|||||||
isApplicationActive;
|
isApplicationActive;
|
||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Handle Attach Owner ...
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var user = await identityManager.GetUserAsync(
|
||||||
|
containsDetail: true,
|
||||||
|
userSelectByParam: application.OwnerId
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
var owner = user.ToXPerson();
|
||||||
|
result.Owner = owner;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result.Errors.Add($"exception occured: {ex.Message}");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result.Errors.Clear();
|
result.Errors.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,10 +246,11 @@ namespace xIds.Providers
|
|||||||
// Generate a Dynamic Object ...
|
// Generate a Dynamic Object ...
|
||||||
var result = new XOpenActionUserInfoDto
|
var result = new XOpenActionUserInfoDto
|
||||||
{
|
{
|
||||||
|
UserId = userProfile.UserId,
|
||||||
|
Avatar = userProfile.Avatar,
|
||||||
Username = userProfile.UserName,
|
Username = userProfile.UserName,
|
||||||
Firstname = userProfile.FirstName,
|
|
||||||
Lastname = userProfile.LastName,
|
Lastname = userProfile.LastName,
|
||||||
Avatar = userProfile.Avatar
|
Firstname = userProfile.FirstName,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -276,6 +277,7 @@ namespace xIds.Providers
|
|||||||
);
|
);
|
||||||
var result = profiles.Select(x => new XOpenActionUserInfoDto
|
var result = profiles.Select(x => new XOpenActionUserInfoDto
|
||||||
{
|
{
|
||||||
|
UserId = x.UserId,
|
||||||
Avatar = x.Avatar,
|
Avatar = x.Avatar,
|
||||||
Username = x.UserName,
|
Username = x.UserName,
|
||||||
Lastname = x.LastName,
|
Lastname = x.LastName,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using IdentityServer4.EntityFramework.DbContexts;
|
|
||||||
using IdentityServer4.EntityFramework.Mappers;
|
|
||||||
using IdentityServer4.Models;
|
using IdentityServer4.Models;
|
||||||
using IdentityServer4.Stores;
|
using IdentityServer4.Stores;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using IdentityServer4.EntityFramework.Mappers;
|
||||||
|
using IdentityServer4.EntityFramework.DbContexts;
|
||||||
|
|
||||||
namespace xIds.Stores
|
namespace xIds.Stores
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user