Skip to content

Add Basic Auth support#604

Open
lipaysamart wants to merge 3 commits into
cpanato:mainfrom
lipaysamart:main
Open

Add Basic Auth support#604
lipaysamart wants to merge 3 commits into
cpanato:mainfrom
lipaysamart:main

Conversation

@lipaysamart
Copy link
Copy Markdown

This PR adds Basic Auth support for Alertmanager HTTP requests, fixing issue #7.

Changes

Backend (Server)

  • Added User and Password fields to alertConfig struct in configuration.go
  • Modified HTTP request functions in alertmanager/ package to include Basic Auth:
    • retry.go: Added auth parameters to httpRetry() function
    • alerts.go: Updated ListAlerts() with auth support
    • silences.go: Updated silence management functions
    • status.go: Updated status query functions
  • Updated command handlers in commands.go to pass auth credentials
  • Updated action handlers in actions.go to pass auth credentials

Frontend (Webapp)

  • Added User and Password input fields in AMAttribute.jsx
  • Added configuration handling in CustomAttributeSettings.jsx
  • Password field uses type="password" for security (hidden input)
  • Added autoComplete="new-password" to prevent browser auto-fill

Files Modified

  • server/configuration.go - Added User/Password config fields
  • server/alertmanager/retry.go - Core HTTP auth logic
  • server/alertmanager/alerts.go - Alerts API with auth
  • server/alertmanager/silences.go - Silences API with auth
  • server/alertmanager/status.go - Status API with auth
  • server/commands.go - Command handlers
  • server/actions.go - Action handlers
  • webapp/src/components/admin_settings/AMAttribute.jsx - UI fields
  • webapp/src/components/admin_settings/CustomAttributeSettings.jsx - Settings handling

Fixes #7

lipaysamart and others added 3 commits April 27, 2026 20:37
- Add isPassword parameter to generateSimpleStringInputSetting()
- Change input type from 'input' to 'password' for password field
- Add autoComplete='new-password' to prevent browser auto-fill
Add Basic Auth support for Alertmanager HTTP requests - Fixes issue cpanato#7
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.

commands fails if alertmanager is behind basic auth

1 participant