ironic.common.redfish.auth module

Async Redfish authentication mechanisms.

class ironic.common.redfish.auth.AsyncAuthBase(username=None, password=None, root_prefix=None)[source]

Bases: object

Base class for async Redfish authentication.

async authenticate()[source]

Perform authentication.

Raises:

RuntimeError if connector is not set.

abstractmethod can_refresh_session()[source]

Check if session can be refreshed.

Returns:

True if session refresh is supported, False otherwise.

async close()[source]

Clean up authentication resources.

Override in subclasses if cleanup is needed.

async set_context(connector, root=None)[source]

Set connector context and authenticate.

Parameters:
  • connector – AsyncConnector instance.

  • root – Optional AsyncResource for the service root. Session authentication discovers the Sessions URI from it; without it the conventional path is used instead.

class ironic.common.redfish.auth.AsyncBasicAuth(username=None, password=None, root_prefix=None)[source]

Bases: AsyncAuthBase

HTTP Basic Authentication.

Uses HTTP Basic authentication for all requests.

can_refresh_session()[source]

Basic auth cannot refresh sessions.

Returns:

False

class ironic.common.redfish.auth.AsyncSessionAuth(username=None, password=None, root_prefix=None)[source]

Bases: AsyncAuthBase

Redfish Session Authentication.

Creates and manages a Redfish session for authentication.

can_refresh_session()[source]

Check if session can be refreshed.

Returns:

True if session key and resource ID are available.

async close()[source]

Close the Redfish session.

Attempts to DELETE the session from the BMC. A session the BMC has already dropped, by expiry or reboot, answers 404, which is the outcome this method wants rather than a failure: the goal is that the session no longer exists.

get_session_key()[source]

Get the session authentication key.

Returns:

Session key (X-Auth-Token value).

get_session_resource_id()[source]

Get the session resource ID/URI.

Returns:

Session resource URI for deletion.

async refresh_session()[source]

Refresh the Redfish session.

Creates a new session after the previous one has expired.

Raises:

MissingHeaderError if X-Auth-Token not in response.

Raises:

ConnectionError on connection failures.

Raises:

AccessError on authentication failures.

Raises:

HTTPError on other HTTP errors.

reset_session_attrs()[source]

Reset session-related attributes.

class ironic.common.redfish.auth.AsyncSessionOrBasicAuth(username=None, password=None, root_prefix=None)[source]

Bases: AsyncSessionAuth

Session authentication with fallback to basic auth.

Attempts to use session-based authentication. If session creation fails, falls back to HTTP Basic authentication.

async close()[source]

Close session if one exists.

async refresh_session()[source]

Refresh session if available, otherwise no-op.

Only refreshes if session authentication is being used.