WoW2.Sdk.Beta.Be.Identity.Testing
10.0.32-beta
Prefix Reserved
dotnet add package WoW2.Sdk.Beta.Be.Identity.Testing --version 10.0.32-beta
NuGet\Install-Package WoW2.Sdk.Beta.Be.Identity.Testing -Version 10.0.32-beta
<PackageReference Include="WoW2.Sdk.Beta.Be.Identity.Testing" Version="10.0.32-beta" />
<PackageVersion Include="WoW2.Sdk.Beta.Be.Identity.Testing" Version="10.0.32-beta" />
<PackageReference Include="WoW2.Sdk.Beta.Be.Identity.Testing" />
paket add WoW2.Sdk.Beta.Be.Identity.Testing --version 10.0.32-beta
#r "nuget: WoW2.Sdk.Beta.Be.Identity.Testing, 10.0.32-beta"
#:package WoW2.Sdk.Beta.Be.Identity.Testing@10.0.32-beta
#addin nuget:?package=WoW2.Sdk.Beta.Be.Identity.Testing&version=10.0.32-beta&prerelease
#tool nuget:?package=WoW2.Sdk.Beta.Be.Identity.Testing&version=10.0.32-beta&prerelease
WoW2.Sdk.Beta.Be.Identity.Testing
The Identity test kit: the fake token issuer, and for app notices and organization members a fake broker and the broker's conformance suite each;
personas, the OTP code sink and the other brokers' fakes and suites land with those brokers. It references the contract, WoW2.Sdk.Beta.Be.Identity.Auth
and WoW2.Sdk.Beta.Be.Testing.
dotnet add package WoW2.Sdk.Beta.Be.Identity.Testing --prerelease
Fake token issuer
FakeTokenIssuer signs person, service and exchanged tokens in the exact shape Identity issues, with an in-memory RSA key,
so a consumer tests with no Identity running.
using var issuer = new FakeTokenIssuer();
await using var factory = new WebApplicationFactory<Program>().WithWebHostBuilder(host =>
host.ConfigureTestServices(services => services.AddFakeTokenIssuer(issuer)));
var client = factory.CreateClient();
// The audience is the host's real one: a wrong one still answers 401.
var worker = issuer.IssueServiceToken("ocharo-editorial", "https://files.example.com/", "files.read");
client.DefaultRequestHeaders.Authorization = new("Bearer", worker);
await client.GetAsync("/files");
var person = new FakePerson { Id = Guid.NewGuid(), OrganizationId = organizationId, Role = "owner", Permissions = ["files:share"], SessionId = Guid.NewGuid() };
var own = issuer.IssuePersonToken(person, "https://files.example.com/", scopes: "files.read");
var exchanged = issuer.IssueExchangedToken(person, "ocharo-editorial", "https://files.example.com/", "files.read");
AddFakeTokenIssuermakes the defaultJwtBearerscheme trust only the fake. A host's metadata address, trusted issuers and resolver stop being read, so nothing reaches a network; its audiences stay.issuer.AsTrustedIssuer(partition, audiences)is the other way in: add it toJwtOptions.TrustedIssuerswhen a test needs the real trusted-issuer pipeline, a stampedpartitionincluded.Lifetimedefaults to 5 minutes;clockdates the tokens, so a past clock makes an expired token.
A caller under test
CreateTokenEndpointHandler() answers form posts as Identity's /connect/token does, for client_credentials and token exchange. Swap it in as the primary handler of the named HttpClient the be sdk's token handler posts through, or use a plain HttpClient:
using var tokens = new HttpClient(issuer.CreateTokenEndpointHandler());
var response = await tokens.PostAsync("https://fake-issuer.test/connect/token", new FormUrlEncodedContent(new Dictionary<string, string>
{
["grant_type"] = "client_credentials",
["client_id"] = "ocharo-editorial",
["client_secret"] = "any",
["resource"] = "https://desk.example.com/",
["scope"] = "desk.media",
}));
The handler has no registry: any client may ask for any resource and scope, a client secret isn't checked, an omitted scope grants none, and an exchanged token keeps every permission. A failure answers 400 with { "error": … }, under the same error codes as Identity.
App notices
FakeAppNoticeBroker stands in for IAppNoticeBroker with no instance and no bot, under the contract's rules (the
idempotency key's included, Telegram's HTML not checked):
var notices = new FakeAppNoticeBroker().Link(linkedSub).Mute(mutedSub);
services.AddSingleton<IAppNoticeBroker>(notices);
// … run the job …
notices.Sent.Should().ContainSingle(n => n.Subject == linkedSub); // a sub never linked reads not_linked
notices.FailNext(error); // the next send fails with error
AppNoticeBrokerConformance holds the broker's cases; Identity.Tests.Conformance runs it against the Module, the Client
over the service, and this fake. A subclass gives the broker and arranges linked, unlinked and muted people.
Organization members
FakeMemberBroker stands in for IMemberBroker with no instance, under the contract's rules (catalog roles, earliest added
first, OrganizationNotFound and UnknownOrganizationRole in identityCode):
var members = new FakeMemberBroker()
.AddMember(organizationId, ownerSub, "owner")
.AddMember(organizationId, viewerSub, "viewer", hasTelegramLink: false);
services.AddSingleton<IMemberBroker>(members);
// … run the job …
members.Asked.Should().ContainSingle(); // (organizationId, role) per call
members.FailNext(error); // the next list fails with error
MemberBrokerConformance holds the broker's cases; Identity.Tests.Conformance runs it against the Module, the Client
over the service, and this fake. A subclass gives the broker and arranges organizations and members.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.3)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.14.0)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- WoW2.Sdk.Beta.Be.Identity.Abstractions (>= 10.0.32-beta)
- WoW2.Sdk.Beta.Be.Identity.Auth (>= 10.0.32-beta)
- WoW2.Sdk.Beta.Be.Testing (>= 10.0.112-beta)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.32-beta | 10 | 11/17/2026 |
| 10.0.31-beta | 43 | 11/17/2026 |
| 10.0.30-beta | 167 | 11/8/2026 |
| 10.0.29-beta | 80 | 11/6/2026 |
| 10.0.28-beta | 57 | 11/6/2026 |
| 10.0.27-beta | 64 | 11/5/2026 |
| 10.0.26-beta | 85 | 11/5/2026 |
| 10.0.25-beta | 64 | 11/5/2026 |
| 10.0.24-beta | 65 | 11/3/2026 |
| 10.0.23-beta | 61 | 11/2/2026 |
| 10.0.22-beta | 61 | 11/2/2026 |
| 10.0.21-beta | 66 | 11/2/2026 |
| 10.0.20-beta | 64 | 11/2/2026 |
| 10.0.19-beta | 66 | 11/2/2026 |
| 10.0.18-beta | 71 | 11/2/2026 |
| 10.0.17-beta | 69 | 11/2/2026 |
| 10.0.16-beta | 66 | 11/2/2026 |
| 10.0.15-beta | 63 | 11/2/2026 |
| 10.0.14-beta | 71 | 11/1/2026 |
| 10.0.13-beta | 70 | 11/1/2026 |