@@ -183,24 +183,45 @@ private async Task<Results<Ok<HealthReportModel>, ProblemHttpResult>> HealthChec
183183 }
184184
185185 /// <summary>
186- /// Returns the current user's claims.
186+ /// Returns request headers and the current user's claims.
187187 /// </summary>
188+ /// <param name="httpContext">The HTTP context containing the incoming request headers.</param>
188189 /// <param name="user">The current user principal.</param>
189190 /// <param name="cancellationToken">The cancellation token.</param>
190- /// <returns>A list of claim type and value pairs.</returns>
191- private async Task < Results < Ok < List < ClaimType > > , ProblemHttpResult > > ClaimsCheck (
191+ /// <returns>A claim result containing request headers and claim type/value pairs, or problem details when an error occurs.</returns>
192+ private async Task < Results < Ok < ClaimResult > , ProblemHttpResult > > ClaimsCheck (
193+ HttpContext httpContext ,
192194 ClaimsPrincipal ? user = default ,
193195 CancellationToken cancellationToken = default )
194196 {
195197 LogClaimsCheckRequested ( _logger , user ? . Identity ? . Name ?? "anonymous" ) ;
196198
197199 try
198200 {
201+ var headers = httpContext . Request . Headers
202+ . SelectMany ( h => h . Value , ( h , v ) => new KeyValue < string , string > { Key = h . Key , Value = v } )
203+ . OrderBy ( c => c . Key , StringComparer . Ordinal )
204+ . ThenBy ( c => c . Value , StringComparer . Ordinal )
205+ . ToList ( ) ;
206+
207+ var cookies = httpContext . Request . Cookies
208+ . Select ( c => new KeyValue < string , string > { Key = c . Key , Value = c . Value } )
209+ . OrderBy ( c => c . Key , StringComparer . Ordinal )
210+ . ToList ( ) ;
211+
199212 var claims = user ? . Claims
200213 . Select ( c => new ClaimType { Type = c . Type , Value = c . Value } )
214+ . OrderBy ( c => c . Type , StringComparer . Ordinal )
201215 . ToList ( ) ;
202216
203- return TypedResults . Ok ( claims ) ;
217+ var results = new ClaimResult
218+ {
219+ Headers = headers ,
220+ Cookies = cookies ,
221+ Claims = claims ,
222+ } ;
223+
224+ return TypedResults . Ok ( results ) ;
204225 }
205226 catch ( Exception ex )
206227 {
0 commit comments