Skip to content

Commit b939be2

Browse files
feat(utils): add GatewayAgentEnroll / GatewayAgentRead scopes + bump version
Mirrors the two new `AccessScope` variants (`gateway.agent.enroll` / `gateway.agent.read`) on the .NET side so DVLS's `ScopeClaims` can sign scope tokens with the canonical scope names instead of the broader `ConfigWrite` / `DiagnosticsRead` fallbacks. Bumps the package version to `2025.10.2-pr2-alpha1` (prerelease) so downstream consumers can pin to this build for dev / PR validation without clashing with the published 2025.10.1. Adds JSON round-trip tests confirming the two new scopes serialize to their expected `scope` field strings.
1 parent b00ffbe commit b939be2

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

utils/dotnet/Devolutions.Gateway.Utils.Tests/JsonSerializationTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,26 @@ public void ScopeClaims()
156156
Assert.Equal(EXPECTED, result);
157157
}
158158

159+
[Fact]
160+
public void ScopeClaimsAgentEnroll()
161+
{
162+
const string EXPECTED = """{"scope":"gateway.agent.enroll","jet_gw_id":"ccbaad3f-4627-4666-8bb5-cb6a1a7db815"}""";
163+
164+
var claims = new ScopeClaims(gatewayId, AccessScope.GatewayAgentEnroll);
165+
string result = JsonSerializer.Serialize(claims);
166+
Assert.Equal(EXPECTED, result);
167+
}
168+
169+
[Fact]
170+
public void ScopeClaimsAgentRead()
171+
{
172+
const string EXPECTED = """{"scope":"gateway.agent.read","jet_gw_id":"ccbaad3f-4627-4666-8bb5-cb6a1a7db815"}""";
173+
174+
var claims = new ScopeClaims(gatewayId, AccessScope.GatewayAgentRead);
175+
string result = JsonSerializer.Serialize(claims);
176+
Assert.Equal(EXPECTED, result);
177+
}
178+
159179
[Fact]
160180
public void NetScanClaims()
161181
{

utils/dotnet/Devolutions.Gateway.Utils/Devolutions.Gateway.Utils.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Description>Useful classes to use Devolutions Gateway</Description>
1212
<Copyright>© Devolutions Inc. All rights reserved.</Copyright>
1313
<RootNamespace>Devolutions.Gateway.Utils</RootNamespace>
14-
<Version>2025.10.1.0</Version>
14+
<Version>2025.10.2-pr2-alpha1</Version>
1515
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
1616
<RepositoryUrl>https://github.com/Devolutions/devolutions-gateway.git</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>

utils/dotnet/Devolutions.Gateway.Utils/src/AccessScope.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ internal AccessScope(string value)
2828
public static AccessScope GatewayTrafficAck = new AccessScope("gateway.traffic.ack");
2929
public static AccessScope GatewayNetMonitorConfig = new AccessScope("gateway.net.monitor.config");
3030
public static AccessScope GatewayNetMonitorDrain = new AccessScope("gateway.net.monitor.drain");
31+
public static AccessScope GatewayAgentEnroll = new AccessScope("gateway.agent.enroll");
32+
public static AccessScope GatewayAgentRead = new AccessScope("gateway.agent.read");
3133

3234
public override string? ToString()
3335
{

0 commit comments

Comments
 (0)