The orchestrator.go
library is a blueprint for any orchestrator used in your service architecture. It provides utilities for:
Logging
User sessions and authentication
Metadata and configuration
Context management
Caching
HTTP requests
Routing and asset serving
A developer implementing this interface must ensure they provide these capabilities, making the orchestrator a centralized service toolkit for building and managing service extensions.
Methods
Logger(opts ...log.Option) log.Logger
What it does: Returns a logging utility.
Why it matters: Enables the service extension to log events, errors, or debugging information.
Options: You can pass in configurations like log levels or tags.
Logger determines the verbosity of the Orchestrator logs. For example, level: error will only show error logs (when debug mode is off). The orchestrator supports logging verbosity at the debug, info, and error levels.
Session(opts ...session.SessionOpt) (session.Provider, error)
What it does: Retrieves a session provider.
Why it matters: A session provider allows you to manage user sessions (e.g., login state).
Returns: An error if something goes wrong retrieving it.
User attributes are stored in session in the form of IDP_Label.attributeLabel
. Example: if User A is logged into an IDP with a name of Company_Entra
, you can retrieve an attribute value from the session by passing Company_Entra.attributeName
.
SecretProvider() (secret.Provider, error)
What it does: Provides access to secrets (like API keys or credentials).
Why it matters: Securely fetch sensitive information.
Returns: An error if the secret provider isn’t configured.
IdentityProvider(name string) (idfabric.IdentityProvider, error)
What it does: Gets an identity provider by its name.
Why it matters: Used for user authentication and identity management.
Returns: Error if the named provider isn’t found.
AttributeProvider(name string) (idfabric.AttributeProvider, error)
What it does: Gets a provider for identity-related attributes (e.g., roles, claims).
Why it matters: Helps determine what a user can do based on their attributes.
Metadata() map[string]any
What it does: Returns a map of metadata for the service extension.
Why it matters: Provides descriptive or contextual info about the current extension (like version, tags, etc.).
Router() router.Router
What it does: Returns a router object.
Why it matters: Used to define HTTP routes and endpoints for your service.
App() (app.App, error)
What it does: Gets the application object associated with the current service extension.
Why it matters: Useful for accessing core app-level logic or settings.
TAI() tai.Provider
What it does: Returns a TAI provider.
Why it matters: TAI could stand for “Token Authentication Interface” or similar—used for managing secure token-based auth.
WebLogic() weblogic.Provider
What it does: Provides WebLogic capabilities.
Why it matters: Possibly related to rule-based processing, workflows, or orchestration logic for web services.
Context() context.Context
What it does: Returns the context associated with the current service.
Why it matters: Context is used for timeouts, cancellation, and request-scoped values. Helpful in concurrent operations.
Note: This is experimental and may return nil.
WithContext(ctx context.Context) Orchestrator
What it does: Returns a new Orchestrator that uses the provided context.
Why it matters: Useful for modifying context behavior in scoped operations.
Cache(namespace string, opts ...cache.Constraint) (cache.Cache, error)
What it does: Provides a cache under a specific namespace.
Why it matters: Store temporary data between different parts of the service or requests.
ServiceExtensionAssets() bundle.SEAssets
What it does: Exposes any static assets (HTML, JS, config files) bundled with the service extension.
Why it matters: Useful for serving static content directly from the extension.
HTTP() http.HTTP
What it does: Returns utilities for making HTTP requests.
Why it matters: Provides abstraction over HTTP calls—useful for calling external APIs or services in a consistent way.