skipcheck

TM1 Testcontainers · Docs · Containers

KeycloakContainer

from skipcheck_tm1_testcontainers import KeycloakContainer

Keycloak in Docker, as the OpenID Connect provider for a CognosContainer's OIDC namespace (CognosContainer.with_keycloak). Cognos builds a realm in it from its test users when it starts.

Its issuer is its address on the shared Docker network, http://keycloak:8080, whichever way it's reached, so Cognos accepts tokens that tests get through the host-side port (id_token). The interactive (browser) logon would need a browser that reaches that network address, so it isn't wrapped here.

Members

DEFAULT_IMAGEThe Keycloak image.
IMAGEOverrides the Keycloak image, e.g.
HTTP_PORTKeycloak's HTTP port inside the container.
NETWORK_ALIASThe container's name on its Docker network.
REALMThe realm cognos-server builds from its test users.
APP_CLIENTThe realm's client for applications.
__init__ constructorKeycloak on the default image (or KEYCLOAK_IMAGE), in development mode.
network_url propertyKeycloak as other containers on its network reach it.
url propertyKeycloak as seen from the host, such as http://localhost:54321, without a trailing slash.
id_tokenAn ID token for a user of the realm, by password.

DEFAULT_IMAGE

DEFAULT_IMAGE: ClassVar[str]

The Keycloak image.

IMAGE

IMAGE: ClassVar[str]

Overrides the Keycloak image, e.g. another version. Read as a system property, then an environment variable.

HTTP_PORT

HTTP_PORT: ClassVar[int]

Keycloak's HTTP port inside the container.

NETWORK_ALIAS

NETWORK_ALIAS: ClassVar[str]

The container's name on its Docker network.

REALM

REALM: ClassVar[str]

The realm cognos-server builds from its test users.

APP_CLIENT

APP_CLIENT: ClassVar[str]

The realm's client for applications: public, and its tokens include Cognos's client in their audience, which Cognos requires.

__init__

constructor
__init__(image: str | None = None) -> None

Keycloak on the default image (or KEYCLOAK_IMAGE), in development mode.

network_url

property
network_url: str

Keycloak as other containers on its network reach it: http://keycloak:8080. Also its issuer's base. No trailing slash.

url

property
url: str

Keycloak as seen from the host, such as http://localhost:54321, without a trailing slash. Its admin console logs on as admin / admin.

id_token

id_token(user: str, password: str) -> str

An ID token for a user of the realm, by password.