Skip to content

Conversation

@lukasmatusiewicz
Copy link
Contributor

This pull request introduces support for forwarding client IP and user agent information to the privacyIDEA server in several API calls. It also refactors internal helper methods and improves code documentation and organization. The most important changes are grouped below.

Client Information Forwarding:

  • Added optional clientIP and clientUserAgent parameters to all major public API methods in PrivacyIDEA.cs, enabling the forwarding of client-specific information to the privacyIDEA server. These parameters are now included in requests via the new AddClientInfo helper method. [1] [2] [3] [4] [5] [6] [7]
  • Implemented the AddClientInfo private method to append client IP and user agent data to request parameter dictionaries when provided.

Code Organization and Documentation:

  • Improved method documentation for public and private methods, clarifying parameter purposes and return values, especially for new client info parameters. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Moved and documented the SetServiceAccount method, placing it after the request logic for better organization and clarity. [1] [2]

Internal Refactoring:

  • Updated the internal GetAuthToken method to accept optional client info parameters and forward them in authentication requests. [1] [2]
  • Added a utility method for converting dictionaries to encoded StringContent, improving code reuse.

New Enum Definition:

  • Added the PIAuthenticationStatus enum to represent authentication outcomes, improving code clarity and type safety.

Closing #1

@lukasmatusiewicz lukasmatusiewicz linked an issue Nov 6, 2025 that may be closed by this pull request
@lukasmatusiewicz lukasmatusiewicz linked an issue Nov 6, 2025 that may be closed by this pull request
Copy link
Contributor

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 forwarding client IP addresses and user agent information to the privacyIDEA server, improving audit trails and security context for authentication operations. The changes also include code organization improvements and the introduction of a new authentication status enum.

Key changes:

  • Added optional clientIP and clientUserAgent parameters to all public API methods for forwarding client context
  • Introduced PIAuthenticationStatus enum for representing authentication outcomes
  • Improved code documentation and reorganized helper methods for better maintainability

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
PrivacyIDEA.cs Added client info parameters to all public API methods, implemented AddClientInfo helper, improved documentation, and reorganized code structure
PIAuthenticationStatus.cs New enum defining authentication status values (UNDEFINED, ACCEPT, REJECT, CHALLENGE)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nilsbehlen nilsbehlen merged commit ca4b518 into main Nov 10, 2025
1 check passed
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.

Add authentication status enum Add "client" and "client user agent" parameters

3 participants