Documentation
¶
Overview ¶
Package frontegg is the entry point to the Frontegg Go SDK. It mirrors the Node SDK's @frontegg/client: a backend client for the Frontegg platform with authentication, JWT/access-token validation, entitlements, audits, events and hosted login.
The Client struct is the idiomatic entry point — construct it once with your vendor credentials and use its factory methods to build sub-clients. A package-level default (Init/DefaultIdentity/WithAuthentication) is also provided so the HTTP middleware can be used with zero wiring, mirroring the Node SDK's global FronteggContext convenience.
Index ¶
- func DefaultIdentity() *identity.Client
- func Init(creds Credentials, opts ...Option)
- func WithAuthentication(opts middleware.Options) func(http.Handler) http.Handler
- type Client
- func (c *Client) Audits() *audits.Client
- func (c *Client) Entitlements(opts ...entitlements.Option) *entitlements.Client
- func (c *Client) Events(auth *authenticator.Authenticator) *events.Client
- func (c *Client) HTTPClient(auth *authenticator.Authenticator, opts ...httpclient.Option) *httpclient.Client
- func (c *Client) HostedLogin(redirectURI string) *hostedlogin.Client
- func (c *Client) Identity() *identity.Client
- func (c *Client) NewAuthenticator() *authenticator.Authenticator
- type Credentials
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultIdentity ¶
DefaultIdentity returns the package-level identity client set by Init (nil if Init was not called).
func Init ¶
func Init(creds Credentials, opts ...Option)
Init configures the package-level default identity client used by WithAuthentication, mirroring the Node SDK's FronteggContext.init.
func WithAuthentication ¶
WithAuthentication returns net/http middleware using the package-level default identity client. Call Init first.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the SDK entry point. It holds shared configuration and builds sub-clients on demand.
func New ¶
func New(creds Credentials, opts ...Option) *Client
New returns a Client for the given credentials.
func (*Client) Entitlements ¶
func (c *Client) Entitlements(opts ...entitlements.Option) *entitlements.Client
Entitlements returns an entitlements client (call Start on it to begin loading).
func (*Client) Events ¶
func (c *Client) Events(auth *authenticator.Authenticator) *events.Client
Events returns an events client backed by the given authenticator.
func (*Client) HTTPClient ¶
func (c *Client) HTTPClient(auth *authenticator.Authenticator, opts ...httpclient.Option) *httpclient.Client
HTTPClient returns an authenticated REST client backed by the given authenticator.
func (*Client) HostedLogin ¶
func (c *Client) HostedLogin(redirectURI string) *hostedlogin.Client
HostedLogin returns a hosted-login client for the given redirect URI.
func (*Client) NewAuthenticator ¶
func (c *Client) NewAuthenticator() *authenticator.Authenticator
NewAuthenticator returns an initialised authenticator.
type Credentials ¶
type Credentials = identity.Credentials
Credentials are the vendor client ID and API key.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithConfig ¶
WithConfig overrides the resolved service configuration.
func WithHTTPClient ¶
WithHTTPClient sets the underlying *http.Client for all sub-clients.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audits provides the Managed Audit Logs client, mirroring the Node SDK's AuditsClient.
|
Package audits provides the Managed Audit Logs client, mirroring the Node SDK's AuditsClient. |
|
Package authenticator maintains a backend-to-backend (M2M) session with Frontegg, mirroring the Node SDK's FronteggAuthenticator.
|
Package authenticator maintains a backend-to-backend (M2M) session with Frontegg, mirroring the Node SDK's FronteggAuthenticator. |
|
Package cache provides the access-token cache abstraction used by the SDK, mirroring the Node SDK's src/cache module.
|
Package cache provides the access-token cache abstraction used by the SDK, mirroring the Node SDK's src/cache module. |
|
redisstore
Package redisstore is a Redis-backed cache.Cache implementation built on go-redis.
|
Package redisstore is a Redis-backed cache.Cache implementation built on go-redis. |
|
Package config resolves Frontegg service URLs from the environment, mirroring the Node SDK's src/config module.
|
Package config resolves Frontegg service URLs from the environment, mirroring the Node SDK's src/config module. |
|
Package entitlements provides the entitlements client and user-scoped entitlement checks, mirroring the Node SDK's EntitlementsClient.
|
Package entitlements provides the entitlements client and user-scoped entitlement checks, mirroring the Node SDK's EntitlementsClient. |
|
apitypes
Package apitypes models the vendor-entitlements v1 snapshot DTO.
|
Package apitypes models the vendor-entitlements v1 snapshot DTO. |
|
engine
Package engine is a Go port of @frontegg/entitlements-javascript-commons — the local feature-flag / plan rule-evaluation engine.
|
Package engine is a Go port of @frontegg/entitlements-javascript-commons — the local feature-flag / plan rule-evaluation engine. |
|
storage
Package storage builds the in-memory read models the entitlements client queries, mirroring the Node SDK's SourcesMapper + InMemoryEntitlementsCache.
|
Package storage builds the in-memory read models the entitlements client queries, mirroring the Node SDK's SourcesMapper + InMemoryEntitlementsCache. |
|
Package events provides the Events client, mirroring the Node SDK's EventsClient.
|
Package events provides the Events client, mirroring the Node SDK's EventsClient. |
|
Package hostedlogin provides the Frontegg hosted-login client, mirroring the Node SDK's HostedLoginClient (OAuth authorize URL + code exchange).
|
Package hostedlogin provides the Frontegg hosted-login client, mirroring the Node SDK's HostedLoginClient (OAuth authorize URL + code exchange). |
|
Package httpclient is an authenticated wrapper over net/http that injects the vendor access token on every request, mirroring the Node SDK's HttpClient.
|
Package httpclient is an authenticated wrapper over net/http that injects the vendor access token on every request, mirroring the Node SDK's HttpClient. |
|
Package identity validates Frontegg JWTs and access tokens, mirroring the Node SDK's IdentityClient and its token resolvers.
|
Package identity validates Frontegg JWTs and access tokens, mirroring the Node SDK's IdentityClient and its token resolvers. |
|
internal
|
|
|
logger
Package logger provides the SDK's pluggable logger, backed by log/slog.
|
Package logger provides the SDK's pluggable logger, backed by log/slog. |
|
retry
Package retry implements retry-with-jitter, mirroring the Node SDK's src/utils retry helper.
|
Package retry implements retry-with-jitter, mirroring the Node SDK's src/utils retry helper. |
|
Package middleware provides a net/http authentication guard, mirroring the Node SDK's Express withAuthentication middleware.
|
Package middleware provides a net/http authentication guard, mirroring the Node SDK's Express withAuthentication middleware. |