Skip to content

Commit

Permalink
Merge pull request #1 from dina-heidar/fix/metadataRegex
Browse files Browse the repository at this point in the history
workflows and regex fix
  • Loading branch information
dina-heidar authored Apr 15, 2023
2 parents 4bc172b + d8cdfd5 commit 09ce1c1
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 112 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@ on:

jobs:
build:

runs-on: ubuntu-latest
env:
BUILD_CONFIG: Release

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET 6
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.101
dotnet-version: |
6.0.x
7.0.x
- name: Install Dependencies
run: dotnet restore

- name: Build Solution
run: dotnet build --configuration Release --no-restore
- name: Build
run: dotnet build -c $BUILD_CONFIG --no-restore
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,38 +17,35 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup dotnet 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

- name: Setup dotnet 6.0
uses: actions/setup-dotnet@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Install Dependencies
run: dotnet restore
dotnet-version: |
6.0.x
7.0.x
- name: Clean
run: dotnet clean ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG
run: dotnet clean -c $BUILD_CONFIG && dotnet nuget locals all --clear

- name: Install Dependencies
run: dotnet restore

- name: Build
run: dotnet build ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG

- name: Pack
- name: Pack
run: dotnet pack ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG --no-build --include-source --include-symbols -o ./artifacts

- name: Setup nuget
uses: NuGet/setup-nuget@v1.0.5
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest

- name: Push to MyGitHub
- name: Push to GPR
env:
GITHUB_NUGET_URL: https://nuget.pkg.github.com/dina-heidar/index.json
GITHUB_NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
name: Releaser
name: Release

on:
push:
tags:
- '*.*.*'

jobs:
build:
env:
BUILD_CONFIG: Release

name: Build
runs-on: ubuntu-latest
env:
BUILD_CONFIG: Release

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup dotnet 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

- name: Setup dotnet 6.0
uses: actions/setup-dotnet@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Install Dependencies
run: dotnet restore
dotnet-version: |
6.0.x
7.0.x
- name: Clean
run: dotnet clean ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG
run: dotnet clean -c $BUILD_CONFIG && dotnet nuget locals all --clear

- name: Install Dependencies
run: dotnet restore

- name: Build
run: dotnet clean ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG
run: dotnet build ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG

- name: Pack
run: dotnet pack ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG --no-build --include-source --include-symbols -o ./artifacts

- name: Setup nuget
uses: NuGet/setup-nuget@v1.0.5
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest

- name: Push to GPR
env:
GITHUB_NUGET_URL: https://nuget.pkg.github.com/dina-heidar/index.json
GITHUB_NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: dotnet nuget push ./artifacts/saml2.authentication.*.nupkg -k $GITHUB_NUGET_API_KEY -s $GITHUB_NUGET_URL --skip-duplicate

- name: Push to NuGet
env:
NUGET_URL: https://api.nuget.org/v3/index.json
Expand Down
9 changes: 0 additions & 9 deletions Directory.Build.targets

This file was deleted.

