Skip to content

Commit

Permalink
Fix inherit member
Browse files Browse the repository at this point in the history
  • Loading branch information
feast107 committed Jun 27, 2024
1 parent fa75633 commit 7432031
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ namespace Antelcat.ClaimSerialization.ComponentModel;
/// <summary>
/// Replace the <see cref="Claim.Type"/> of the <see cref="Claim"/>
/// </summary>
/// <param name="Type"> Special Types from <see cref="System.Security.Claims.ClaimTypes"/> </param>
/// <param name="type"> Special Types from <see cref="System.Security.Claims.ClaimTypes"/> </param>
[AttributeUsage(AttributeTargets.Property)]
public class ClaimTypeAttribute(string? Type = null) : Attribute;
public class ClaimTypeAttribute(string? type = null) : Attribute
{
internal string? Type { get; } = type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<IsPackable>true</IsPackable>
<LangVersion>preview</LangVersion>

<Version>2.0.0-pre-alpha-1</Version>
<FileVersion>2.0.0.0</FileVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<Version>2.0.0-pre-alpha-2</Version>
<FileVersion>2.0.0.1</FileVersion>
<AssemblyVersion>2.0.0.1</AssemblyVersion>

<Authors>Antelcat</Authors>
<Title>Antelcat.ClaimSerialization</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,8 @@ public RuntimeClaimTypeInfo()
Getters = ResolveGetHandlers(claimProps).ToArray();
}

private static string GetClaimType(MemberInfo property)
{
var claimType = property.Name;
var attr = property.CustomAttributes
.FirstOrDefault(x => x.AttributeType == typeof(ClaimTypeAttribute));
if (attr != null)
{
claimType = attr.ConstructorArguments[0].Value as string ?? property.Name;
}

return claimType;
}
private static string GetClaimType(MemberInfo property) =>
property.GetCustomAttribute<ClaimTypeAttribute>()?.Type ?? property.Name;

private static IEnumerable<SetProperty> ResolveSetHandlers(
IEnumerable<PropertyInfo> properties) =>
Expand Down

0 comments on commit 7432031

Please sign in to comment.