Skip to content

Allow specifying user roles for ApiKey and Basic Authentication #165

Description

@marcominerva

Currently, SimpleAuthentication allows configuration for ApiKey and Basic authentication schemes, including specifying fixed API keys and credentials. However, there is no way to specify the list of roles for a user when using these methods.

Requested enhancement:

  • Add a Roles parameter (array of strings) to both ApiKey and Basic authentication configuration sections.
  • When validating credentials (ApiKey or Basic), if Roles is specified, automatically populate the role claim for the corresponding user.
  • The Roles list should be optional; if omitted, no roles are assigned.
  • Update the README.md file to document this feature, including examples for both configuration and expected claim population.

Example configuration:

"Authentication": {
    "ApiKey": {
        "ApiKeys": [
            {
                "Value": "key-1",
                "UserName": "UserName1",
                "Roles": ["Admin", "User"]
            }
        ]
    },
    "Basic": {
        "Credentials": [
            {
                "UserName": "UserName1",
                "Password": "Password1",
                "Roles": ["Manager"]
            }
        ]
    }
}

This enhancement will provide more fine-grained control over user claims and simplify role assignment for fixed credentials.

  • Update configuration schema and validation logic
  • Populate role claim from the Roles array
  • Update documentation (README.md)

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions