Skip to content

Commit 09d7c6d

Browse files
author
Vincent Wilms
committed
Merge commit '4105cffc4aef4664164c724536c089662e1f4079'
2 parents 9629e68 + 4105cff commit 09d7c6d

File tree

8 files changed

+30
-15
lines changed

8 files changed

+30
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v2.0.0-beta.53 - 2025-11-26
2+
- Fixed [#260: Accept license" causes error?](#260);
3+
- Fixed [#260: Accept license" causes error?](#260);
4+
15
## v2.0.0-beta.52 - 2025-03-05
26
- Fix security issues #244 and #247
37

src/Nexus/Core/NexusIdentityProviderExtensions.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ public static WebApplication UseNexusIdentityProvider(
127127
.LastOrDefault();
128128

129129
authorization ??= await authorizationManager.CreateAsync(
130-
principal: principal,
131-
subject: subject,
132-
client: (await applicationManager.GetIdAsync(client))!,
133-
type: AuthorizationTypes.Permanent,
134-
scopes: principal.GetScopes());
130+
principal: principal,
131+
subject: subject,
132+
client: (await applicationManager.GetIdAsync(client))!,
133+
type: AuthorizationTypes.Permanent,
134+
scopes: principal.GetScopes()
135+
);
135136

136137
principal.SetAuthorizationId(await authorizationManager.GetIdAsync(authorization));
137138

src/Nexus/Core/PersonalAccessTokenAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected async override Task<AuthenticateResult> HandleAuthenticateAsync()
105105
var userIdParts = userId.Split('@', count: 2);
106106
var scheme = userIdParts.Length == 2 ? userIdParts[1] : default;
107107

108-
AuthUtilities.AddEnabledCatalogPatternClaim(principal, scheme, _securityOptions);
108+
AuthUtilities.SetEnabledCatalogPatternClaim(principal, scheme, _securityOptions);
109109
}
110110
}
111111
}

src/Nexus/Services/CatalogManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public async Task<CatalogContainer[]> GetCatalogContainersAsync(
155155
var userIdParts = user.Id.Split('@', count: 2);
156156
var scheme = userIdParts.Length == 2 ? userIdParts[1] : default;
157157

158-
AuthUtilities.AddEnabledCatalogPatternClaim(owner, scheme, _securityOptions);
158+
AuthUtilities.SetEnabledCatalogPatternClaim(owner, scheme, _securityOptions);
159159

160160
/* For each pipeline */
161161
foreach (var (pipelineId, pipeline) in pipelines)

src/Nexus/Services/CustomCookieAuthenticationEvents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public override Task ValidatePrincipal(CookieValidatePrincipalContext context)
2424
if (scheme is null)
2525
context.RejectPrincipal();
2626

27-
AuthUtilities.AddEnabledCatalogPatternClaim(context.Principal, scheme, _securityOptions);
27+
AuthUtilities.SetEnabledCatalogPatternClaim(context.Principal, scheme, _securityOptions);
2828

2929
return base.ValidatePrincipal(context);
3030
}

src/Nexus/Utilities/AuthUtilities.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ namespace Nexus.Utilities;
1313

1414
internal static class AuthUtilities
1515
{
16-
public static void AddEnabledCatalogPatternClaim(ClaimsPrincipal principal, string? scheme, SecurityOptions options)
16+
public static void SetEnabledCatalogPatternClaim(ClaimsPrincipal principal, string? scheme, SecurityOptions options)
1717
{
1818
var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
1919

20+
// Do not store the EnabledCatalogsPattern claim in the cookie: it’s tied to the
21+
// sign-in scheme and should be inherited by the user, not persisted. When a user
22+
// accepts a catalog license, they are re-signed in to refresh the cookie. Since
23+
// the claim has previously been added to the User, it becomes part of the cookie.
24+
// On the next visit, the EnabledCatalogsPattern claim is added again, resulting
25+
// in multiple entries of the same claim. This breaks
26+
// user.GetClaim("EnabledCatalogsPattern"), which correctly expects a single claim
27+
// of a given type. To avoid this we remove all existing instances of the claim.
28+
principal.RemoveClaims(NexusClaimsConstants.ENABLED_CATALOGS_PATTERN_CLAIM);
29+
2030
if (scheme is null)
2131
{
2232
principal.AddClaim(

src/extensibility/python-extensibility/nexus_extensibility/_extensibility_data_source.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ class SimpleDataSource(Generic[T], IDataSource[T], ABC):
219219
A simple implementation of a data source.
220220
"""
221221

222-
Context: DataSourceContext[T]
222+
context: DataSourceContext[T]
223223
"""Gets the data source context. This property is not accessible from within class constructors as it will bet set later."""
224224

225-
Logger: ILogger
225+
logger: ILogger
226226
"""Gets the data logger. This property is not accessible from within class constructors as it will bet set later."""
227227

228-
async def set_context(self, context: DataSourceContext, logger: ILogger):
229-
self.Context = context
230-
self.Logger = logger
228+
async def set_context(self, context: DataSourceContext[T], logger: ILogger):
229+
self.context = context
230+
self.logger = logger
231231

232232
@abstractmethod
233233
def get_catalog_registrations(self, path: str) -> Awaitable[list[CatalogRegistration]]:

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"version": "2.0.0",
3-
"suffix": "beta.52"
3+
"suffix": "beta.53"
44
}

0 commit comments

Comments
 (0)