From 53b1aea7eb453cfffaa09de3bbc310480bf78758 Mon Sep 17 00:00:00 2001 From: prajon84 Date: Thu, 15 Apr 2021 13:36:08 -0400 Subject: [PATCH 1/7] Added mauth-protocol-test-suite as submodule to mauth-client-dotnet --- .gitattributes | 3 ++ .gitmodules | 3 ++ CONTRIBUTING.md | 31 +++++++++------ mauth-protocol-test-suite | 1 + .../ProtocolTestSuiteHelper.cs | 38 +++++-------------- 5 files changed, 36 insertions(+), 40 deletions(-) create mode 100644 .gitmodules create mode 160000 mauth-protocol-test-suite diff --git a/.gitattributes b/.gitattributes index 1ff0c42..779ed15 100644 --- a/.gitattributes +++ b/.gitattributes @@ -61,3 +61,6 @@ #*.PDF diff=astextplain #*.rtf diff=astextplain #*.RTF diff=astextplain + +# Declare Unix specific filtetypes +* text eol=lf diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ff92868 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "mauth-protocol-test-suite"] + path = mauth-protocol-test-suite + url = git@github.com:mdsol/mauth-protocol-test-suite.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1218bdd..11c1477 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,24 @@ # Contributing +## Cloning the Repo + +This repo contains the submodule `mauth-protocol-test-suite` so requires a flag when initially cloning in order to clone and init submodules. + +``` +git clone --recurse-submodules git@github.com:mdsol/mauth-client-ruby.git +``` + +If you have already cloned a version of this repo before the submodule was introduced then run + +``` +cd mauth-protocol-test-suite +git submodule update --init +``` + +to init the submodule. + ## General Information -* Clone this repo in your workspace. Checkout latest `develop` branch. +* Checkout latest `develop` branch. * Make new changes or updates into `feature/bugfix` branch. * Make sure to add unit tests for it so that there is no breaking changes. * Commit and push your branch to compare and create PR against latest `develop` branch. @@ -11,15 +28,5 @@ To run tests, go the folder `mauth-client-dotnet\tests\Medidata.MAuth.Tests` Next, run the tests as: ``` -dotnet test --filter "Category!=ProtocolTestSuite" -``` - -## Running mauth-protocol-test-suite -To run the mauth-protocol-test-suite clone the latest suite onto your machine and place it in the same parent directory as this repo (or supply the ENV var -`TEST_SUITE_PATH` with the path to the test suite relative to this repo). -Then navigate to :`mauth-client-dotnet\tests\Medidata.MAuth.Tests` -And, run the tests as: - -``` -dotnet test --filter "Category=ProtocolTestSuite" +dotnet test ``` diff --git a/mauth-protocol-test-suite b/mauth-protocol-test-suite new file mode 160000 index 0000000..303bf5e --- /dev/null +++ b/mauth-protocol-test-suite @@ -0,0 +1 @@ +Subproject commit 303bf5e877d1fd5099dc0ed7fef2c1f8582f36e3 diff --git a/tests/Medidata.MAuth.Tests/ProtocolTestSuite/ProtocolTestSuiteHelper.cs b/tests/Medidata.MAuth.Tests/ProtocolTestSuite/ProtocolTestSuiteHelper.cs index 806f7a4..b18873c 100644 --- a/tests/Medidata.MAuth.Tests/ProtocolTestSuite/ProtocolTestSuiteHelper.cs +++ b/tests/Medidata.MAuth.Tests/ProtocolTestSuite/ProtocolTestSuiteHelper.cs @@ -10,21 +10,20 @@ namespace Medidata.MAuth.Tests.ProtocolTestSuite { public class ProtocolTestSuiteHelper { - private string _testSuitePath; private string _testCasePath; + private string _testSuiteModulePath; public ProtocolTestSuiteHelper() { var currentDirectory = Environment.CurrentDirectory; - _testSuitePath = Environment.GetEnvironmentVariable("TEST_SUITE_PATH") != null - ? Environment.GetEnvironmentVariable("TEST_SUITE_PATH") - : Path.GetFullPath(Path.Combine(currentDirectory, "../../../../../../mauth-protocol-test-suite")); - _testCasePath = Path.Combine(_testSuitePath, "protocols/MWSV2"); + _testSuiteModulePath = Path.GetFullPath( + Path.Combine(currentDirectory, "../../../../../mauth-protocol-test-suite")); + _testCasePath = Path.Combine(_testSuiteModulePath, "protocols/MWSV2"); } public async Task LoadSigningConfig() { - var configFile = Path.Combine(_testSuitePath, "signing-config.json"); + var configFile = Path.Combine(_testSuiteModulePath, "signing-config.json"); var signingConfig = await ReadSigningConfigParameters(configFile); if (signingConfig is null )return null; @@ -41,23 +40,14 @@ public async Task ReadSignInAppUuid() public async Task GetPrivateKey() { - var filePath = Path.Combine(_testSuitePath, "signing-params/rsa-key"); + var filePath = Path.Combine(_testSuiteModulePath, "signing-params/rsa-key"); return Encoding.UTF8.GetString(await ReadAsBytes(filePath)); } public async Task GetPublicKey() { - var publicKeyFilePath = Path.Combine(_testSuitePath, "signing-params/rsa-key-pub"); - - // TODO: remove this try catch when "mauth-protocol-test-suite" is added as submodule - try - { - return Encoding.UTF8.GetString(await ReadAsBytes(publicKeyFilePath)); - } - catch (DirectoryNotFoundException) - { - return null; - } + var publicKeyFilePath = Path.Combine(_testSuiteModulePath, "signing-params/rsa-key-pub"); + return Encoding.UTF8.GetString(await ReadAsBytes(publicKeyFilePath)); } public async Task LoadUnsignedRequest(string testCaseName) @@ -114,16 +104,8 @@ private async Task ReadUnsignedRequest(string requestPath) => private async Task ReadSigningConfigParameters(string signingConfigJson) { - // TODO: remove this try catch when "mauth-protocol-test-suite" is added as submodule - try - { - var signingConfigBytes = await ReadAsBytes(signingConfigJson); - return JsonConvert.DeserializeObject(Encoding.UTF8.GetString(signingConfigBytes)); - } - catch (DirectoryNotFoundException) - { - return null; - } + var signingConfigBytes = await ReadAsBytes(signingConfigJson); + return JsonConvert.DeserializeObject(Encoding.UTF8.GetString(signingConfigBytes)); } private async Task ReadAsBytes(string filePath) From 934571cbdfa0bdb6c4ccd719719034cc4b180927 Mon Sep 17 00:00:00 2001 From: prajon84 Date: Thu, 15 Apr 2021 14:26:27 -0400 Subject: [PATCH 2/7] Removed deleted file from solution and update "dotnet test" in appveyor build --- Medidata.MAuth.sln | 8 +++++--- build/build.ps1 | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Medidata.MAuth.sln b/Medidata.MAuth.sln index 34ba43e..35bc1fd 100644 --- a/Medidata.MAuth.sln +++ b/Medidata.MAuth.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2A4336AA-6F7D-414B-AB2B-81A8F2E82A48}" EndProject @@ -27,7 +27,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{F8B8C2CD-CBAE-42A5-A5FF-2A26E5275941}" ProjectSection(SolutionItems) = preProject build\build.ps1 = build\build.ps1 - build\common.props = build\common.props EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Medidata.MAuth.AspNetCore", "src\Medidata.MAuth.AspNetCore\Medidata.MAuth.AspNetCore.csproj", "{1BC50789-3BAE-4D87-B89C-C2658BFF6522}" @@ -69,4 +68,7 @@ Global {E557F648-6FE1-432E-A8D7-BD00C18E5176} = {2A4336AA-6F7D-414B-AB2B-81A8F2E82A48} {1BC50789-3BAE-4D87-B89C-C2658BFF6522} = {2A4336AA-6F7D-414B-AB2B-81A8F2E82A48} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0A4D3258-5262-45FC-8A21-832CCBBB5878} + EndGlobalSection EndGlobal diff --git a/build/build.ps1 b/build/build.ps1 index af8c986..91ddcb0 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -67,7 +67,7 @@ Write-Host "Running unit tests..." -ForegroundColor Cyan Push-Location -Path .\tests\Medidata.MAuth.Tests -dotnet test --filter "Category!=ProtocolTestSuite" +dotnet test Pop-Location From 97d82dad612f484194e702bff9da47ff1b6252de Mon Sep 17 00:00:00 2001 From: prajon84 Date: Thu, 15 Apr 2021 15:04:17 -0400 Subject: [PATCH 3/7] Update git submodule in appveyor build and fix the repo url in contributing doc --- CONTRIBUTING.md | 2 +- appveyor.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 11c1477..04d4dc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ This repo contains the submodule `mauth-protocol-test-suite` so requires a flag when initially cloning in order to clone and init submodules. ``` -git clone --recurse-submodules git@github.com:mdsol/mauth-client-ruby.git +git clone --recurse-submodules git@github.com:mdsol/mauth-client-dotnet.git ``` If you have already cloned a version of this repo before the submodule was introduced then run diff --git a/appveyor.yml b/appveyor.yml index f976504..97daf52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,8 @@ pull_requests: image: Visual Studio 2019 init: - git config --global core.autocrlf true +install: + - git submodule update --init --recursive nuget: disable_publish_on_pr: true build_script: @@ -24,4 +26,4 @@ deploy: api_key: secure: npZx6kvkDjB9a+wz5PILhIAGZ3gnxOyBnsc05GPOywfpP9d3R72oetjaH2eInrko on: - appveyor_repo_tag: true \ No newline at end of file + appveyor_repo_tag: true From b2bbacd8a207a372f2021778a2a44b6bb48ff2f7 Mon Sep 17 00:00:00 2001 From: prajon84 Date: Thu, 15 Apr 2021 15:08:51 -0400 Subject: [PATCH 4/7] Update url in .gitmodule to https --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ff92868..a09c9a9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "mauth-protocol-test-suite"] path = mauth-protocol-test-suite - url = git@github.com:mdsol/mauth-protocol-test-suite.git + url = https://github.com/mdsol/mauth-protocol-test-suite.git From bed4fa5409cf340706caf54398d7cadf2e6b56e7 Mon Sep 17 00:00:00 2001 From: Laszlo Schreck Date: Tue, 20 Apr 2021 18:51:59 +0900 Subject: [PATCH 5/7] [MCC-760494] Remove obsolete build scripts (#74) --- .github/workflows/build.yaml | 11 ++++++ README.md | 7 ---- appveyor.yml | 29 -------------- build/build.ps1 | 74 ------------------------------------ 4 files changed, 11 insertions(+), 110 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 appveyor.yml delete mode 100644 build/build.ps1 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..30d640a --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,11 @@ +name: Build and Test +on: [push] +jobs: + Test: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - run: dotnet test $GITHUB_WORKSPACE/Medidata.MAuth.sln --framework net5.0 diff --git a/README.md b/README.md index 9a99de8..237c753 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,6 @@ Medidata.MAuth is a framework that provides support for authenticating web services and applications with the Medidata HMAC protocol, MAuth. -## Build Status - -| Build | Status | -| --- | --- | -| AppVeyor Release | ![Release](https://ci.appveyor.com/api/projects/status/94450nsec4kwhjpo?branch=master&svg=true) | -| AppVeyor Prerelease | ![Prerelease](https://ci.appveyor.com/api/projects/status/94450nsec4kwhjpo?branch=develop&svg=true) | - ## What is MAuth? The MAuth protocol provides a fault-tolerant, service-to-service authentication scheme for Medidata and third-party diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 97daf52..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '{build}' -pull_requests: - do_not_increment_build_number: true -image: Visual Studio 2019 -init: - - git config --global core.autocrlf true -install: - - git submodule update --init --recursive -nuget: - disable_publish_on_pr: true -build_script: - - ps: .\build\build.ps1 -test: off -artifacts: - - path: .\artifacts\**\*.nupkg - name: NuGet -deploy: - - provider: NuGet - server: https://imedidata.myget.org/F/mdsol/api/v2/package - api_key: - secure: HFSUvUlS7H458RvBZx2O3vFa1Gk0woBfJhBXaw+ySFVbN18EX8iLVPlzSHrbgPjT - on: - branch: develop - - provider: NuGet - name: production - api_key: - secure: npZx6kvkDjB9a+wz5PILhIAGZ3gnxOyBnsc05GPOywfpP9d3R72oetjaH2eInrko - on: - appveyor_repo_tag: true diff --git a/build/build.ps1 b/build/build.ps1 deleted file mode 100644 index 91ddcb0..0000000 --- a/build/build.ps1 +++ /dev/null @@ -1,74 +0,0 @@ -$ErrorActionPreference = "Stop" - -Write-Host "Starting the build script..." -ForegroundColor Cyan -Write-Host "Cleaning up the Artifacts folder..." -ForegroundColor Cyan - -$solutionDir = $env:APPVEYOR_BUILD_FOLDER - -if (!$solutionDir) { $solutionDir = $pwd } - -$artifactsDir = "$solutionDir\artifacts" - -if (Test-Path $artifactsDir) { Remove-Item $artifactsDir -Force -Recurse } - -Write-Host "Restoring NuGet packages..." -ForegroundColor Cyan - -MSBuild /t:restore /verbosity:minimal - -Write-Host "Setting the current version number based on the " -NoNewline - -$propsFile = Get-Item "version.props" -$props = [xml](Get-Content $propsFile) -$propsVersion = $props.SelectSingleNode("//PropertyGroup/Version").InnerText - -if ($propsVersion.Contains("-")) { $propsVersion = $propsVersion.Substring(0, $propsVersion.IndexOf('-')) } - -if ($env:APPVEYOR_REPO_TAG -eq 'true') { - $version = $env:APPVEYOR_REPO_TAG_NAME.Replace("release/v", "").Replace("release", "") - Write-Host "$env:APPVEYOR_REPO_TAG_NAME" -ForegroundColor Cyan -NoNewline -} else { - $buildNo = $env:APPVEYOR_BUILD_NUMBER - $version = "$propsVersion-preview$buildNo" - - Write-Host "version.props file" -NoNewline - - if ($buildNo) { - Write-Host " and the build number " -NoNewline - Write-Host "$buildNo" -ForegroundColor Cyan -NoNewline - } -} - -Write-Host " to " -NoNewline -Write-Host "$version" -ForegroundColor Green -NoNewline -Write-Host "..." - -$props.SelectSingleNode("//PropertyGroup/Version").InnerText = $version - -$props.Save($propsFile) - -Write-Host "Building, packing and preparing the artifacts..." -ForegroundColor Cyan - -MSBuild "/t:Build" /verbosity:minimal "/p:PackageOutputPath=$artifactsDir" - -Get-ChildItem "$artifactsDir\*.symbols.nupkg" | ForEach-Object { - $newName = $_.Name -Replace "\.symbols\.nupkg", ".nupkg" - - Write-Host "Renaming " -NoNewLine - Write-Host "$($_.Name)" -ForegroundColor Green -NoNewline - Write-Host " to " -NoNewLine - Write-Host "$newName" -ForegroundColor Green -NoNewline - Write-Host "..." - - $destination = Join-Path -Path $_.Directory.FullName -ChildPath $newName - Move-Item -Path $_.FullName -Destination $destination -Force -} - -Write-Host "Running unit tests..." -ForegroundColor Cyan - -Push-Location -Path .\tests\Medidata.MAuth.Tests - -dotnet test - -Pop-Location - -Write-Host "Build script completed." -ForegroundColor Cyan From a9850046621275beec883848da4f67773428fb94 Mon Sep 17 00:00:00 2001 From: Altin Vardhami Date: Wed, 12 May 2021 10:04:00 -0400 Subject: [PATCH 6/7] remove only System.Net.Http --- src/Medidata.MAuth.Core/Medidata.MAuth.Core.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Medidata.MAuth.Core/Medidata.MAuth.Core.csproj b/src/Medidata.MAuth.Core/Medidata.MAuth.Core.csproj index 9b16671..15e62e7 100644 --- a/src/Medidata.MAuth.Core/Medidata.MAuth.Core.csproj +++ b/src/Medidata.MAuth.Core/Medidata.MAuth.Core.csproj @@ -21,7 +21,6 @@ - From 8c3c5554d26108350970a62fd341f27fe4411bb7 Mon Sep 17 00:00:00 2001 From: Laszlo Schreck Date: Fri, 14 May 2021 16:56:19 +0900 Subject: [PATCH 7/7] [MCC-771288] Add Workflow for Publishing the Packages (#78) --- .github/workflows/publish.yaml | 22 +++++++++++++++++++++ .github/workflows/{build.yaml => test.yaml} | 3 ++- CHANGELOG.md | 3 +++ version.props | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yaml rename .github/workflows/{build.yaml => test.yaml} (70%) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..659bc93 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,22 @@ +name: Build, Test and Publish +on: + push: + tags: + - 'release/*' +jobs: + Publish: + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Build the packages + run: dotnet build --configuration Release /p:PackageOutputPath=$GITHUB_WORKSPACE/artifacts + - name: Run the tests + run: dotnet test $GITHUB_WORKSPACE/Medidata.MAuth.sln --framework net5.0 --no-build + - name: Publish the packages + run: dotnet nuget push "$GITHUB_WORKSPACE/artifacts/*.nupkg" --source $ARTIFACTORY_PUSH_TARGET --api-key $API_KEY + env: + API_KEY: ${{ format('{0}:{1}', secrets.ARTIFACTORY_USERNAME, secrets.ARTIFACTORY_PASSWORD) }} + ARTIFACTORY_PUSH_TARGET: https://mdsol.jfrog.io/artifactory/api/nuget/nuget-local/mauth-client-dotnet diff --git a/.github/workflows/build.yaml b/.github/workflows/test.yaml similarity index 70% rename from .github/workflows/build.yaml rename to .github/workflows/test.yaml index 30d640a..bf21282 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/test.yaml @@ -8,4 +8,5 @@ jobs: uses: actions/checkout@v2 with: submodules: 'recursive' - - run: dotnet test $GITHUB_WORKSPACE/Medidata.MAuth.sln --framework net5.0 + - name: Run the tests + run: dotnet test $GITHUB_WORKSPACE/Medidata.MAuth.sln --framework net5.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa7660..2e29f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changes in Medidata.MAuth +## v5.1.2 +- **[Core]** Removed unnecessary dependency on `System.Net.Http` package. + ## v5.1.1 - **[Core]** Fixed an issue with internal caching for the utility extension `Authenticate()` method. diff --git a/version.props b/version.props index 775f264..9d1f5d2 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,6 @@  - 5.1.1 + 5.1.2