-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade Zitadel Libs and remove old .net version (#933)
BREAKING CHANGE: change Zitadel default client mapping to V2 instead of V2Beta. Older APIs are still generated but the default helpers will create V2 clients. BREAKING CHANGE: remove .Net 6 and 7 since they are end of support.
- Loading branch information
Showing
25 changed files
with
688 additions
and
725 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 |
---|---|---|
|
@@ -13,8 +13,6 @@ jobs: | |
fail-fast: true | ||
matrix: | ||
version: | ||
- 6.x | ||
- 7.x | ||
- 8.x | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
@page | ||
@model LoggedOutModel | ||
@model Zitadel.AspNet.AuthN.Pages.LoggedOutModel | ||
|
||
<html lang="en"> | ||
<head> | ||
|
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,7 +1,5 @@ | ||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace Zitadel.AspNet.AuthN.Pages; | ||
|
||
public class LoggedOutModel : PageModel { } | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace Zitadel.AspNet.AuthN.Pages; | ||
|
||
public class LoggedOutModel : PageModel; |
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
182 changes: 91 additions & 91 deletions
182
src/Zitadel/Authentication/Events/Context/LocalFakeZitadelAuthContext.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,91 +1,91 @@ | ||
using System.Security.Claims; | ||
|
||
namespace Zitadel.Authentication.Events.Context | ||
{ | ||
public class LocalFakeZitadelAuthContext | ||
{ | ||
/// <summary> | ||
/// Constructor. | ||
/// </summary> | ||
/// <param name="identity">The created ClaimsIdentity.</param> | ||
public LocalFakeZitadelAuthContext(ClaimsIdentity identity) | ||
{ | ||
Identity = identity; | ||
} | ||
|
||
/// <summary> | ||
/// The created ClaimsIdentity. | ||
/// </summary> | ||
public ClaimsIdentity Identity { get; init; } | ||
|
||
/// <summary> | ||
/// The claims of the created ClaimsIdentity. | ||
/// </summary> | ||
public IEnumerable<Claim> Claims => Identity.Claims; | ||
|
||
/// <summary> | ||
/// The "user-id" of the fake user. | ||
/// Either set by the options or via HTTP header. | ||
/// </summary> | ||
public string FakeZitadelId => new ClaimsPrincipal(Identity).FindFirstValue("sub")!; | ||
|
||
/// <summary> | ||
/// Add a claim to the <see cref="Claims"/> list. | ||
/// This is a convenience method for modifying <see cref="Claims"/>. | ||
/// </summary> | ||
/// <param name="type">Type of the claim (examples: <see cref="ClaimTypes"/>).</param> | ||
/// <param name="value">The value.</param> | ||
/// <param name="valueType">Type of the value (examples: <see cref="ClaimValueTypes"/>).</param> | ||
/// <param name="issuer">The issuer for this claim.</param> | ||
/// <param name="originalIssuer">The original issuer of this claim.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddClaim( | ||
string type, | ||
string value, | ||
string? valueType = null, | ||
string? issuer = null, | ||
string? originalIssuer = null) => AddClaim(new(type, value, valueType, issuer, originalIssuer)); | ||
|
||
/// <summary> | ||
/// Add a claim to the <see cref="Claims"/> list. | ||
/// This is a convenience method for modifying <see cref="Claims"/>. | ||
/// </summary> | ||
/// <param name="claim">The claim to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddClaim(Claim claim) | ||
{ | ||
Identity.AddClaim(claim); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Add a single role to the identity's claims. | ||
/// Note: the roles are actually "claims" but this method exists | ||
/// for convenience. | ||
/// </summary> | ||
/// <param name="role">The role to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddRole(string role) | ||
{ | ||
Identity.AddClaim(new(ClaimTypes.Role, role)); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Add multiple roles to the identity's claims. | ||
/// Note: the roles are actually "claims" but this method exists | ||
/// for convenience. | ||
/// </summary> | ||
/// <param name="roles">The roles to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddRoles(string[] roles) | ||
{ | ||
foreach (var role in roles) | ||
{ | ||
AddRole(role); | ||
} | ||
|
||
return this; | ||
} | ||
} | ||
} | ||
using System.Security.Claims; | ||
|
||
namespace Zitadel.Authentication.Events.Context | ||
{ | ||
public class LocalFakeZitadelAuthContext | ||
{ | ||
/// <summary> | ||
/// Constructor. | ||
/// </summary> | ||
/// <param name="identity">The created ClaimsIdentity.</param> | ||
public LocalFakeZitadelAuthContext(ClaimsIdentity identity) | ||
{ | ||
Identity = identity; | ||
} | ||
|
||
/// <summary> | ||
/// The created ClaimsIdentity. | ||
/// </summary> | ||
public ClaimsIdentity Identity { get; init; } | ||
|
||
/// <summary> | ||
/// The claims of the created ClaimsIdentity. | ||
/// </summary> | ||
public IEnumerable<Claim> Claims => Identity.Claims; | ||
|
||
/// <summary> | ||
/// The "user-id" of the fake user. | ||
/// Either set by the options or via HTTP header. | ||
/// </summary> | ||
public string FakeZitadelId => new ClaimsPrincipal(Identity).FindFirstValue("sub")!; | ||
|
||
/// <summary> | ||
/// Add a claim to the <see cref="Claims"/> list. | ||
/// This is a convenience method for modifying <see cref="Claims"/>. | ||
/// </summary> | ||
/// <param name="type">Type of the claim (examples: <see cref="ClaimTypes"/>).</param> | ||
/// <param name="value">The value.</param> | ||
/// <param name="valueType">Type of the value (examples: <see cref="ClaimValueTypes"/>).</param> | ||
/// <param name="issuer">The issuer for this claim.</param> | ||
/// <param name="originalIssuer">The original issuer of this claim.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddClaim( | ||
string type, | ||
string value, | ||
string? valueType = null, | ||
string? issuer = null, | ||
string? originalIssuer = null) => AddClaim(new(type, value, valueType, issuer, originalIssuer)); | ||
|
||
/// <summary> | ||
/// Add a claim to the <see cref="Claims"/> list. | ||
/// This is a convenience method for modifying <see cref="Claims"/>. | ||
/// </summary> | ||
/// <param name="claim">The claim to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddClaim(Claim claim) | ||
{ | ||
Identity.AddClaim(claim); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Add a single role to the identity's claims. | ||
/// Note: the roles are actually "claims" but this method exists | ||
/// for convenience. | ||
/// </summary> | ||
/// <param name="role">The role to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddRole(string role) | ||
{ | ||
Identity.AddClaim(new(ClaimTypes.Role, role)); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Add multiple roles to the identity's claims. | ||
/// Note: the roles are actually "claims" but this method exists | ||
/// for convenience. | ||
/// </summary> | ||
/// <param name="roles">The roles to add.</param> | ||
/// <returns>The <see cref="LocalFakeZitadelAuthContext"/> for chaining.</returns> | ||
public LocalFakeZitadelAuthContext AddRoles(string[] roles) | ||
{ | ||
foreach (var role in roles) | ||
{ | ||
AddRole(role); | ||
} | ||
|
||
return this; | ||
} | ||
} | ||
} |
24 changes: 12 additions & 12 deletions
24
src/Zitadel/Authentication/Events/LocalFakeZitadelEvents.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,12 +1,12 @@ | ||
using Zitadel.Authentication.Events.Context; | ||
using Zitadel.Authentication.Handler; | ||
|
||
namespace Zitadel.Authentication.Events; | ||
|
||
public class LocalFakeZitadelEvents | ||
{ | ||
/// <summary> | ||
/// Invoked after a ClaimsIdentity has been generated in the <see cref="LocalFakeZitadelHandler"/>. | ||
/// </summary> | ||
public Func<LocalFakeZitadelAuthContext, Task> OnZitadelFakeAuth { get; set; } = context => Task.CompletedTask; | ||
} | ||
using Zitadel.Authentication.Events.Context; | ||
using Zitadel.Authentication.Handler; | ||
|
||
namespace Zitadel.Authentication.Events; | ||
|
||
public class LocalFakeZitadelEvents | ||
{ | ||
/// <summary> | ||
/// Invoked after a ClaimsIdentity has been generated in the <see cref="LocalFakeZitadelHandler"/>. | ||
/// </summary> | ||
public Func<LocalFakeZitadelAuthContext, Task> OnZitadelFakeAuth { get; set; } = context => Task.CompletedTask; | ||
} |
Oops, something went wrong.