skipcheck

TM1 client · Docs · Sessions and logins

Tm1SessionBuilder

using Skipcheck.Tm1.Client.Session;

Builds a Tm1Session. Only BaseUrl and credentials are required.

Members

BaseUrlThe REST API's root, such as http://tm1:8010/api/v1/.
AddressThe server's address, read by the dialect.
DialectThe kind of deployment, for Address.
BasicAuthBasic authentication, for TM1 security modes 1 and 2.
AuthenticatorHow to log in.
ImpersonateLogs in as the service account but acts as user (TM1-Impersonate).
WithoutImpersonationLogs in as the credentials' own user.
SessionContextA label TM1 shows for the session (TM1-SessionContext, sent with the login), such as the application's name.
TimeoutsTimeouts by kind of work; Tm1Timeouts.Defaults unless set.
ErrorClassifierHow error responses are classified; Tm1ErrorClassifier.Defaults unless set.
HttpHandlerThe HTTP handler to send through (Java's webClient and connector).
CheckCapabilitiesWhether requests check the server's $metadata for what they need.
ClockThe clock refused logins are timed by (for tests).
CopyA copy of these settings, for a pool to build one session per identity.
BuildThe session.

BaseUrl

Tm1SessionBuilder BaseUrl(string baseUrl)

The REST API's root, such as http://tm1:8010/api/v1/.

Address

Tm1SessionBuilder Address(string address)

The server's address, read by the dialect: http://tm1:8010.

Dialect

Tm1SessionBuilder Dialect(Tm1Dialect dialect)

The kind of deployment, for Address. Tm1Dialect.V11 unless set.

BasicAuth

Tm1SessionBuilder BasicAuth(string user, string? password)

Basic authentication, for TM1 security modes 1 and 2: shorthand for Authenticator(Tm1Authenticator.Basic(user, password)). A null password counts as empty.

Authenticator

Tm1SessionBuilder Authenticator(Tm1Authenticator authenticator)

How to log in: TM1's own security, CAM, or credentials of your own. Asked for credentials on every login.

Impersonate

Tm1SessionBuilder Impersonate(string user)

Logs in as the service account but acts as user (TM1-Impersonate). TM1 matches the name ignoring case and spaces. A name with characters outside ASCII goes out as UTF-8, which is how TM1 (11.8) reads the header; the client's own handler does that. With a handler of your own (HttpHandler), such a name needs a SocketsHttpHandler whose RequestHeaderEncodingSelector is Tm1Session.Utf8Headers: .NET refuses to send the header otherwise, and the login fails.

Throws

ArgumentException
user is blank, which TM1 would take as no impersonation at all, or has a control character.

WithoutImpersonation

Tm1SessionBuilder WithoutImpersonation()

Logs in as the credentials' own user: no impersonation.

SessionContext

Tm1SessionBuilder SessionContext(string sessionContext)

A label TM1 shows for the session (TM1-SessionContext, sent with the login), such as the application's name: in TM1's thread and session lists and its audit log. Sent as UTF-8, as TM1 reads it; characters outside ASCII need what Impersonate says of a handler of your own.

Throws

ArgumentException
Longer than 250 characters, which is all TM1 keeps.

Timeouts

Tm1SessionBuilder Timeouts(Tm1Timeouts timeouts)

Timeouts by kind of work; Tm1Timeouts.Defaults unless set.

ErrorClassifier

Tm1SessionBuilder ErrorClassifier(Tm1ErrorClassifier classifier)

How error responses are classified; Tm1ErrorClassifier.Defaults unless set.

HttpHandler

Tm1SessionBuilder HttpHandler(HttpMessageHandler handler)

The HTTP handler to send through (Java's webClient and connector). Keep a custom pool's idle connections under 90 s: TM1 closes them then. For a user to impersonate or a session context with characters outside ASCII, the handler that writes to the socket must be a SocketsHttpHandler with RequestHeaderEncodingSelector = Tm1Session.Utf8Headers. A handler that can't be told the encoding (HttpClientHandler, the browser's in WebAssembly) can't send them: the login fails with .NET's error, and nothing reaches TM1.

CheckCapabilities

Tm1SessionBuilder CheckCapabilities(bool check)

Whether requests check the server's $metadata for what they need.

Clock

Tm1SessionBuilder Clock(Func<DateTimeOffset> clock)

The clock refused logins are timed by (for tests).

Copy

Tm1SessionBuilder Copy()

A copy of these settings, for a pool to build one session per identity.

Build

Tm1Session Build()

The session. Nothing is sent to TM1 until the first request.

Throws

InvalidOperationException
The base URL or credentials aren't set.