Empty file removed LICENSE
Empty file.
11 changes: 0 additions & 11 deletions saml2-authentication.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Redirect.ArtifactBindin
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Redirect.PostBinding", "samples\Mvc.Redirect.PostBinding\Mvc.Redirect.PostBinding.csproj", "{DBE548FB-790E-4A86-B465-1A504C0BBB5B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{DD6EC0E8-06B8-4A4E-BD2A-B75B1D196902}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{4E9F2C11-8DEE-40CF-BCBB-1467C210245B}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -84,8 +75,6 @@ Global
{CAEBEFCA-F082-4390-A995-713E0A9BBB73} = {538031E3-2808-459B-9B84-BE9B211BB53F}
{122B87E1-22AE-4E55-8E4C-48FE4DCFC6ED} = {538031E3-2808-459B-9B84-BE9B211BB53F}
{DBE548FB-790E-4A86-B465-1A504C0BBB5B} = {538031E3-2808-459B-9B84-BE9B211BB53F}
{DD6EC0E8-06B8-4A4E-BD2A-B75B1D196902} = {AABC16B6-3346-472A-A227-E7099BA0A2DE}
{4E9F2C11-8DEE-40CF-BCBB-1467C210245B} = {DD6EC0E8-06B8-4A4E-BD2A-B75B1D196902}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4913BF26-EB95-4163-B1A2-BE7450EFC50E}
Expand Down
4 changes: 2 additions & 2 deletions src/saml2.authentication/Saml2PostConfigureOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ public void PostConfigure(string name, Saml2Options options)
}
else if (!string.IsNullOrEmpty(options.MetadataAddress))
{
var pattern = @"(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$";
var pattern = @"^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$";
var result = Regex.IsMatch(options.MetadataAddress,
pattern, RegexOptions.IgnoreCase);

if (result)
{
var httpsPattern = @"^(https:\/\/www\.|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$";
var httpsPattern = @"^(https:\/\/www\.|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$";
var isHttpsRegexMatch = Regex.IsMatch(options.MetadataAddress, httpsPattern, RegexOptions.IgnoreCase);

if (options.RequireHttpsMetadata && !isHttpsRegexMatch)
Expand Down
4 changes: 2 additions & 2 deletions src/saml2.authentication/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ __________________________________________________________
Saml2.Authentication NuGet Package
___________________________________________________________

Welcome and thank you for installing Saml2.Authentication (previously Saml2.Authentication) NuGet Package!
Welcome and thank you for installing Saml2.Authentication NuGet Package!

MIT License

Copyright (c) 2019 Dina Heidar
Copyright (c) 2023 Dina Heidar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
73 changes: 27 additions & 46 deletions src/saml2.authentication/saml2.authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
<PackageTags>authentication;dotnet;security;saml2;.NETCore;SSO;SLO;.NET;identity;aspnetcore</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>6.0.6</Version>
<Version>6.0.7</Version>
<AssemblyVersion>6.0.7.0</AssemblyVersion>
<FileVersion>6.0.7.0</FileVersion>
<InformationalVersion>This is a release package</InformationalVersion>
<Authors>Dina Heidar</Authors>
<Company></Company>
<Product>Saml2.Authentication</Product>
<PackageReadmeFile>README.md</PackageReadmeFile>
<AssemblyVersion>6.0.6.0</AssemblyVersion>
<FileVersion>6.0.6.0</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<!--<PackageLicenseFile>LICENSE</PackageLicenseFile>-->
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/dina-heidar/saml2-authentication</PackageProjectUrl>
<RepositoryUrl>https://github.com/dina-heidar/saml2-authentication</RepositoryUrl>
<NeutralLanguage>en</NeutralLanguage>
<PackageReleaseNotes>initial release</PackageReleaseNotes>
<PackageReleaseNotes>metadata regex if not a url</PackageReleaseNotes>
<RepositoryType>Git</RepositoryType>
<Title>Saml2.Authentication</Title>
<Copyright>Copyright Dina Heidar</Copyright>
<!--<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>-->


<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

Expand All @@ -38,13 +39,13 @@

<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<Deterministic>true</Deterministic>
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<!--<DebugType>embedded</DebugType>-->

</PropertyGroup>

<ItemGroup>
<!--<None Include="..\..\LICENSE" Pack="true" Visible="false" PackagePath="" />-->
<None Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
Expand All @@ -57,12 +58,24 @@
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" />
</ItemGroup>

<!--source link-->
<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<!--test locally-->
<!--<PropertyGroup>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>-->


<!--test on server-->
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<!--There is a well known issue with the EmbedUntrackedSources
attribute that could be fix with the below workaround needed for many
Expand All @@ -74,37 +87,5 @@
<!-- https://github.com/dotnet/sourcelink/issues/572 -->
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
</ItemGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>


<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<!--source link-->
<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>


<!--<ItemGroup>
<ProjectReference Include="..\..\..\saml2-metadata\src\saml2.metadata\saml2-metadata.csproj">
<PrivateAssets>all</PrivateAssets>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>saml2.metadata.dll</IncludeAssets>
</ProjectReference>
</ItemGroup>-->

<!--<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>-->


</Project>

0 comments on commit 09ce1c1

Please sign in to comment.