Skip to content

Commit

Permalink
Merge pull request #8 from dina-heidar/dev
Browse files Browse the repository at this point in the history
Fixed metadata generate for artifact binding
  • Loading branch information
dina-heidar authored Jul 2, 2023
2 parents bfc1084 + f1dca7e commit 5929904
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 49 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
with:
dotnet-version: |
6.0.x
7.0.x
7.0.x
- name: Clean
run: dotnet clean -c $BUILD_CONFIG && dotnet nuget locals all --clear

- name: Install Dependencies
run: dotnet restore
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
7.0.x
- name: Clean
run: dotnet clean -c $BUILD_CONFIG && dotnet nuget locals all --clear
run: dotnet clean ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG && dotnet nuget locals all --clear

- name: Install Dependencies
run: dotnet restore
Expand All @@ -40,15 +40,15 @@ jobs:
- 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
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: Setup nuget
# 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


16 changes: 14 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,28 @@ jobs:
7.0.x
- name: Clean
run: dotnet clean -c $BUILD_CONFIG && dotnet nuget locals all --clear
run: dotnet clean ./src/saml2.authentication/saml2.authentication.csproj -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

# Store the version, stripping any v-prefix
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Use version in other step
- name: Read version
run: |
echo Version now: ${VERSION}
- name: Pack
run: dotnet pack ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG --no-build --include-source --include-symbols -o ./artifacts
run: dotnet pack ./src/saml2.authentication/saml2.authentication.csproj -c $BUILD_CONFIG --no-build --include-source --include-symbols -p:Version=$VERSION -o ./artifacts

- name: Setup nuget
uses: NuGet/setup-nuget@v1
Expand Down
2 changes: 2 additions & 0 deletions samples/Mvc.Redirect.ArtifactBinding/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public static void Main(string[] args)
options.ValidateArtifact = true;
options.CallbackPath = new PathString("/saml2-artifact");
options.CreateMetadataFile = true;
if (environment.IsDevelopment())
{
options.SigningCertificate = new X509Certificate2("../SharedCertificates/dev.govalerts.la.gov.pfx",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/saml2.authentication/Extensions/MetadataExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ private static IndexedEndpoint GetAssertionConsumerService(Saml2ResponseProtocol
{
return AssertionConsumerServiceExtensions.Post.Url(url, 0, true);
}
//if artifact
else if (responseProtocolBinding == Saml2ResponseProtocolBinding.Artifact)
{
return AssertionConsumerServiceExtensions.Artifact.Url(url, 0, true);
}
//if redirect
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/saml2.authentication/Logging/LoggingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ internal static partial class Log
//[LoggerMessage(17, LogLevel.Error, "Exception occurred while processing message.", EventName = "ExceptionProcessingMessage")]
//public static partial void ExceptionProcessingMessage(this ILogger logger, Exception ex);

[LoggerMessage(20, LogLevel.Debug, "Retrieving claims assertion.")]
[LoggerMessage(20, LogLevel.Debug, "Retrieving claims Saml assertion.")]
public static partial void RetrievingClaims(this ILogger logger);

//[LoggerMessage(23, LogLevel.Warning, "Failed to un-protect the nonce cookie.", EventName = "UnableToProtectNonceCookie")]
Expand Down
Loading

0 comments on commit 5929904

Please sign in to comment.