Skip to content

Simplify foreach loop by using LINQ Select #723

@ziagham

Description

@ziagham

What version of FlowSynx?

1.2.4

Describe the bug

The loop is only used to extract jwt.Name and log it. This can be simplified using LINQ (Select) to improve readability and reduce boilerplate.

File: src/FlowSynx.Application/Configuration/Core/Security/AuthenticationConfiguration.cs
Line: 41-45

Current Code:

foreach (var jwt in JwtProviders)
{
    validSchemes.Add(jwt.Name);
    logger.LogInformation("JWT provider '{Scheme}' configured", jwt.Name);
}

Proposed Fix

foreach (var scheme in JwtProviders.Select(jwt => jwt.Name))
{
    validSchemes.Add(scheme);
    logger.LogInformation("JWT provider '{Scheme}' configured", scheme);
}

Benefits

  • Cleaner and more expressive
  • Reduces unnecessary direct iteration over provider objects
  • Makes intent (extracting names) more obvious

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions