Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ProjectID (required, "") - used to validate and authenticate against descope services. ProjectID string // ManagementKey (optional, "") - used to provide a management key that's required // for using any of the Management APIs. If empty, this value is retrieved // from the DESCOPE_MANAGEMENT_KEY environement variable instead. If neither // values are set then any Management API call with fail. ManagementKey string // PublicKey (optional, "") - used to override or implicitly use a dedicated public key in order to decrypt and validate the JWT tokens // during ValidateSessionRequest(). If empty, will attempt to fetch all public keys from the specified project id. PublicKey string // DescopeBaseURL (optional, "https://api.descope.com") - override the default base URL used to communicate with descope services. DescopeBaseURL string // DefaultClient (optional, http.DefaultClient) - override the default client used to Do the actual http request. DefaultClient api.IHttpClient // CertificateVerifyMode (optional, CertificateVerifyAutomatic) - override the server certificate verification behavior when using the default client. CertificateVerify api.CertificateVerifyMode // RequestTimeout (optional, 60 seconds) - override the HTTP request timeout when using the default client. RequestTimeout time.Duration // CustomDefaultHeaders (optional, nil) - add custom headers to all requests used to communicate with descope services. CustomDefaultHeaders map[string]string // LogLevel (optional, LogNone) - set a log level (Debug/Info/None) for the sdk to use when logging. // Note that this attribute will be used to init a global logger once, in a goroutine safe manner LogLevel logger.LogLevel // LoggerInterface (optional, log.Default()) - set the logger instance to use for logging with the sdk. // Note that this attribute will be used to init a global logger once, in a goroutine safe manner Logger logger.LoggerInterface // State whether session jwt should be sent to client in cookie or let the calling function handle the transfer of the jwt, // defaults to leaving it for calling function, use cookie if session jwt will stay small (less than 1k) // session cookie can grow bigger, in case of using authorization, or adding custom claims SessionJWTViaCookie bool // When using cookies, set the cookie domain here. Alternatively this can be done via the Descope console. SessionJWTCookieDomain string // When using cookies, set the cookie same site here. Default is SameSiteStrictMode, In production make sure to use SameSiteStrictMode, for security purposes. SessionJWTCookieSameSite http.SameSite }
Conf - Configuration struct describes the configurational data for the authentication methods.
type DescopeClient ¶
type DescopeClient struct { // Provides functions for authenticating users, validating sessions, working with // permissions and roles, etc. Auth sdk.Authentication // Provides functions for managing a Descope project programmatically. A management key // must be provided in the Config object or by setting the DESCOPE_MANAGEMENT_KEY // environment variable. Management keys can be generated in the Descope console. Management sdk.Management // contains filtered or unexported fields }
DescopeClient - The main entry point for working with the Descope SDK.
func New ¶
func New() (*DescopeClient, error)
Creates a new DescopeClient object. The value for the Descope projectID must be set in the DESCOPE_PROJECT_ID environment variable.
func NewWithConfig ¶
func NewWithConfig(config *Config) (*DescopeClient, error)
Creates a new DescopeClient object with the provided Config object. The value for the Descope projectID should either be provided as a field in the Config parameter or set in the DESCOPE_PROJECT_ID environment variable.
Click to show internal directories.
Click to hide internal directories.