Skip to content

Auth methods - #10

Merged
nolsen311 merged 3 commits into
mainfrom
auth-methods
Sep 6, 2026
Merged

nolsen311 merged 3 commits into
mainfrom
auth-methods

Conversation

@nolsen311

Copy link
Copy Markdown
Owner

No description provided.

nolsen311 and others added 3 commits September 6, 2026 13:01
pfRest v2 exposes three mutually-exclusive auth schemes; the v2 rewrite
only wired up the API key. This adds the other two.

Client (pypfsense):
- `Client(url, session, *, auth_method, api_key|username/password, verify_ssl)`.
  api_key -> `x-api-key`; basic -> `Authorization: Basic`; jwt -> a Bearer
  token minted from `POST /api/v2/auth/jwt` (with Basic), cached, and
  re-minted + retried once on a 401. Header-only, so no deprecated
  `aiohttp.BasicAuth`.
- `client_from_config(url, session, data, verify_ssl)` builds the right
  client from a config-entry mapping; used by setup and the config flow.

Config flow (VERSION 3 -> 4):
- `async_step_user` is now a menu (API key / username+password / JWT);
  each method has its own form. Reauth re-prompts for whichever
  credentials the entry's `auth_method` needs.
- `async_migrate_entry` v3 -> v4 stamps `auth_method: api_key` on existing
  entries (unique id unchanged, entities re-attach).

Strings gain the menu + per-method steps; `invalid_auth` text is now
method-neutral and mentions enabling the method under System > REST API >
Settings.

Tests updated for the new signature and flow; added basic/jwt header,
jwt-refresh, missing-credential, and v3->v4 migration cases.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the username+password and JWT authentication methods to the config
flow (see previous commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
action-gh-release updates the existing release to attach the zip; pass
back its current prerelease/draft flags so a pre-release isn't silently
promoted to a full release.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

🎉 Thank you for contributing to SkyRadar Fusion! Your Pull Request has been received. Our automated tests (Hassfest, Ruff, etc.) will run shortly. If anything fails, don't worry—just check the logs and update your branch!

@nolsen311
nolsen311 merged commit 4cf1822 into main Sep 6, 2026
10 of 11 checks passed
@nolsen311
nolsen311 deleted the auth-methods branch September 6, 2026 20:09
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.

1 participant