mirror of https://github.com/abpframework/abp.git
30 changed files with 377 additions and 172 deletions
@ -0,0 +1,37 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using AutoMapper; |
|||
|
|||
namespace Volo.Abp.IdentityServer |
|||
{ |
|||
public class AllowedSigningAlgorithmsConverter : |
|||
IValueConverter<ICollection<string>, string>, |
|||
IValueConverter<string, ICollection<string>> |
|||
{ |
|||
public static AllowedSigningAlgorithmsConverter Converter = new AllowedSigningAlgorithmsConverter(); |
|||
|
|||
public string Convert(ICollection<string> sourceMember, ResolutionContext context) |
|||
{ |
|||
if (sourceMember == null || !sourceMember.Any()) |
|||
{ |
|||
return null; |
|||
} |
|||
return sourceMember.Aggregate((x, y) => $"{x},{y}"); |
|||
} |
|||
|
|||
public ICollection<string> Convert(string sourceMember, ResolutionContext context) |
|||
{ |
|||
var list = new HashSet<string>(); |
|||
if (!String.IsNullOrWhiteSpace(sourceMember)) |
|||
{ |
|||
sourceMember = sourceMember.Trim(); |
|||
foreach (var item in sourceMember.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Distinct()) |
|||
{ |
|||
list.Add(item); |
|||
} |
|||
} |
|||
return list; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Abp.IdentityServer.ApiResources |
|||
{ |
|||
public class ApiResourceScope : Entity |
|||
{ |
|||
public virtual Guid ApiResourceId { get; protected set; } |
|||
|
|||
public virtual string Scope { get; set; } |
|||
|
|||
protected ApiResourceScope() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual bool Equals(Guid apiResourceId, [NotNull] string scope) |
|||
{ |
|||
return ApiResourceId == apiResourceId && Scope == scope; |
|||
} |
|||
|
|||
protected internal ApiResourceScope( |
|||
Guid apiResourceId, |
|||
[NotNull] string scope) |
|||
{ |
|||
Check.NotNull(scope, nameof(scope)); |
|||
|
|||
ApiResourceId = apiResourceId; |
|||
Scope = scope; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { ApiResourceId, Scope }; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Abp.IdentityServer.ApiResources |
|||
{ |
|||
public class ApiScopeProperty : Entity |
|||
{ |
|||
public virtual Guid ApiScopeId { get; set; } |
|||
|
|||
public virtual string Key { get; set; } |
|||
|
|||
public virtual string Value { get; set; } |
|||
|
|||
protected ApiScopeProperty() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual bool Equals(Guid apiScopeId, [NotNull] string key, string value) |
|||
{ |
|||
return ApiScopeId == apiScopeId && Key == key && Value == value; |
|||
} |
|||
|
|||
protected internal ApiScopeProperty(Guid apiScopeId, [NotNull] string key, [NotNull] string value) |
|||
{ |
|||
Check.NotNull(key, nameof(key)); |
|||
|
|||
ApiScopeId = apiScopeId; |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { ApiScopeId, Key }; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using System.Diagnostics.CodeAnalysis; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Abp.IdentityServer.IdentityResources |
|||
{ |
|||
public class IdentityResourceProperty : Entity |
|||
{ |
|||
public virtual Guid IdentityResourceId { get; set; } |
|||
|
|||
public virtual string Key { get; set; } |
|||
|
|||
public virtual string Value { get; set; } |
|||
|
|||
protected IdentityResourceProperty() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual bool Equals(Guid identityResourceId, [NotNull] string key) |
|||
{ |
|||
return IdentityResourceId == identityResourceId && Key == key; |
|||
} |
|||
|
|||
protected internal IdentityResourceProperty(Guid identityResourceId, [NotNull] string key, [NotNull] string value) |
|||
{ |
|||
Check.NotNull(key, nameof(key)); |
|||
|
|||
IdentityResourceId = identityResourceId; |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { IdentityResourceId, Key }; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue