Skip to content

Provide support to add named configs map for authenticators#4363

Draft
sahandilshan wants to merge 3 commits intowso2:4.10.xfrom
sahandilshan:4.10.x-new
Draft

Provide support to add named configs map for authenticators#4363
sahandilshan wants to merge 3 commits intowso2:4.10.xfrom
sahandilshan:4.10.x-new

Conversation

@sahandilshan
Copy link
Copy Markdown

Purpose

$subject

With this new support we can define new configurations for Authenticators as below.

# Named configurations
[admin_console.authenticator.mutual_ssl_authenticator.configs.ssl_validation]
CertificateHeader = "X-SSL-CERT"
UsernameHeader = "X-SSL-USER"
ValidateClientCert = true

Copilot AI review requested due to automatic review settings August 24, 2025 14:21
@sahandilshan sahandilshan marked this pull request as draft August 24, 2025 14:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for named configuration maps in authenticators, allowing configurations to be organized in named groups rather than just flat parameter maps. This enables more structured configuration management for authenticators while maintaining backward compatibility with existing flat parameter configurations.

Key changes:

  • Introduces a nested parameter map structure alongside the existing flat parameter map
  • Adds processing logic to handle both named and unnamed configuration elements
  • Provides new getter methods to access named configurations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


// Only process configs that have an explicit name attribute.
OMAttribute configNameAttr = configElement.getAttribute(new QName(ATTR_NAME));
if(configNameAttr == null){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting issue


// Only process configs that have an explicit name attribute.
OMAttribute configNameAttr = configElement.getAttribute(new QName(ATTR_NAME));
if(configNameAttr == null){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It unclear what are we trying to achieve here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we can have define as below

<Config>
        <Parameter name="name01">value01</Parameter>
        <Parameter name="name02">value02</Parameter>
</Config>

With this new config we are providing the support to define named config along with the previous support. so now we can have something like this

<Config>
        <Parameter name="name01">value01</Parameter>
        <Parameter name="name02">value02</Parameter>
</Config>

<Config name="configName">
        <Parameter name="name01">value01</Parameter>
        <Parameter name="name02">value02</Parameter>
</Config>

OMAttribute configNameAttr = configElement.getAttribute(new QName(ATTR_NAME));
if(configNameAttr == null){
// Skip configs without name attribute - process parameters for flat map only.
for(Iterator paramIterator = configElement.getChildrenWithLocalName(ELEM_PARAMETER);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid iterating the elements twice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants