Standalone Gateway UserSession class - Platform - BlueCat Gateway - 25.3.0

Gateway Administration Guide

ft:locale
en-US
Product name
BlueCat Gateway
Version
25.3.0

class bluecat.gateway._internal.sessions.standalone.UserSession(username, unique_name='', *, platform=None, platform_actions, **_)

The structure made available to workflows providing properties and methods about the Standalone Gateway user session for a logged-in user. Instances of this class are created automatically by the platform when a user logs in. It can be utilized in workflows via g.user of type class UserSession (or the alias class StandaloneUserSession when using Standalone authentication).

property authentication_host

The host portion of the authentication URL.

Note:

Since Gateway is using standalone authentication we are not authenticating against any server. This will always return None.

Return type: None

New in version 25.1.0.

property authentication_url

The base URL to the authentication server that Gateway session is for.

Note:

Since Gateway is using standalone authentication we are not authenticating against any server. This will always return an empty string.

Return type: str

New in version 25.1.0.

property authentication_version

The base version for the authentication of the session.

Return type: str | None

New in version 25.2.0.

property is_replication_user

Indicates whether the user is authenticated with the Replication system.

Return type: bool

Returns: True if the user is authenticated via the Replication system, otherwise False

property logger

A logger that can be used to log messages which will have a context value unique to this user session. This is useful when identifying or tracing a user’s activities in logs.

Note:

In practice, this is a LoggerAdapter. As such it has a slightly more limited interface than a full-fledged logging.Logger. Do not (attempt to) change its logging level.

Return type: LoggerAdapter

property logger_context

A value included in the log messages made via the logger of this user session. It is unique to this user session as it derives from the username and the session. This is useful when identifying or tracing a user’s activities in logs.

Return type: str

property session_auth

The authentication value identifying this user session in Gateway.

This property does not support assignment.

Return type: str

property standalone_api

The structure for accessing the already authenticated Standalone API.

Example:

from bluecat import route
from bluecat.gateway.decorators import require_user
from flask import g, jsonify


@route(app, "/example/standalone/custom-auth-status")
@require_user
def get_custom_authentication_status():
    status = {"custom_auth_status": g.user.standalone_api.custom_authentication}
    return jsonify(status)

Return type: PlatformActions

property standalone_auth

The authentication used by the Python client to the Standalone API.

This property does not support assignment.

Return type: str

property username

The username of the currently logged-in user.

This property does not support assignment.

Return type: str