forked from DuendeSoftware/products
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the use of ClaimsLite and ClaimsRecord into a single type
- Loading branch information
1 parent
68ef1f8
commit d9b5605
Showing
17 changed files
with
192 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# This was generated by tool. Edits will be overwritten. | ||
|
||
name: ignore-this/release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version in format X.Y.Z or X.Y.Z-preview.' | ||
type: string | ||
required: true | ||
default: '0.0.0' | ||
env: | ||
DOTNET_NOLOGO: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
jobs: | ||
tag: | ||
name: Tag and Pack | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ignore-this | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Dotnet | ||
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 | ||
with: | ||
dotnet-version: |- | ||
6.0.x | ||
8.0.x | ||
9.0.x | ||
- name: Git tag | ||
run: |- | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Duende Software GitHub Bot" | ||
git tag -a it-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}" | ||
git push origin it-${{ github.event.inputs.version }} | ||
- name: Pack IgnoreThis | ||
run: dotnet pack -c Release src/IgnoreThis -o artifacts | ||
- name: Tool restore | ||
run: dotnet tool restore | ||
- name: Sign packages | ||
run: |- | ||
for file in artifacts/*.nupkg; do | ||
dotnet NuGetKeyVaultSignTool sign "$file" --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ --azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 --azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 --azure-key-vault-client-secret ${{ secrets.SignClientSecret }} --azure-key-vault-certificate NuGetPackageSigning | ||
done | ||
- name: Push packages to MyGet | ||
if: github.ref == 'refs/heads/main' | ||
run: dotnet nuget push artifacts/*.nupkg --source https://www.myget.org/F/duende_identityserver/api/v2/package --api-key ${{ secrets.MYGET }} --skip-duplicate | ||
- name: Push packages to GitHub | ||
if: github.ref == 'refs/heads/main' | ||
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/DuendeSoftware/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Artifacts | ||
if: github.ref == 'refs/heads/main' | ||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | ||
with: | ||
name: artifacts | ||
path: ignore-this/artifacts/*.nupkg | ||
overwrite: true | ||
retention-days: 15 | ||
publish: | ||
name: Publish to nuget.org | ||
needs: | ||
- tag | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: nuget.org | ||
steps: | ||
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
- name: Setup Dotnet | ||
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 | ||
with: | ||
dotnet-version: |- | ||
6.0.x | ||
8.0.x | ||
9.0.x | ||
- name: List files | ||
run: tree | ||
shell: bash | ||
- name: Push packages to nuget.org | ||
if: github.ref == 'refs/heads/main' | ||
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<!-- This line is needed because: | ||
Aspire needs a single target framework | ||
(until this is resolved: https://github.com/dotnet/aspire/issues/2962) | ||
Strangely enough, <TargetFrameworks>net9.0</TargetFrameworks> in the csproj file is not enough. | ||
But, to use a Directory.Packages.props where we check for $(TargetFramework) == 'net9.0', | ||
we need to set the TargetFramework to 'net9.0' here. | ||
--> | ||
<TargetFramework>net9.0</TargetFramework> | ||
</PropertyGroup> | ||
<Import Project="../../samples.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Duende.Bff; | ||
|
||
/// <summary> | ||
/// Serialization friendly claim. | ||
/// | ||
/// Note, this is a copy of the ClaimRecord class from Duende.Bff, but since we can't create a reference to it, we need to copy it here. | ||
/// We also can't link to it (as we do with the extensions) because we had to make it public. | ||
/// </summary> | ||
internal class ClaimRecord() | ||
{ | ||
/// <summary> | ||
/// Serialization friendly claim | ||
/// </summary> | ||
/// <param name="type">The type</param> | ||
/// <param name="value">The Value</param> | ||
internal ClaimRecord(string type, object value) : this() | ||
{ | ||
Type = type; | ||
Value = value; | ||
} | ||
|
||
/// <summary> | ||
/// The type | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
public string Type { get; init; } = default!; | ||
|
||
/// <summary> | ||
/// The value | ||
/// </summary> | ||
[JsonPropertyName("value")] | ||
public object Value { get; init; } = default!; | ||
|
||
/// <summary> | ||
/// The value type | ||
/// </summary> | ||
[JsonPropertyName("valueType")] | ||
public string? ValueType { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 18 additions & 2 deletions
20
bff/src/Duende.Bff/Shared/ClaimLite.cs → bff/src/Duende.Bff/Shared/ClaimRecord.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
// Copyright (c) Duende Software. All rights reserved. | ||
// See LICENSE in the project root for license information. | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
namespace Duende.Bff; | ||
|
||
/// <summary> | ||
/// Serialization friendly claim | ||
/// </summary> | ||
internal class ClaimLite | ||
public class ClaimRecord() | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="type"></param> | ||
/// <param name="value"></param> | ||
public ClaimRecord(string type, object value) : this() | ||
{ | ||
Type = type; | ||
Value = value; | ||
} | ||
|
||
/// <summary> | ||
/// The type | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
public string Type { get; init; } = default!; | ||
|
||
/// <summary> | ||
/// The value | ||
/// </summary> | ||
public string Value { get; init; } = default!; | ||
[JsonPropertyName("value")] | ||
public object Value { get; init; } = default!; | ||
|
||
/// <summary> | ||
/// The value type | ||
/// </summary> | ||
[JsonPropertyName("valueType")] | ||
public string? ValueType { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.