-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
917 additions
and
412 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
65 changes: 65 additions & 0 deletions
65
src/Destiny.Core.Flow.DTOs/IdentityServer4/ApiResourceSecretDto.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,65 @@ | ||
using Destiny.Core.Flow.Extensions; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4 | ||
{ | ||
public class ApiResourceSecretDto | ||
{ | ||
|
||
public string Description | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
|
||
public string Value | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
|
||
public DateTime? Expiration | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
|
||
public string Type | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
|
||
public ApiResourceSecretDto() | ||
{ | ||
Type = "SharedSecret"; | ||
Value = this.Value.Sha256(); | ||
} | ||
|
||
|
||
|
||
|
||
//public ApiResourceSecretDto(string value, DateTime? expiration = null) | ||
// : this() | ||
//{ | ||
// Value = value; | ||
// Expiration = expiration; | ||
//} | ||
|
||
|
||
|
||
//public ApiResourceSecretDto(string value, string description, DateTime? expiration = null) | ||
// : this() | ||
//{ | ||
// Description = description; | ||
// Value = value; | ||
// Expiration = expiration; | ||
//} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Destiny.Core.Flow.DTOs/IdentityServer4/ApiScopeClaimDto.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,14 @@ | ||
using Destiny.Core.Flow.Entity; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4 | ||
{ | ||
public class ApiScopeClaimDto : IDto<Guid> | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
|
||
} | ||
} |
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,97 @@ | ||
using Destiny.Core.Flow.Entity; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4 | ||
{ | ||
public class ApiScopeDto : IDto<Guid> | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
|
||
// | ||
// 摘要: | ||
// Indicates if this resource is enabled. Defaults to true. | ||
public bool Enabled | ||
{ | ||
get; | ||
set; | ||
} = true; | ||
|
||
|
||
// | ||
// 摘要: | ||
// The unique name of the resource. | ||
public string Name | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
// | ||
// 摘要: | ||
// Display name of the resource. | ||
public string DisplayName | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
// | ||
// 摘要: | ||
// Description of the resource. | ||
public string Description | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
// | ||
// 摘要: | ||
// Specifies whether this scope is shown in the discovery document. Defaults to | ||
// true. | ||
public bool ShowInDiscoveryDocument | ||
{ | ||
get; | ||
set; | ||
} = true; | ||
|
||
|
||
// | ||
// 摘要: | ||
// List of associated user claims that should be included when this resource is | ||
// requested. | ||
public ICollection<string> UserClaims | ||
{ | ||
get; | ||
set; | ||
} = new HashSet<string>(); | ||
|
||
|
||
// | ||
// 摘要: | ||
// Gets or sets the custom properties for the resource. | ||
// | ||
// 值: | ||
// The properties. | ||
public IDictionary<string, string> Properties | ||
{ | ||
get; | ||
set; | ||
} = new Dictionary<string, string>(); | ||
|
||
/// <summary> | ||
/// 是否必须 | ||
/// </summary> | ||
[Description("是否必须")] | ||
public bool Required { get; set; } | ||
|
||
/// <summary> | ||
/// 是否强调显示 | ||
/// </summary> | ||
[Description("是否强调显示")] | ||
public bool Emphasize { get; set; } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Destiny.Core.Flow.DTOs/IdentityServer4/ApiScopePropertyDto.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,16 @@ | ||
using Destiny.Core.Flow.Entity; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4 | ||
{ | ||
public class ApiScopePropertyDto : IDto<Guid> | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Key { get; set; } | ||
|
||
public string Name { get; set; } | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/Destiny.Core.Flow.DTOs/IdentityServer4/Profiles/ApiResourceProfile.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,51 @@ | ||
using AutoMapper; | ||
using Destiny.Core.Flow.Dtos.PlatformApplication; | ||
using Destiny.Core.Flow.Extensions; | ||
using Destiny.Core.Flow.Model.DestinyIdentityServer4; | ||
using IdentityModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4.Profiles | ||
{ | ||
/// <summary> | ||
/// 资源APIProfile | ||
/// </summary> | ||
public class ApiResourceProfile : Profile | ||
{ | ||
|
||
public ApiResourceProfile() | ||
{ | ||
|
||
|
||
CreateMap<ApiResourceProperty, KeyValuePair<string, string>>() | ||
.ReverseMap(); | ||
|
||
CreateMap<ApiResource, ApiResourceInputDto>(MemberList.Destination) | ||
.ConstructUsing(src => new ApiResourceInputDto()) | ||
.ForMember(x => x.ApiSecrets, opts => opts.MapFrom(x => x.Secrets)) | ||
.ForMember(x => x.AllowedAccessTokenSigningAlgorithms, opts => opts.ConvertUsing(AllowedSigningAlgorithmsConverter.Converter, x => x.AllowedAccessTokenSigningAlgorithms)) | ||
.ReverseMap() | ||
.ForMember(x => x.AllowedAccessTokenSigningAlgorithms, opts => opts.ConvertUsing(AllowedSigningAlgorithmsConverter.Converter, x => x.AllowedAccessTokenSigningAlgorithms)); | ||
|
||
|
||
CreateMap<ApiResourceSecret, ApiResourceSecretDto>(MemberList.Destination) | ||
.ForMember(dest => dest.Type, opt => opt.Condition(srs => srs != null)) | ||
.ReverseMap(); | ||
|
||
CreateMap<ApiResourceClaim, string>() | ||
.ConstructUsing(x => x.Type) | ||
.ReverseMap() | ||
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); | ||
|
||
|
||
CreateMap<ApiResourceScope, string>() | ||
.ConstructUsing(x => x.Scope) | ||
.ReverseMap() | ||
.ForMember(dest => dest.Scope, opt => opt.MapFrom(src => src)); | ||
|
||
|
||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Destiny.Core.Flow.DTOs/IdentityServer4/Profiles/ApiScopeMapperProfile.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,30 @@ | ||
using AutoMapper; | ||
using Destiny.Core.Flow.Model.DestinyIdentityServer4; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4.Profiles | ||
{ | ||
public class ApiScopeMapperProfile : Profile | ||
{ | ||
/// <summary> | ||
/// <see cref="ApiScopeMapperProfile"/> | ||
/// </summary> | ||
public ApiScopeMapperProfile() | ||
{ | ||
CreateMap<ApiScopeProperty, KeyValuePair<string, string>>() | ||
.ReverseMap(); | ||
|
||
CreateMap<ApiScopeClaim, string>() | ||
.ConstructUsing(x => x.Type) | ||
.ReverseMap() | ||
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src)); | ||
|
||
CreateMap<ApiScope, ApiScopeDto>(MemberList.Destination) | ||
.ConstructUsing(src => new ApiScopeDto()) | ||
.ForMember(x => x.Properties, opts => opts.MapFrom(x => x.Properties)) | ||
.ForMember(x => x.UserClaims, opts => opts.MapFrom(x => x.UserClaims)) | ||
.ReverseMap(); | ||
} | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
src/Destiny.Core.Flow.DTOs/IdentityServer4/ResourceServiceInputDto.cs
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/Destiny.Core.Flow.DTOs/IdentityServer4/UserClaimDto.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,19 @@ | ||
using Destiny.Core.Flow.Entity; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Text; | ||
|
||
namespace Destiny.Core.Flow.Dtos.IdentityServer4 | ||
{ | ||
public class UserClaimDto : IDto<Guid> | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
/// <summary> | ||
/// 类型 | ||
/// </summary> | ||
[DisplayName("类型")] | ||
public string Type { get; set; } | ||
} | ||
} |
Oops, something went wrong.