Round #726
10 May 2026, 15:15· csharp· Meta-Llama-3.3-70B-Instruct· r13-clean-hints
- Complexity
- band 0
- ZP / UO / OBS
- 3 / 5 / 1
- Journey weight
- 507
- Lightshift ΔL
- +0.00
Prompt
Configure OpenIdConnectOptions with pushed authorization requests and a custom IClaimsTransformation that enriches the principal with role data.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0025 | 2026-05-10T15:15:16Z
Configure OpenIdConnectOptions with pushed authorization requests and a custom IClaimsTransformation that enriches the principal with role data.
ZERO POINT — 3 entries (structural invariants)
● hsl(178.91, 100%, 40%) IAuthorizationHandler [contract]
● hsl(14.32, 100%, 40%) IAuthorizationRequirement [contract]
● hsl(349.17, 100%, 40%) AuthorizationHandler<TRequirement> [contract]
UNOBSERVED — 5 entries (implied truths)
○ hsl(27.69, 100%, 50%) async [feature]
○ hsl(49.23, 100%, 50%) try [feature]
○ hsl(112.62, 100%, 38%) Token validation parameters [function]
○ hsl(31.38, 100%, 42%) Scoped registration [function]
○ hsl(44.31, 100%, 42%) IOptions of T binding [function]
OBSERVED — 1 entries (explicit in request)
◉ hsl(98.46, 100%, 50%) with [feature]
COMPLEXITY │ 9 entries │ spread: 85° │ band: LOW
Baseline response (no ZPI)
Here's an example of how you can configure OpenIdConnectOptions with pushed authorization requests and a custom IClaimsTransformation that enriches the principal with role data in C#:
```csharp
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.Identity.Web;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
public class CustomClaimsTransformation : IClaimsTransformation
{
private readonly IRoleService _roleService;
public CustomClaimsTransformation(IRoleService roleService)
{
_roleService = roleService;
}
public async Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var claims = principal.Claims.ToList();
// Get the user's roles from the role service
var roles = await _roleService.GetRolesAsync(principal.FindFirstValue(ClaimTypes.NameIdentifier));
// Add the roles to the claims
claims.AddRange(roles.Select(role => new Claim(ClaimTypes.Role, role)));
// Create a new ClaimsIdentity with the updated claims
var newIdentity = new ClaimsIdentity(claims, principal.Identity.AuthenticationType);
// Create a new ClaimsPrincipal with the new identity
var newPrincipal = new ClaimsPrincipal(newIdentity);
return newPrincipal;
}
}
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "OpenIdConnect";
})
.AddCookie("Cookies")
.AddOpenIdConnect("OpenIdConnect", options =>
{
options.Authority = "https://your-authority.com";
options.ClientId = "your-client-id";
options.ClientSecret = "your-client-secret";
options.ResponseType = "code";
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.UsePkce = true;
options.UseTokenLifetime = true;
// Configure pushed authorization requests
options.Prompt = "consent";
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = "https://your-authority.com",
ValidAudience = "your-client-id",
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("your-client-secret"))
};
// Add the custom claims transformation
services.AddTransient<IClaimsTransformation, CustomClaimsTransformation>();
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
```
In this example, we're using the `Microsoft.Identity.Web` NuGet package to handle the OpenID Connect authentication. We're also using a custom `IClaimsTransformation` to enrich the principal with role data.
The `CustomClaimsTransformation` class implements the `IClaimsTransformation` interface and overrides the `TransformAsync` method. This method is called after the user is authenticated and allows us to modify the claims of the principal.
In this example, we're using a role service to get the user's roles and adding them to the claims of the principal.
The `Startup` class configures the authentication and authorization middleware in the `ConfigureServices` method. We're adding the OpenID Connect authentication scheme and configuring it to use pushed authorization requests.
We're also adding the custom claims transformation to the services collection.
In the `Configure` method, we're using the authentication and authorization middleware to authenticate and authorize the user.
Note that you'll need to replace the placeholders (`https://your-authority.com`, `your-client-id`, `your-client-secret`, etc.) with the actual values for your OpenID Connect provider.
Enhanced response (with ZPI)
To configure OpenIdConnectOptions with pushed authorization requests and a custom IClaimsTransformation, you can use the following code:
```csharp
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
public class CustomClaimsTransformation : IClaimsTransformation
{
private readonly IOptions<OpenIdConnectOptions> _openIdConnectOptions;
public CustomClaimsTransformation(IOptions<OpenIdConnectOptions> openIdConnectOptions)
{
_openIdConnectOptions = openIdConnectOptions;
}
public async Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var claims = principal.Claims.ToList();
// Enrich the principal with role data
var roleClaim = new Claim(ClaimTypes.Role, "CustomRole");
claims.Add(roleClaim);
var newIdentity = new ClaimsIdentity(claims, principal.Identity.AuthenticationType);
var newPrincipal = new ClaimsPrincipal(newIdentity);
return newPrincipal;
}
}
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(options =>
{
options.DefaultScheme = "OpenIdConnect";
})
.AddOpenIdConnect("OpenIdConnect", options =>
{
options.Authority = "https://your-authority.com";
options.ClientId = "your-client-id";
options.ClientSecret = "your-client-secret";
options.ResponseType = "code";
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = "https://your-authority.com",
ValidAudience = "your-client-id"
};
// Configure pushed authorization requests
options.PushedAuthorizationRequests = new PushedAuthorizationRequestOptions
{
AuthorizationEndpoint = "https://your-authority.com/authorize",
TokenEndpoint = "https://your-authority.com/token"
};
});
services.AddTransient<IClaimsTransformation, CustomClaimsTransformation>();
services.AddControllersWithViews();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
```
In this code:
* We create a custom `IClaimsTransformation` implementation called `CustomClaimsTransformation` that enriches the principal with role data.
* We configure OpenIdConnectOptions with pushed authorization requests and register the custom `IClaimsTransformation` in the DI container.
* We use the `AddOpenIdConnect` method to add OpenIdConnect authentication to the pipeline, specifying the authority, client ID, client secret, response type, and other options.
* We configure token validation parameters to validate the issuer, audience, lifetime, and issuer signing key.
* We enable pushed authorization requests by setting the `PushedAuthorizationRequests` property on the OpenIdConnect options.
* We add the custom `IClaimsTransformation` to the DI container using the `AddTransient` method.
This code demonstrates how to configure OpenIdConnectOptions with pushed authorization requests and a custom IClaimsTransformation that enriches the principal with role data.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
WorseV9anthropic/claude-opus-4-7
WorseV12openai/gpt-4o
BetterComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.