Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Juris Gekiss authored and Juris Gekiss committed Aug 16, 2024
1 parent cb79d0b commit 8385e77
Show file tree
Hide file tree
Showing 23 changed files with 179 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ dotnet_diagnostic.SA1200.severity = silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
dotnet_diagnostic.SA1027.severity = silent
dotnet_diagnostic.SA1505.severity = suggestion
dotnet_diagnostic.SA1101.severity = silent
dotnet_diagnostic.SA1503.severity = suggestion

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build --verbosity normal --configuration Release
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DefineConstants>$(DefineConstants);AZUREAD</DefineConstants>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Abc.IdentityModel.Http/Abc.IdentityModel.Http.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<DefineConstants>$(DefineConstants);TPL</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------
// <copyright file="ChiperData.cs" company="ABC software Ltd">
// <copyright file="CipherData.cs" company="ABC software Ltd">
// Copyright © ABC SOFTWARE. All rights reserved.
//
// Licensed under the Apache License, Version 2.0.
Expand All @@ -17,7 +17,7 @@ namespace Abc.IdentityModel.Xml {
/// <remarks>https://www.w3.org/TR/xmlenc-core/#sec-CipherData</remarks>
public class CipherData {
/// <summary>
/// Initializes an instance of <see cref="CipherData"/> with cipher value.
/// Initializes a new instance of the <see cref="CipherData"/> class with cipher value.
/// </summary>
/// <param name="cipherValue">The cipher value.</param>
/// <exception cref="ArgumentNullException">if <paramref name="cipherValue"/> is null.</exception>
Expand All @@ -26,11 +26,11 @@ public CipherData(byte[] cipherValue) {
}

/// <summary>
/// Gets or sets the cipher value.
/// Gets the cipher value.
/// </summary>
/// <value>
/// The cipher value.
/// </value>
public byte[] CipherValue { get; }
}
}
}
2 changes: 1 addition & 1 deletion src/Abc.IdentityModel.Xml/EncryptedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public sealed class EncryptedData : EncryptedType {
public EncryptedData() {
}
}
}
}
4 changes: 2 additions & 2 deletions src/Abc.IdentityModel.Xml/EncryptedKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public EncryptedKey() {
}

/// <summary>
/// Gets the associated user readable name with the key value.
/// Gets or sets the associated user readable name with the key value.
/// </summary>
/// <value>
/// The associated user readable name with the key value.
Expand All @@ -43,4 +43,4 @@ public EncryptedKey() {
/// </value>
public ReferenceList ReferenceList { get; internal set; } = new ReferenceList();
}
}
}
10 changes: 5 additions & 5 deletions src/Abc.IdentityModel.Xml/EncryptedKeyDSigSerialzier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Abc.IdentityModel.Xml {
using static Microsoft.IdentityModel.Logging.LogHelper;

/// <summary>
/// Reads and writes XML conforming to https://www.w3.org/TR/2001/PR-xmldsig-core-20010820
/// Reads and writes XML conforming to https://www.w3.org/TR/2001/PR-xmldsig-core-20010820.
/// </summary>
public class EncryptedKeyDSigSerialzier : DSigSerializer {
/// <summary>
Expand All @@ -26,11 +26,11 @@ public EncryptedKeyDSigSerialzier(EncryptionSerializer encryptionSerializer) {
}

/// <summary>
/// Returns the <see cref="EncryptionSerializer"/>.
/// Gets the <see cref="EncryptionSerializer"/>.
/// </summary>
public EncryptionSerializer EncryptionSerializer { get; }

///<inheritdoc/>
/// <inheritdoc/>
public override void WriteKeyInfo(XmlWriter writer, KeyInfo keyInfo) {
if (keyInfo is EncryptedKeyKeyInfo encryptedKeyInfo) {
writer.WriteStartElement(XmlSignatureConstants.Elements.KeyInfo, XmlSignatureConstants.Namespace);
Expand All @@ -42,7 +42,7 @@ public override void WriteKeyInfo(XmlWriter writer, KeyInfo keyInfo) {
base.WriteKeyInfo(writer, keyInfo);
}

///<inheritdoc/>
/// <inheritdoc/>
public override KeyInfo ReadKeyInfo(XmlReader reader) {
XmlUtil.CheckReaderOnEntry(reader, XmlSignatureConstants.Elements.KeyInfo, XmlSignatureConstants.Namespace);

Expand All @@ -63,4 +63,4 @@ public override KeyInfo ReadKeyInfo(XmlReader reader) {
return base.ReadKeyInfo(new XmlNodeReader(node));
}
}
}
}
2 changes: 1 addition & 1 deletion src/Abc.IdentityModel.Xml/EncryptedKeyKeyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public EncryptedKeyKeyInfo(EncryptedKey encryptedKey) {
/// </value>
public EncryptedKey EncryptedKey { get; }
}
}
}
8 changes: 4 additions & 4 deletions src/Abc.IdentityModel.Xml/EncryptedType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Abc.IdentityModel.Xml {
/// <remarks>https://www.w3.org/TR/xmlenc-core/#sec-EncryptedType</remarks>
public abstract class EncryptedType {
private CipherData cipherData;
//private readonly List<string> encryptionProperties = new List<string>();
// private readonly List<string> encryptionProperties = new List<string>();

/// <summary>
/// Initializes a new instance of the <see cref="EncryptedType"/> class.
Expand Down Expand Up @@ -67,16 +67,16 @@ protected EncryptedType() {
public EncryptionMethod EncryptionMethod { get; set; }

/// <summary>
/// Gets of sets the <see cref="KeyInfo"/> element in XML encryption.
/// Gets or sets the <see cref="KeyInfo"/> element in XML encryption.
/// </summary>
public KeyInfo KeyInfo { get; set; }

/// <summary>
/// Gets the <see cref="CipherData"/> value for an instance of an <see cref="EncryptedType"/> class.
/// Gets or sets the <see cref="CipherData"/> value for an instance of an <see cref="EncryptedType"/> class.
/// </summary>
public CipherData CipherData {
get => cipherData;
set => cipherData = value ?? throw LogArgumentNullException(nameof(value));
}
}
}
}
6 changes: 3 additions & 3 deletions src/Abc.IdentityModel.Xml/EncryptionMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public EncryptionMethod(Uri algorithm) {
}

/// <summary>
/// Gets or sets the algorithm Uniform Resource Identifier(URI).
/// Gets the algorithm Uniform Resource Identifier(URI).
/// </summary>
/// <value>
/// The algorithm Uniform Resource Identifier(URI).
/// </value>
public Uri Algorithm { get; }
public Uri Algorithm { get; }

/// <summary>
/// Gets or sets the size of the key.
Expand All @@ -56,4 +56,4 @@ public EncryptionMethod(Uri algorithm) {
/// </value>
public Uri MaskGenerationFunction { get; set; }
}
}
}
Loading

0 comments on commit 8385e77

Please sign in to comment.