descope

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 9 Imported by: 15

Documentation

Index

Constants

View Source
const (
	MethodWhatsApp DeliveryMethod = "whatsapp"
	MethodSMS      DeliveryMethod = "sms"
	MethodVoice    DeliveryMethod = "voice"
	MethodEmail    DeliveryMethod = "email"
	MethodEmbedded DeliveryMethod = "Embedded"

	OAuthFacebook  OAuthProvider = "facebook"
	OAuthGithub    OAuthProvider = "github"
	OAuthGoogle    OAuthProvider = "google"
	OAuthMicrosoft OAuthProvider = "microsoft"
	OAuthGitlab    OAuthProvider = "gitlab"
	OAuthApple     OAuthProvider = "apple"
	OAuthSlack     OAuthProvider = "slack"
	OAuthDiscord   OAuthProvider = "discord"
	OAuthLinkedIn  OAuthProvider = "linkedin"

	ProjectEnvironmentNone       ProjectEnvironment = ""
	ProjectEnvironmentProduction ProjectEnvironment = "production"

	SessionCookieName = "DS"
	RefreshCookieName = "DSR"

	RedirectLocationCookieName = "Location"

	ContextUserIDProperty                       = "DESCOPE_USER_ID"
	ContextUserIDPropertyKey         ContextKey = ContextUserIDProperty
	ClaimAuthorizedTenants                      = "tenants"
	ClaimAuthorizedGlobalPermissions            = "permissions"
	ClaimDescopeCurrentTenant                   = "dct"

	EnvironmentVariableProjectID         = "DESCOPE_PROJECT_ID"
	EnvironmentVariablePublicKey         = "DESCOPE_PUBLIC_KEY"
	EnvironmentVariableManagementKey     = "DESCOPE_MANAGEMENT_KEY"
	EnvironmentVariableAuthManagementKey = "DESCOPE_AUTH_MANAGEMENT_KEY" // gitleaks:allow
	EnvironmentVariableBaseURL           = "DESCOPE_BASE_URL"
)

Variables

View Source
var (
	ErrBadRequest        = newServerError("E011001")
	ErrMissingArguments  = newServerError("E011002")
	ErrValidationFailure = newServerError("E011003")
	ErrInvalidArguments  = newServerError("E011004")

	ErrUserAlreadyExists         = newServerError("E062107")
	ErrInvalidOneTimeCode        = newServerError("E061102")
	ErrEnchantedLinkUnauthorized = newServerError("E062503")
	ErrPasswordExpired           = newServerError("E062909")
	ErrTokenExpiredByLoggedOut   = newServerError("E064001")
	ErrNOTPUnauthorized          = newServerError("E066103")

	ErrManagementUserNotFound = newServerError("E112102")

	ErrRateLimitExceeded = newServerError("E130429")

	ErrMissingProjectID = newClientError("G010001", "Missing project ID")

	ErrUnexpectedResponse = newClientError("G020001", "Unexpected server response")
	ErrInvalidResponse    = newClientError("G020002", "Invalid server response")

	ErrPublicKey        = newClientError("G030001", "Missing or invalid public key")
	ErrInvalidToken     = newClientError("G030002", "Invalid token")
	ErrRefreshToken     = newClientError("G030003", "Missing or invalid refresh token")
	ErrInvalidStepUpJWT = newClientError("G030004", "Refresh token must be provided for stepup actions")
)
View Source
var ErrorInfoKeys = errorInfoKeys{
	HTTPResponseStatusCode:      "Status-Code",
	RateLimitExceededRetryAfter: "Retry-After",
}

Additional information that might be available in the Error struct's Info map for specific errors

Functions

func IsBadRequestError added in v1.6.11

func IsBadRequestError(err error) bool

Returns whether an error value is a Descope server error with a 400 HTTP status code.

func IsError added in v1.6.11

func IsError(err error, errorCode ...string) bool

A convenience function for checking if a generic error value is a Descope error, and optionally also checking that it matches 1 or more specific error codes.

if descope.IsError(err, "E061103") {
  fmt.Println("Too many OTP attempts")
}

func IsForbidden added in v1.6.11

func IsForbidden(err error) bool

Returns whether an error value is a Descope server error with a 403 HTTP status code.

func IsNotFoundError added in v0.9.4

func IsNotFoundError(err error) bool

Returns whether an error value is a Descope server error with a 404 HTTP status code.

func IsUnauthorizedError added in v0.9.4

func IsUnauthorizedError(err error) bool

Returns whether an error value is a Descope server error with a 401 HTTP status code.

Types

type AccessKeyLoginOptions added in v1.6.3

type AccessKeyLoginOptions struct {
	CustomClaims   map[string]any `json:"customClaims,omitempty"`
	SelectedTenant string         `json:"selectedTenant,omitempty"`
}

type AccessKeyResponse added in v0.9.4

type AccessKeyResponse struct {
	ID               string              `json:"id,omitempty"`
	Name             string              `json:"name,omitempty"`
	RoleNames        []string            `json:"roleNames,omitempty"`
	KeyTenants       []*AssociatedTenant `json:"keyTenants,omitempty"`
	Status           string              `json:"status,omitempty"`
	CreatedTime      int32               `json:"createdTime,omitempty"`
	ExpireTime       int32               `json:"expireTime,omitempty"`
	CreatedBy        string              `json:"createdBy,omitempty"`
	ClientID         string              `json:"clientId,omitempty"`
	UserID           string              `json:"boundUserId,omitempty"`
	CustomClaims     map[string]any      `json:"customClaims,omitempty"`
	Description      string              `json:"description,omitempty"`
	PermittedIPs     []string            `json:"permittedIps,omitempty"`
	CustomAttributes map[string]any      `json:"customAttributes,omitempty"`
}

type AccessKeysSearchOptions added in v1.7.0

type AccessKeysSearchOptions struct {
	Sort             []UserSearchSort `json:"sort,omitempty"`
	TenantIDs        []string         `json:"tenantIds,omitempty"`
	BoundUserID      *string          `json:"boundUserId,omitempty"`
	CreatingUser     *string          `json:"creatingUser,omitempty"`
	CustomAttributes map[string]any   `json:"customAttributes,omitempty"`
}

type AccessType added in v1.6.14

type AccessType string
const AccessTypeOffline AccessType = "offline"
const AccessTypeOnline AccessType = "online"

type AnalyticRecord added in v1.6.14

type AnalyticRecord struct {
	ProjectID string    `json:"projectId,omitempty"`
	Action    string    `json:"action,omitempty"`
	Created   time.Time `json:"created,omitempty"`
	Device    string    `json:"device,omitempty"`
	Method    string    `json:"method,omitempty"`
	Geo       string    `json:"geo,omitempty"`
	Tenant    string    `json:"tenant,omitempty"`
	Referrer  string    `json:"referrer,omitempty"`
	Cnt       int       `json:"cnt,omitempty"`
}

type AnalyticsSearchOptions added in v1.6.14

type AnalyticsSearchOptions struct {
	Actions         []string  `json:"actions,omitempty"`         // List of actions to filter by
	ExcludedActions []string  `json:"excludedActions,omitempty"` // List of actions to exclude
	From            time.Time `json:"from,omitempty"`            // Retrieve analytics newer than given time. Limited to no older than 12 months.
	To              time.Time `json:"to,omitempty"`              // Retrieve records older than given time.
	Devices         []string  `json:"devices,omitempty"`         // List of devices to filter by. Current devices supported are "Bot"/"Mobile"/"Desktop"/"Tablet"/"Unknown"
	Methods         []string  `json:"methods,omitempty"`         // List of methods to filter by. Current auth methods are "otp"/"totp"/"magiclink"/"oauth"/"saml"/"password"
	Geos            []string  `json:"geos,omitempty"`            // List of geos to filter by. Geo is currently country code like "US", "IL", etc.
	Tenants         []string  `json:"tenants,omitempty"`         // List of tenants to filter by
	GroupByAction   bool      `json:"groupByAction"`             // Should we group summarized results by action
	GroupByDevice   bool      `json:"groupByDevice"`             // Should we group summarized results by device
	GroupByMethod   bool      `json:"groupByMethod"`             // Should we group summarized results by method
	GroupByGeo      bool      `json:"groupByGeo"`                // Should we group summarized results by geo
	GroupByTenant   bool      `json:"groupByTenant"`             // Should we group summarized results by tenant
	GroupByReferrer bool      `json:"groupByReferrer"`           // Should we group summarized results by referrer
	GroupByCreated  string    `json:"groupByCreated,omitempty"`  // How should we group the dates. Possible values are "h" for hour, "d" for day, "w" for week, "m" for month and "q" for quarter
}

AnalyticsSearchOptions to filter which analytics we should retrieve. All parameters are optional. `From` is currently limited up to 12 months

type AnonymousAuthenticationInfo added in v1.6.10

type AnonymousAuthenticationInfo struct {
	SessionToken *Token `json:"token,omitempty"`
	RefreshToken *Token `json:"refreshToken,omitempty"`
}

type AssociatedTenant added in v0.9.4

type AssociatedTenant struct {
	TenantID   string   `json:"tenantId"`
	TenantName string   `json:"tenantName"`
	Roles      []string `json:"roleNames,omitempty"`
}

Represents a tenant association for a User or an Access Key. The tenant ID is required to denote which tenant the user / access key belongs to. Roles is an optional list of roles for the user / access key in this specific tenant.

type AttributeMapping added in v0.9.4

type AttributeMapping struct {
	Name             string            `json:"name,omitempty"`
	GivenName        string            `json:"givenName,omitempty"`
	MiddleName       string            `json:"middleName,omitempty"`
	FamilyName       string            `json:"familyName,omitempty"`
	Picture          string            `json:"picture,omitempty"`
	Email            string            `json:"email,omitempty"`
	PhoneNumber      string            `json:"phoneNumber,omitempty"`
	Group            string            `json:"group,omitempty"`
	CustomAttributes map[string]string `json:"customAttributes,omitempty"`
}

Represents a SAML mapping between Descope and IDP user attributes

type AuditCreateOptions added in v1.6.4

type AuditCreateOptions struct {
	UserID   string         `json:"userId,omitempty"`
	Action   string         `json:"action,omitempty"`
	Type     string         `json:"type,omitempty"` // info/warn/error
	ActorID  string         `json:"actorId,omitempty"`
	Data     map[string]any `json:"data,omitempty"`
	TenantID string         `json:"tenantId,omitempty"`
}

type AuditFilters added in v1.6.15

type AuditFilters struct {
	FilterType FilterType `json:"filterType,omitempty"`
	Operator   Operator   `json:"operator,omitempty"`
	Values     []string   `json:"values,omitempty"`
}

type AuditRecord added in v1.5.3

type AuditRecord struct {
	ProjectID     string    `json:"projectId,omitempty"`
	UserID        string    `json:"userId,omitempty"`
	Action        string    `json:"action,omitempty"`
	Type          string    `json:"type,omitempty"`
	ActorID       string    `json:"actorId,omitempty"`
	Occurred      time.Time `json:"occurred,omitempty"`
	Device        string    `json:"device,omitempty"`
	Method        string    `json:"method,omitempty"`
	Geo           string    `json:"geo,omitempty"`
	RemoteAddress string    `json:"remoteAddress,omitempty"`
	LoginIDs      []string  `json:"loginIds,omitempty"`
	Tenants       []string
	Data          map[string]any `json:"data,omitempty"`
}

type AuditSearchOptions added in v1.5.3

type AuditSearchOptions struct {
	UserIDs         []string  `json:"userIds,omitempty"`         // List of user IDs to filter by
	Actions         []string  `json:"actions,omitempty"`         // List of actions to filter by
	ExcludedActions []string  `json:"excludedActions,omitempty"` // List of actions to exclude
	From            time.Time `json:"from,omitempty"`            // Retrieve records newer than given time. Limited to no older than 30 days.
	To              time.Time `json:"to,omitempty"`              // Retrieve records older than given time.
	Devices         []string  `json:"devices,omitempty"`         // List of devices to filter by. Current devices supported are "Bot"/"Mobile"/"Desktop"/"Tablet"/"Unknown"
	Methods         []string  `json:"methods,omitempty"`         // List of methods to filter by. Current auth methods are "otp"/"totp"/"magiclink"/"oauth"/"saml"/"password"
	Geos            []string  `json:"geos,omitempty"`            // List of geos to filter by. Geo is currently country code like "US", "IL", etc.
	RemoteAddresses []string  `json:"remoteAddresses,omitempty"` // List of remote addresses to filter by
	LoginIDs        []string  `json:"loginIds,omitempty"`        // List of login IDs to filter by
	Tenants         []string  `json:"tenants,omitempty"`         // List of tenants to filter by
	NoTenants       bool      `json:"noTenants"`                 // Should audits without any tenants always be included
	Text            string    `json:"text,omitempty"`            // Free text search across all fields
	Limit           int32     `json:"limit,omitempty"`           // Number of results to include per retrieved page. Current default, and max value, is 1000
	Page            int32     `json:"page,omitempty"`            // Page number of results to retrieve, zero-based. Default is 0.
}

AuditSearchOptions to filter which audits we should retrieve. All parameters are optional. `From` is currently limited to 30 days

type AuditWebhook added in v1.6.15

type AuditWebhook struct {
	Name           string                       `json:"name,omitempty"`
	Description    string                       `json:"description,omitempty"`
	URL            string                       `json:"url,omitempty"`
	Authentication *ConnectorHTTPAuthentication `json:"authentication,omitempty"`
	HmacSecret     string                       `json:"hmacSecret,omitempty"`
	Headers        map[string]string            `json:"headers,omitempty"`
	Insecure       bool                         `json:"insecure,omitempty"`
	Filters        []*AuditFilters              `json:"filters,omitempty"`
}

type AuthFactor added in v0.9.4

type AuthFactor string
const (
	AuthFactorUnknown  AuthFactor = ""
	AuthFactorEmail    AuthFactor = "email"
	AuthFactorPhone    AuthFactor = "sms"
	AuthFactorSaml     AuthFactor = "fed"
	AuthFactorOAuth    AuthFactor = "oauth"
	AuthFactorWebauthn AuthFactor = "webauthn"
	AuthFactorTOTP     AuthFactor = "totp"
	AuthFactorMFA      AuthFactor = "mfa"
	AuthFactorPassword AuthFactor = "pwd"
)

type AuthenticationInfo added in v0.9.4

type AuthenticationInfo struct {
	SessionToken *Token        `json:"token,omitempty"`
	RefreshToken *Token        `json:"refreshToken,omitempty"`
	User         *UserResponse `json:"user,omitempty"`
	FirstSeen    bool          `json:"firstSeen,omitempty"`
}

func NewAuthenticationInfo added in v0.9.4

func NewAuthenticationInfo(jRes *JWTResponse, sessionToken, refreshToken *Token) *AuthenticationInfo

type AuthzModified added in v1.6.1

type AuthzModified struct {
	Resources     []string `json:"resources"`
	Targets       []string `json:"targets"`
	SchemaChanged bool     `json:"schemaChanged"`
}

AuthzModified resources and targets since given timestamp

type AuthzNamespace added in v1.5.7

type AuthzNamespace struct {
	Name                string                     `json:"name"`
	RelationDefinitions []*AuthzRelationDefinition `json:"relationDefinitions"`
}

AuthzNamespace defines an entity in the authorization schema

type AuthzNode added in v1.5.7

type AuthzNode struct {
	NType      AuthzNodeType        `json:"nType"`
	Children   []*AuthzNode         `json:"children,omitempty"`
	Expression *AuthzNodeExpression `json:"expression,omitempty"`
}

AuthzNode holds the definition of a complex relation definition

type AuthzNodeExpression added in v1.5.7

type AuthzNodeExpression struct {
	NEType                            AuthzNodeExpressionType `json:"neType"`
	RelationDefinition                string                  `json:"relationDefinition,omitempty"`
	RelationDefinitionNamespace       string                  `json:"relationDefinitionNamespace,omitempty"`
	TargetRelationDefinition          string                  `json:"targetRelationDefinition,omitempty"`
	TargetRelationDefinitionNamespace string                  `json:"targetRelationDefinitionNamespace,omitempty"`
}

AuthzNodeExpression holds the definition of a child node

type AuthzNodeExpressionType added in v1.5.7

type AuthzNodeExpressionType string
const (
	AuthzNodeExpressionTypeSelf          AuthzNodeExpressionType = "self"
	AuthzNodeExpressionTypeTargetSet     AuthzNodeExpressionType = "targetSet"
	AuthzNodeExpressionTypeRelationLeft  AuthzNodeExpressionType = "relationLeft"
	AuthzNodeExpressionTypeRelationRight AuthzNodeExpressionType = "relationRight"
)

type AuthzNodeType added in v1.5.7

type AuthzNodeType string
const (
	AuthzNodeTypeChild     AuthzNodeType = "child"
	AuthzNodeTypeUnion     AuthzNodeType = "union"
	AuthzNodeTypeIntersect AuthzNodeType = "intersect"
	AuthzNodeTypeSub       AuthzNodeType = "sub"
)

type AuthzRelation added in v1.5.7

type AuthzRelation struct {
	Resource                             string          `json:"resource"`
	RelationDefinition                   string          `json:"relationDefinition"`
	Namespace                            string          `json:"namespace"`
	Target                               string          `json:"target,omitempty"`
	TargetSetResource                    string          `json:"targetSetResource,omitempty"`
	TargetSetRelationDefinition          string          `json:"targetSetRelationDefinition,omitempty"`
	TargetSetRelationDefinitionNamespace string          `json:"targetSetRelationDefinitionNamespace,omitempty"`
	Query                                *AuthzUserQuery `json:"query,omitempty"`
}

AuthzRelation defines a relation between resource and target

type AuthzRelationDefinition added in v1.5.7

type AuthzRelationDefinition struct {
	Name              string     `json:"name"`
	ComplexDefinition *AuthzNode `json:"complexDefinition,omitempty"`
}

AuthzRelationDefinition defines a relation within a namespace

type AuthzRelationQuery added in v1.5.7

type AuthzRelationQuery struct {
	Resource           string `json:"resource"`
	RelationDefinition string `json:"relationDefinition"`
	Namespace          string `json:"namespace"`
	Target             string `json:"target"`
	HasRelation        bool   `json:"hasRelation"`
}

AuthzRelationQuery queries the service if a given relation exists

type AuthzSchema added in v1.5.7

type AuthzSchema struct {
	Name       string            `json:"name,omitempty"`
	Namespaces []*AuthzNamespace `json:"namespaces"`
}

AuthzSchema holds the full schema (all namespaces) for a project

type AuthzUserQuery added in v1.5.7

type AuthzUserQuery struct {
	Tenants          []string       `json:"tenants,omitempty"`
	Roles            []string       `json:"roles,omitempty"`
	Text             string         `json:"text,omitempty"`
	Statuses         []UserStatus   `json:"userStatus,omitempty"`
	SSOOnly          bool           `json:"ssoOnly"`
	WithTestUser     bool           `json:"withTestUser,omitempty"`
	CustomAttributes map[string]any `json:"customAttributes,omitempty"`
}

AuthzUserQuery represents a target of a relation for ABAC (query on users)

type BatchUser added in v1.5.7

type BatchUser struct {
	LoginID     string             `json:"loginId,omitempty"`
	Password    *BatchUserPassword `json:"password,omitempty"`
	Seed        *string            `json:"seed,omitempty"`
	Status      UserStatus         `json:"status,omitempty"`
	UserRequest `json:",inline"`
}

type BatchUserPassword added in v1.5.7

type BatchUserPassword struct {
	Cleartext string
	Hashed    *BatchUserPasswordHashed
}

Set a cleartext or prehashed password for a new user (only one should be set).

type BatchUserPasswordArgon2 added in v1.6.11

type BatchUserPasswordArgon2 struct {
	Hash       []byte `json:"hash"`       // the hash in raw bytes (base64 strings should be decoded first)
	Salt       []byte `json:"salt"`       // the salt in raw bytes (base64 strings should be decoded first)
	Iterations int    `json:"iterations"` // the memory cost value (usually between 1 to 10)
	Memory     int    `json:"memory"`     // the memory cost value in kilobytes (usually between 1,000 to 1,000,000)
	Threads    int    `json:"threads"`    // the threads cost value (usually between 1 to 10)
}

type BatchUserPasswordBcrypt added in v1.6.1

type BatchUserPasswordBcrypt struct {
	Hash string `json:"hash"` // the bcrypt hash in plaintext format, for example "$2a$..."
}

type BatchUserPasswordDjango added in v1.6.1

type BatchUserPasswordDjango struct {
	Hash string `json:"hash"` // the django hash in plaintext format, for example "pbkdf2_sha256$..."
}

type BatchUserPasswordFirebase added in v1.6.1

type BatchUserPasswordFirebase struct {
	Hash          []byte `json:"hash"`          // the hash in raw bytes (base64 strings should be decoded first)
	Salt          []byte `json:"salt"`          // the salt in raw bytes (base64 strings should be decoded first)
	SaltSeparator []byte `json:"saltSeparator"` // the salt separator (usually 1 byte long)
	SignerKey     []byte `json:"signerKey"`     // the signer key (base64 strings should be decoded first)
	Memory        int    `json:"memory"`        // the memory cost value (usually between 12 to 17)
	Rounds        int    `json:"rounds"`        // the rounds cost value (usually between 6 to 10)
}

type BatchUserPasswordHashed added in v1.5.7

type BatchUserPasswordHashed struct {
	Bcrypt   *BatchUserPasswordBcrypt   `json:"bcrypt,omitempty"`
	Firebase *BatchUserPasswordFirebase `json:"firebase,omitempty"`
	Pbkdf2   *BatchUserPasswordPbkdf2   `json:"pbkdf2,omitempty"`
	Django   *BatchUserPasswordDjango   `json:"django,omitempty"`
	Phpass   *BatchUserPasswordPhpass   `json:"phpass,omitempty"`
	Md5      *BatchUserPasswordMd5      `json:"md5,omitempty"`
	Sha      *BatchUserPasswordSha      `json:"sha,omitempty"`
	Argon2   *BatchUserPasswordArgon2   `json:"argon2,omitempty"`
}

Set the kind of prehashed password for a user (only one should be set).

type BatchUserPasswordMd5 added in v1.6.8

type BatchUserPasswordMd5 struct {
	Hash string `json:"hash"` // the md5 hash in hex format, for example "68f724c9ad..."
}

type BatchUserPasswordPbkdf2 added in v1.6.1

type BatchUserPasswordPbkdf2 struct {
	Hash       []byte `json:"hash"`       // the hash in raw bytes (base64 strings should be decoded first)
	Salt       []byte `json:"salt"`       // the salt in raw bytes (base64 strings should be decoded first)
	Iterations int    `json:"iterations"` // the iterations cost value (usually in the thousands)
	Type       string `json:"type"`       // the hash name (sha1, sha256, sha512)
}

type BatchUserPasswordPhpass added in v1.6.4

type BatchUserPasswordPhpass struct {
	Hash       string `json:"hash"`       // the hash as base64 encoded string with . and / characters
	Salt       string `json:"salt"`       // the salt as base64 encoded string with . and / characters
	Iterations int    `json:"iterations"` // the iterations cost value (usually in the tens of thousands)
	Type       string `json:"type"`       // the hash name (md5, sha512)
}

type BatchUserPasswordSha added in v1.6.11

type BatchUserPasswordSha struct {
	Hash string `json:"hash"` // the SHA hash in hex format, for example "68f724c9ad..."
	Type string `json:"type"` // the type of SHA hash (sha1, sha256, sha512)
}

type CloneProjectResponse added in v1.6.1

type CloneProjectResponse struct {
	ProjectID   string   `json:"projectId"`
	ProjectName string   `json:"projectName"`
	Environment string   `json:"environment"`
	Tags        []string `json:"tags"`
}

type ConnectorHTTPAPIKeyAuthentication added in v1.6.15

type ConnectorHTTPAPIKeyAuthentication struct {
	Key   string `json:"key,omitempty"`
	Token string `json:"token,omitempty"`
}

type ConnectorHTTPAuthentication added in v1.6.15

type ConnectorHTTPAuthentication struct {
	BearerToken string                             `json:"bearerToken,omitempty"`
	Basic       *ConnectorHTTPBasicAuthentication  `json:"basic,omitempty"`
	APIKey      *ConnectorHTTPAPIKeyAuthentication `json:"apiKey,omitempty"`
}

type ConnectorHTTPBasicAuthentication added in v1.6.15

type ConnectorHTTPBasicAuthentication struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type ContextKey added in v0.9.4

type ContextKey string

type CreateOutboundAppRequest added in v1.6.14

type CreateOutboundAppRequest struct {
	OutboundApp
	ClientSecret string `json:"clientSecret,omitempty"`
}

type DeliveryMethod added in v0.9.4

type DeliveryMethod string

type Descoper added in v1.6.22

type Descoper struct {
	ID         string              `json:"id,omitempty"`
	LoginIDs   []string            `json:"loginIDs,omitempty"`
	Attributes *DescoperAttributes `json:"attributes,omitempty"`
	ReBac      *DescoperRBAC       `json:"rbac,omitempty"`
	Status     string              `json:"status,omitempty"`
}

type DescoperAttributes added in v1.6.22

type DescoperAttributes struct {
	DisplayName string `json:"displayName,omitempty"`
	Email       string `json:"email,omitempty"`
	Phone       string `json:"phone,omitempty"`
}

type DescoperCreate added in v1.6.22

type DescoperCreate struct {
	LoginID    string              `json:"loginId,omitempty"`
	Attributes *DescoperAttributes `json:"attributes,omitempty"`
	SendInvite bool                `json:"sendInvite,omitempty"`
	ReBac      *DescoperRBAC       `json:"rbac,omitempty"`
}

type DescoperLoadOptions added in v1.6.22

type DescoperLoadOptions struct {
}

type DescoperProjectRole added in v1.6.22

type DescoperProjectRole struct {
	ProjectIDs []string     `json:"projectIds,omitempty"`
	Role       DescoperRole `json:"role,omitempty"`
}

type DescoperRBAC added in v1.6.22

type DescoperRBAC struct {
	IsCompanyAdmin bool                   `json:"isCompanyAdmin,omitempty"`
	Tags           []*DescoperTagRole     `json:"tags,omitempty"`
	Projects       []*DescoperProjectRole `json:"projects,omitempty"`
}

type DescoperRole added in v1.6.22

type DescoperRole string
const (
	DescoperRoleAdmin     DescoperRole = "admin"
	DescoperRoleDeveloper DescoperRole = "developer"
	DescoperRoleSupport   DescoperRole = "support"
	DescoperRoleAuditor   DescoperRole = "auditor"
)

type DescoperTagRole added in v1.6.22

type DescoperTagRole struct {
	Tags []string     `json:"tags,omitempty"`
	Role DescoperRole `json:"role,omitempty"`
}

type EmbeddedLinkLoginOptions added in v1.6.13

type EmbeddedLinkLoginOptions struct {
	LoginOptions
	Timeout int64 `json:"timeout,omitempty"` // timeout in seconds for the embedded link to be valid, default is 60 seconds
}

type EnchantedLinkResponse added in v0.9.4

type EnchantedLinkResponse struct {
	PendingRef  string `json:"pendingRef,omitempty"`  // Pending referral code used to poll enchanted link authentication status
	LinkID      string `json:"linkId,omitempty"`      // Link id, on which link the user should click
	MaskedEmail string `json:"maskedEmail,omitempty"` // Masked email to which the email was sent
}

type Error added in v0.9.4

type Error struct {
	// A non-empty code for the specific error condition
	Code string `json:"errorCode,omitempty"`

	// A non-empty description of the error condition.
	Description string `json:"errorDescription,omitempty"`

	// An optional message with more specific details about the error.
	Message string `json:"errorMessage,omitempty"`

	// An optional map with additional metadata about the error.
	Info map[string]any `json:"-"`
}

The type of error returned by the Descope SDK in most circumstances.

func AsError added in v1.6.11

func AsError(err error, errorCode ...string) *Error

A convenience function for checking if a generic error value is a Descope error, and optionally also checking that it matches 1 or more specific error codes, in which case it returns the error value as a *descope.Error, otherwise it returns nil.

if err := descope.AsError(err, "E061103") {
  fmt.Printf("The operation failed: %v", err)
}

func (*Error) Error added in v0.9.4

func (e *Error) Error() string

Returns a string representation of this Descope error, including all of its field. For a user friendly error message use the value of the Description field.

func (*Error) Is added in v0.9.4

func (e *Error) Is(err error) bool

Returns whether the error value matches this Descope error.

func (*Error) IsBadRequest added in v1.6.11

func (e *Error) IsBadRequest() bool

Returns whether this is a server error with a 400 HTTP status code.

func (*Error) IsForbidden added in v1.6.11

func (e *Error) IsForbidden() bool

Returns whether this is a server error with a 403 HTTP status code.

func (*Error) IsNotFound added in v0.9.4

func (e *Error) IsNotFound() bool

Returns whether this is a server error with a 404 HTTP status code.

func (*Error) IsUnauthorized added in v0.9.4

func (e *Error) IsUnauthorized() bool

Returns whether this is a server error with a 401 HTTP status code.

func (Error) WithInfo added in v0.9.4

func (e Error) WithInfo(key string, value any) *Error

Returns a new Error instance with a new value for the Info field.

func (Error) WithMessage added in v0.9.4

func (e Error) WithMessage(format string, args ...any) *Error

Returns a new Error instance with a new value for the Message field.

type ExportSnapshotRequest added in v1.6.10

type ExportSnapshotRequest struct {
	// An optional string to set the output format (leave empty for default)
	Format string `json:"format"`
}

type ExportSnapshotResponse added in v1.6.3

type ExportSnapshotResponse struct {
	// All project settings and configurations represented as JSON files
	Files map[string]any `json:"files"`
}

type FGACheck added in v1.6.8

type FGACheck struct {
	Allowed  bool          `json:"allowed"`
	Relation *FGARelation  `json:"relation"`
	Info     *FGACheckInfo `json:"info"`
}

FGACheck holds the result of a check

type FGACheckInfo added in v1.6.10

type FGACheckInfo struct {
	// A relation is considered "direct" if, based solely on the schema, its "allowed" state can only be
	// changed by creating or deleting relations involving its resource, its target, or both (including itself)
	Direct bool `json:"direct,omitempty"`
}

type FGAGroupMapping added in v1.6.12

type FGAGroupMapping struct {
	Relations []*FGAGroupMappingRelation `json:"relations,omitempty"`
}

type FGAGroupMappingRelation added in v1.6.12

type FGAGroupMappingRelation struct {
	Resource           string `json:"resource,omitempty"`
	RelationDefinition string `json:"relationDefinition,omitempty"`
	Namespace          string `json:"namespace,omitempty"`
}

type FGAMappableResource added in v1.6.12

type FGAMappableResource struct {
	Resource string `json:"resource"`
}

type FGAMappableResources added in v1.6.12

type FGAMappableResources struct {
	Type      string                 `json:"type"`
	Resources []*FGAMappableResource `json:"resources"`
}

type FGAMappableResourcesOptions added in v1.6.12

type FGAMappableResourcesOptions struct {
	ResourcesLimit int32
}

type FGAMappableResourcesQuery added in v1.6.12

type FGAMappableResourcesQuery struct {
	Type    string   `json:"type"`
	Queries []string `json:"queries"`
}

type FGAMappableSchema added in v1.6.12

type FGAMappableSchema struct {
	Schema            *AuthzSchema            `json:"schema,omitempty"`
	MappableResources []*FGAMappableResources `json:"mappableResources,omitempty"`
}

type FGARelation added in v1.6.8

type FGARelation struct {
	Resource     string `json:"resource"`
	ResourceType string `json:"resourceType"`
	Relation     string `json:"relation"`
	Target       string `json:"target"`
	TargetType   string `json:"targetType"`
}

FGARelation defines a relation between resource and target

type FGASchema added in v1.6.8

type FGASchema struct {
	Schema string `json:"schema"`
}

FGASchema holds the schema for a project

type FGASchemaDryDeletes added in v1.6.15

type FGASchemaDryDeletes struct {
	HasDeletes bool     `json:"hasDeletes"`
	Relations  []string `json:"relations,omitempty"`
	Types      []string `json:"types,omitempty"`
}

type FGASchemaDryRunResponse added in v1.6.15

type FGASchemaDryRunResponse struct {
	DeletesPreview *FGASchemaDryDeletes `json:"deletesPreview,omitempty"`
}

type FetchOutboundAppUserTokenRequest added in v1.6.23

type FetchOutboundAppUserTokenRequest struct {
	AppID    string                       `json:"appId"`
	UserID   string                       `json:"userId"`
	Scopes   []string                     `json:"scopes"`
	Options  *OutboundAppUserTokenOptions `json:"options,omitempty"`
	TenantID string                       `json:"tenantId,omitempty"`
}

FetchOutboundAppUserTokenRequest represents a request to fetch an outbound app user token

type FetchOutboundAppUserTokenResponse added in v1.6.23

type FetchOutboundAppUserTokenResponse struct {
	Token *OutboundAppUserToken `json:"token"`
}

FetchOutboundAppUserTokenResponse represents the response from fetching a user token

type FilterType added in v1.6.15

type FilterType string
const FilterTypeActions FilterType = "actions"
const FilterTypeAll FilterType = "all"
const FilterTypeTenants FilterType = "tenants"

type FlowList added in v1.6.8

type FlowList struct {
	Flows []*FlowListEnty `json:"flows"`
}

type FlowListEnty added in v1.6.8

type FlowListEnty struct {
	FlowID      string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Disabled    bool   `json:"disabled,omitempty"`
}

type GenerateSSOConfigurationLinkResponse added in v1.6.6

type GenerateSSOConfigurationLinkResponse struct {
	AdminSSOConfigurationLink string `json:"adminSSOConfigurationLink,omitempty"`
}

type Group added in v0.9.4

type Group struct {
	ID      string        `json:"id"`
	Display string        `json:"display,omitempty"`
	Members []GroupMember `json:"members,omitempty"`
}

type GroupMember added in v0.9.4

type GroupMember struct {
	LoginID string `json:"loginID,omitempty"`
	UserID  string `json:"userId,omitempty"`
	Display string `json:"display,omitempty"`
}

type GroupsMapping added in v1.5.0

type GroupsMapping struct {
	Role   *RoleItem `json:"role,omitempty"`
	Groups []string  `json:"groups,omitempty"`
}

type ImportSnapshotRequest added in v1.6.3

type ImportSnapshotRequest struct {
	// All project settings and configurations represented as JSON files
	Files map[string]any `json:"files"`
	// An optional map of project entities and their secrets that will be
	// injected into the snapshot before import (see below)
	InputSecrets *SnapshotSecrets `json:"inputSecrets,omitempty"`
}

type InviteOptions added in v1.5.6

type InviteOptions struct {
	InviteURL       string            `json:"inviteUrl,omitempty"`
	SendMail        *bool             `json:"sendMail,omitempty"`        // send invite via mail, default is according to project settings
	SendSMS         *bool             `json:"sendSMS,omitempty"`         // send invite via text message, default is according to project settings
	TemplateOptions map[string]string `json:"templateOptions,omitempty"` // for providing messaging template options (templates that are being sent via email / text message)
	TemplateID      string            `json:"-"`
}

type IssuerSettings added in v1.6.14

type IssuerSettings struct {
	JWKsURI             string `json:"jwksUri,omitempty"`
	SignAlgorithm       string `json:"signAlgorithm,omitempty"`
	UserInfoURI         string `json:"userInfoUri,omitempty"`
	ExternalIDFieldName string `json:"externalIdFieldName,omitempty"`
}

type JWTBearerSettings added in v1.6.14

type JWTBearerSettings struct {
	Issuers map[string]*IssuerSettings `json:"issuers,omitempty"`
}

type JWTResponse added in v0.9.4

type JWTResponse struct {
	SessionJwt       string        `json:"sessionJwt,omitempty"`
	RefreshJwt       string        `json:"refreshJwt,omitempty"`
	CookieDomain     string        `json:"cookieDomain,omitempty"`
	CookiePath       string        `json:"cookiePath,omitempty"`
	CookieMaxAge     int32         `json:"cookieMaxAge,omitempty"`
	CookieExpiration int32         `json:"cookieExpiration,omitempty"`
	User             *UserResponse `json:"user,omitempty"`
	FirstSeen        bool          `json:"firstSeen,omitempty"`
}

type LoginOptions added in v0.9.4

type LoginOptions struct {
	Stepup                   bool              `json:"stepup,omitempty"`
	MFA                      bool              `json:"mfa,omitempty"`
	RevokeOtherSessions      bool              `json:"revokeOtherSessions,omitempty"`
	RevokeOtherSessionsTypes []string          `json:"revokeOtherSessionsTypes,omitempty"`
	CustomClaims             map[string]any    `json:"customClaims,omitempty"`
	TemplateID               string            `json:"templateId,omitempty"`      // for overriding the default messaging template
	TemplateOptions          map[string]string `json:"templateOptions,omitempty"` // for providing messaging template options (templates that are being sent via email / text message)
}

func (*LoginOptions) IsJWTRequired added in v0.9.4

func (lo *LoginOptions) IsJWTRequired() bool

type MeTenant added in v1.6.7

type MeTenant struct {
	ID               string         `json:"id"`
	Name             string         `json:"name"`
	CustomAttributes map[string]any `json:"customAttributes,omitempty"`
}

type MgmLoginOptions added in v1.6.10

type MgmLoginOptions struct {
	Stepup                   bool           `json:"stepup,omitempty"`
	MFA                      bool           `json:"mfa,omitempty"`
	RevokeOtherSessions      bool           `json:"revokeOtherSessions,omitempty"`
	RevokeOtherSessionsTypes []string       `json:"revokeOtherSessionsTypes,omitempty"`
	CustomClaims             map[string]any `json:"customClaims,omitempty"`
	JWT                      string         `json:"jwt,omitempty"`
	RefreshDuration          int32          `json:"refreshDuration,omitempty"`
}

func (*MgmLoginOptions) IsJWTRequired added in v1.6.10

func (mlo *MgmLoginOptions) IsJWTRequired() bool

type MgmSignUpOptions added in v1.6.10

type MgmSignUpOptions struct {
	CustomClaims    map[string]any `json:"customClaims,omitempty"`
	RefreshDuration int32          `json:"refreshDuration,omitempty"`
}

type MgmtFlowOptions added in v1.6.14

type MgmtFlowOptions struct {
	Input   map[string]any `json:"input,omitempty"`
	Preview bool           `json:"preview,omitempty"`
	Tenant  string         `json:"tenant,omitempty"`
}

type MgmtKey added in v1.6.22

type MgmtKey struct {
	ID           string        `json:"id,omitempty"`
	Name         string        `json:"name,omitempty"`
	Description  string        `json:"description,omitempty"`
	Status       MgmtKeyStatus `json:"status,omitempty"`
	CreatedTime  int64         `json:"createdTime,omitempty"`
	ExpireTime   int64         `json:"expireTime,omitempty"`
	PermittedIPs []string      `json:"permittedIps,omitempty"`
	ReBac        *MgmtKeyReBac `json:"reBac,omitempty"`
	Version      int64         `json:"version,omitempty"`
	AuthzVersion int64         `json:"authzVersion,omitempty"`
}

type MgmtKeyProjectRole added in v1.6.22

type MgmtKeyProjectRole struct {
	ProjectIDs []string `json:"projectIds,omitempty"`
	Roles      []string `json:"roles,omitempty"`
}

type MgmtKeyReBac added in v1.6.22

type MgmtKeyReBac struct {
	CompanyRoles []string              `json:"companyRoles,omitempty"`
	ProjectRoles []*MgmtKeyProjectRole `json:"projectRoles,omitempty"`
	TagRoles     []*MgmtKeyTagRole     `json:"tagRoles,omitempty"`
}

type MgmtKeySearchOptions added in v1.6.22

type MgmtKeySearchOptions struct {
}

type MgmtKeyStatus added in v1.6.22

type MgmtKeyStatus string
const (
	MgmtKeyActive   MgmtKeyStatus = "active"
	MgmtKeyInactive MgmtKeyStatus = "inactive"
)

type MgmtKeyTagRole added in v1.6.22

type MgmtKeyTagRole struct {
	Tags  []string `json:"tags,omitempty"`
	Roles []string `json:"roles,omitempty"`
}

type MgmtUserRequest added in v1.6.10

type MgmtUserRequest struct {
	User          `json:",inline"`
	EmailVerified bool   `json:"emailVerified"`
	PhoneVerified bool   `json:"phoneVerified"`
	SsoAppID      string `json:"ssoAppId"`
}

type NOTPResponse added in v1.6.5

type NOTPResponse struct {
	RedirectURL string `json:"redirectUrl,omitempty"`
	Image       string `json:"image,omitempty"`
	PendingRef  string `json:"pendingRef,omitempty"` // Pending referral code used to poll the authentication info
}

type NOTPTemplates added in v1.6.14

type NOTPTemplates struct {
	VerifyTemplateID  string `json:"verifyTemplateId,omitempty"`
	SuccessTemplateID string `json:"successTemplateId,omitempty"`
	ErrorTemplateID   string `json:"errorTemplateId,omitempty"`
}

type NOTPUpdateOptions added in v1.6.14

type NOTPUpdateOptions struct {
	AddToLoginIDs      bool              `json:"addToLoginIDs,omitempty"`
	OnMergeUseExisting bool              `json:"onMergeUseExisting,omitempty"`
	TemplateOptions    map[string]string `json:"templateOptions,omitempty"` // for providing messaging template options (templates that are being sent via email / text message)
	ProviderID         string            `json:"providerId,omitempty"`
	Templates          *NOTPTemplates    `json:"templates,omitempty"`
	Locale             string            `json:"locale,omitempty"` // locale for the message
}

type OAuthProvider added in v0.9.4

type OAuthProvider string

type OIDCApplicationRequest added in v1.6.1

type OIDCApplicationRequest struct {
	ID                   string             `json:"id"`
	Name                 string             `json:"name"`
	Description          string             `json:"description"`
	Enabled              bool               `json:"enabled"`
	LoginPageURL         string             `json:"loginPageUrl"`
	ForceAuthentication  bool               `json:"forceAuthentication"`
	JWTBearerSettings    *JWTBearerSettings `json:"jwtBearerSettings,omitempty"`
	BackChannelLogoutURL string             `json:"backChannelLogoutUrl,omitempty"`
}

type OIDCAttributeMapping added in v1.6.1

type OIDCAttributeMapping struct {
	LoginID       string `json:"loginId,omitempty"`
	Name          string `json:"name,omitempty"`
	GivenName     string `json:"givenName,omitempty"`
	MiddleName    string `json:"middleName,omitempty"`
	FamilyName    string `json:"familyName,omitempty"`
	Email         string `json:"email,omitempty"`
	VerifiedEmail string `json:"verifiedEmail,omitempty"`
	Username      string `json:"username,omitempty"`
	PhoneNumber   string `json:"phoneNumber,omitempty"`
	VerifiedPhone string `json:"verifiedPhone,omitempty"`
	Picture       string `json:"picture,omitempty"`
}

type Operator added in v1.6.15

type Operator string
const OperatorExcludes Operator = "excludes"
const OperatorIncludes Operator = "includes"

type OutboundApp added in v1.6.14

type OutboundApp struct {
	ID                     string       `json:"id,omitempty"`
	Name                   string       `json:"name,omitempty"`
	Description            string       `json:"description,omitempty"`
	TemplateID             string       `json:"templateId,omitempty"`
	ClientID               string       `json:"clientId,omitempty"`
	DiscoveryURL           string       `json:"discoveryUrl,omitempty"`
	AuthorizationURL       string       `json:"authorizationUrl,omitempty"`
	AuthorizationURLParams []URLParam   `json:"authorizationUrlParams,omitempty"`
	TokenURL               string       `json:"tokenUrl,omitempty"`
	TokenURLParams         []URLParam   `json:"tokenUrlParams,omitempty"`
	RevocationURL          string       `json:"revocationUrl,omitempty"`
	DefaultScopes          []string     `json:"defaultScopes,omitempty"`
	DefaultRedirectURL     string       `json:"defaultRedirectUrl,omitempty"`
	CallbackDomain         string       `json:"callbackDomain,omitempty"`
	Pkce                   bool         `json:"pkce,omitempty"`
	AccessType             AccessType   `json:"accessType,omitempty"`
	Prompt                 []PromptType `json:"prompt,omitempty"`
}

type OutboundAppUserToken added in v1.6.23

type OutboundAppUserToken struct {
	ID                string   `json:"id"`
	AppID             string   `json:"appId"`
	UserID            string   `json:"userId"`
	TokenSub          string   `json:"tokenSub"`
	AccessToken       string   `json:"accessToken"`
	AccessTokenType   string   `json:"accessTokenType"`
	AccessTokenExpiry string   `json:"accessTokenExpiry"`
	HasRefreshToken   bool     `json:"hasRefreshToken"`
	RefreshToken      string   `json:"refreshToken,omitempty"`
	LastRefreshTime   string   `json:"lastRefreshTime,omitempty"`
	LastRefreshError  string   `json:"lastRefreshError,omitempty"`
	Scopes            []string `json:"scopes"`
	TenantID          string   `json:"tenantId,omitempty"`
	GrantedBy         string   `json:"grantedBy,omitempty"`
}

OutboundAppUserToken represents an outbound app user token

type OutboundAppUserTokenOptions added in v1.6.23

type OutboundAppUserTokenOptions struct {
	WithRefreshToken bool `json:"withRefreshToken,omitempty"`
	ForceRefresh     bool `json:"forceRefresh,omitempty"`
}

OutboundAppUserTokenOptions represents options for fetching a user token

type PasswordPolicy added in v1.1.0

type PasswordPolicy struct {
	MinLength       int32 `json:"minLength,omitempty"`
	Lowercase       bool  `json:"lowercase,omitempty"`
	Uppercase       bool  `json:"uppercase,omitempty"`
	Number          bool  `json:"number,omitempty"`
	NonAlphanumeric bool  `json:"nonAlphanumeric,omitempty"`
}

PasswordPolicy - represents the rules for valid passwords configured in the policy in the Descope console. This can be used to implement client-side validation of new user passwords for a better user experience. Either way, the comprehensive policy is always enforced by Descope on the server side.

type PasswordSettings added in v1.6.1

type PasswordSettings struct {
	Enabled         bool  `json:"enabled,omitempty"`
	MinLength       int32 `json:"minLength,omitempty"`
	Lowercase       bool  `json:"lowercase,omitempty"`
	Uppercase       bool  `json:"uppercase,omitempty"`
	Number          bool  `json:"number,omitempty"`
	NonAlphanumeric bool  `json:"nonAlphanumeric,omitempty"`
	Expiration      bool  `json:"expiration,omitempty"`
	ExpirationWeeks int32 `json:"expirationWeeks,omitempty"`
	Reuse           bool  `json:"reuse,omitempty"`
	ReuseAmount     int32 `json:"reuseAmount,omitempty"`
	Lock            bool  `json:"lock,omitempty"`
	LockAttempts    int32 `json:"lockAttempts,omitempty"`
}

type PatchUserBatchRequest added in v1.6.19

type PatchUserBatchRequest struct {
	LoginID           string `json:"loginId,omitempty"`
	*PatchUserRequest `json:",inline"`
}

type PatchUserRequest added in v1.6.5

type PatchUserRequest struct {
	Name             *string              `json:"name,omitempty"`
	GivenName        *string              `json:"givenName,omitempty"`
	MiddleName       *string              `json:"middleName,omitempty"`
	FamilyName       *string              `json:"familyName,omitempty"`
	Phone            *string              `json:"phone,omitempty"`
	Email            *string              `json:"email,omitempty"`
	Roles            *[]string            `json:"roles,omitempty"`
	Tenants          *[]*AssociatedTenant `json:"tenants,omitempty"`
	CustomAttributes map[string]any       `json:"customAttributes,omitempty"`
	Picture          *string              `json:"picture,omitempty"`
	VerifiedEmail    *bool                `json:"verifiedEmail,omitempty"`
	VerifiedPhone    *bool                `json:"verifiedPhone,omitempty"`
	SSOAppIDs        *[]string            `json:"ssoAppIds,omitempty"`
	SCIM             *bool                `json:"scim,omitempty"`
	Status           *UserStatus          `json:"status,omitempty"`
}

type Permission added in v0.9.4

type Permission struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type Project added in v1.6.5

type Project struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Environment string   `json:"environment"`
	Tags        []string `json:"tags"`
}

type ProjectEnvironment added in v1.6.6

type ProjectEnvironment string

type PromptType added in v1.6.14

type PromptType string
const PromptTypeConsent PromptType = "consent"
const PromptTypeLogin PromptType = "login"
const PromptTypeNone PromptType = "none"
const PromptTypeSelectAccount PromptType = "select_account"

type ProviderTokenOptions added in v1.6.6

type ProviderTokenOptions struct {
	WithRefreshToken bool `json:"withRefreshToken,omitempty"`
	ForceRefresh     bool `json:"forceRefresh,omitempty"`
}

type ProviderTokenResponse added in v1.5.3

type ProviderTokenResponse struct {
	Provider       string   `json:"provider,omitempty"`
	ProviderUserID string   `json:"providerUserID,omitempty"`
	AccessToken    string   `json:"accessToken,omitempty"`
	Expiration     uint32   `json:"expiration,omitempty"`
	Scopes         []string `json:"scopes,omitempty"`
	RefreshToken   string   `json:"refreshToken,omitempty"`
}

type RecalculateSSOMappingsRequest added in v1.7.0

type RecalculateSSOMappingsRequest struct {
	TenantID string `json:"tenantId,omitempty"`
	SSOID    string `json:"ssoId,omitempty"`
}

type ResourceDetails added in v1.6.12

type ResourceDetails struct {
	ResourceID   string `json:"resourceId"`
	ResourceType string `json:"resourceType"`
	DisplayName  string `json:"displayName"`
}

type ResourceIdentifier added in v1.6.12

type ResourceIdentifier struct {
	ResourceID   string `json:"resourceId"`
	ResourceType string `json:"resourceType"`
}

type Role added in v0.9.4

type Role struct {
	Name            string   `json:"name"`
	Description     string   `json:"description,omitempty"`
	PermissionNames []string `json:"permissionNames,omitempty"`
	CreatedTime     int32    `json:"createdTime,omitempty"`
	TenantID        string   `json:"tenantId,omitempty"`
	Default         bool     `json:"default,omitempty"`
	Private         bool     `json:"private,omitempty"`
}

func (*Role) GetCreatedTime added in v1.5.0

func (r *Role) GetCreatedTime() time.Time

type RoleInheritance added in v1.8.0

type RoleInheritance string
const RoleInheritanceDefault RoleInheritance = ""
const RoleInheritanceNone RoleInheritance = "none"
const RoleInheritanceUserOnly RoleInheritance = "userOnly"

type RoleItem added in v1.5.0

type RoleItem struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type RoleList added in v1.6.17

type RoleList struct {
	Values []string `json:"values,omitempty"`
	And    bool     `json:"and,omitempty"`
}

type RoleMapping added in v0.9.4

type RoleMapping struct {
	Groups []string
	Role   string
}

Represents a mapping between a set of groups of users and a role that will be assigned to them.

type RoleSearchOptions added in v1.6.3

type RoleSearchOptions struct {
	TenantIDs           []string `json:"tenantIds,omitempty"`
	RoleNames           []string `json:"roleNames,omitempty"`
	RoleNameLike        string   `json:"roleNameLike,omitempty"`
	PermissionNames     []string `json:"permissionNames,omitempty"`
	IncludeProjectRoles *bool    `json:"includeProjectRoles,omitempty"`
}

type SAMLApplicationRequest added in v1.6.1

type SAMLApplicationRequest struct {
	ID                  string                        `json:"id"`
	Name                string                        `json:"name"`
	Description         string                        `json:"description"`
	Enabled             bool                          `json:"enabled"`
	LoginPageURL        string                        `json:"loginPageUrl"`
	UseMetadataInfo     bool                          `json:"useMetadataInfo"`
	MetadataURL         string                        `json:"metadataUrl"`
	EntityID            string                        `json:"entityId"`
	AcsURL              string                        `json:"acsUrl"`
	Certificate         string                        `json:"certificate"`
	AttributeMapping    []SAMLIDPAttributeMappingInfo `json:"attributeMapping"`
	GroupsMapping       []SAMLIDPGroupsMappingInfo    `json:"groupsMapping"`
	AcsAllowedCallbacks []string                      `json:"acsAllowedCallbacks"`
	DefaultRelayState   string                        `json:"defaultRelayState"`
	SubjectNameIDType   string                        `json:"subjectNameIdType"`
	SubjectNameIDFormat string                        `json:"subjectNameIdFormat"`
	ForceAuthentication bool                          `json:"forceAuthentication"`
	LogoutRedirectURL   string                        `json:"logoutRedirectUrl"`
}

type SAMLIDPAttributeMappingInfo added in v1.6.1

type SAMLIDPAttributeMappingInfo struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type SAMLIDPGroupsMappingInfo added in v1.6.1

type SAMLIDPGroupsMappingInfo struct {
	Name       string                        `json:"name"`
	Type       string                        `json:"type"`
	FilterType string                        `json:"filterType"`
	Value      string                        `json:"value"`
	Roles      []SAMLIDPRoleGroupMappingInfo `json:"roles"`
}

type SAMLIDPRoleGroupMappingInfo added in v1.6.1

type SAMLIDPRoleGroupMappingInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SSOApplication added in v1.6.1

type SSOApplication struct {
	ID           string                      `json:"id"`
	Name         string                      `json:"name"`
	Description  string                      `json:"description"`
	Enabled      bool                        `json:"enabled"`
	AppType      string                      `json:"appType"`
	SAMLSettings *SSOApplicationSAMLSettings `json:"samlSettings"`
	OIDCSettings *SSOApplicationOIDCSettings `json:"oidcSettings"`
}

type SSOApplicationOIDCSettings added in v1.6.1

type SSOApplicationOIDCSettings struct {
	LoginPageURL         string             `json:"loginPageUrl"`
	Issuer               string             `json:"issuer"`
	DiscoveryURL         string             `json:"discoveryUrl"`
	ForceAuthentication  bool               `json:"forceAuthentication"`
	JWTBearerSettings    *JWTBearerSettings `json:"jwtBearerSettings,omitempty"`
	BackChannelLogoutURL string             `json:"backChannelLogoutUrl,omitempty"`
}

type SSOApplicationSAMLSettings added in v1.6.1

type SSOApplicationSAMLSettings struct {
	LoginPageURL        string                        `json:"loginPageUrl"`
	IdpCert             string                        `json:"idpCert"`
	UseMetadataInfo     bool                          `json:"useMetadataInfo"`
	MetadataURL         string                        `json:"metadataUrl"`
	EntityID            string                        `json:"entityId"`
	AcsURL              string                        `json:"acsUrl"`
	Certificate         string                        `json:"certificate"`
	AttributeMapping    []SAMLIDPAttributeMappingInfo `json:"attributeMapping"`
	GroupsMapping       []SAMLIDPGroupsMappingInfo    `json:"groupsMapping"`
	IdpMetadataURL      string                        `json:"idpMetadataUrl"`
	IdpEntityID         string                        `json:"idpEntityId"`
	IdpSSOURL           string                        `json:"idpSsoUrl"`
	AcsAllowedCallbacks []string                      `json:"acsAllowedCallbacks"`
	DefaultRelayState   string                        `json:"defaultRelayState"`
	IdpInitiatedURL     string                        `json:"idpInitiatedUrl"`
	SubjectNameIDType   string                        `json:"subjectNameIdType"`
	SubjectNameIDFormat string                        `json:"subjectNameIdFormat"`
	ForceAuthentication bool                          `json:"forceAuthentication"`
	IdpLogoutURL        string                        `json:"idpLogoutUrl"`
	LogoutRedirectURL   string                        `json:"logoutRedirectUrl"`
}

type SSOApplicationSearchOptions added in v1.6.1

type SSOApplicationSearchOptions struct {
	IDs     []string
	Names   []string
	AppType string
}

type SSOOIDCSettings added in v1.6.1

type SSOOIDCSettings struct {
	Name                 string                      `json:"name,omitempty"`
	ClientID             string                      `json:"clientId,omitempty"`
	ClientSecret         string                      `json:"clientSecret,omitempty"` // will be empty on response
	RedirectURL          string                      `json:"redirectUrl,omitempty"`
	AuthURL              string                      `json:"authUrl,omitempty"`
	TokenURL             string                      `json:"tokenUrl,omitempty"`
	UserDataURL          string                      `json:"userDataUrl,omitempty"`
	Scope                []string                    `json:"scope,omitempty"`
	JWKsURL              string                      `json:"JWKsUrl,omitempty"`
	AttributeMapping     *OIDCAttributeMapping       `json:"userAttrMapping,omitempty"`
	ManageProviderTokens bool                        `json:"manageProviderTokens,omitempty"`
	CallbackDomain       string                      `json:"callbackDomain,omitempty"`
	Prompt               []string                    `json:"prompt,omitempty"`
	GrantType            string                      `json:"grantType,omitempty"`
	Issuer               string                      `json:"issuer,omitempty"`
	GroupsMapping        []*GroupsMapping            `json:"groupsMapping,omitempty"`
	DefaultSSORoles      []string                    `json:"defaultSSORoles,omitempty"`
	GroupsPriority       []string                    `json:"groupsPriority,omitempty"` // list of group names in priority order (first = highest priority)
	FgaMappings          map[string]*FGAGroupMapping `json:"fgaMappings,omitempty"`
}

type SSOSAMLSettings added in v1.6.1

type SSOSAMLSettings struct {
	IdpURL                          string                      `json:"idpUrl,omitempty"`
	IdpEntityID                     string                      `json:"entityId,omitempty"`
	IdpCert                         string                      `json:"idpCert,omitempty"`
	AttributeMapping                *AttributeMapping           `json:"attributeMapping,omitempty"`
	RoleMappings                    []*RoleMapping              `json:"roleMappings,omitempty"`
	DefaultSSORoles                 []string                    `json:"defaultSSORoles,omitempty"` // roles names
	GroupsPriority                  []string                    `json:"groupsPriority,omitempty"`  // list of group names in priority order (first = highest priority)
	FgaMappings                     map[string]*FGAGroupMapping `json:"fgaMappings,omitempty"`
	ConfigFGATenantIDResourcePrefix string                      `json:"configFGATenantIDResourcePrefix,omitempty"`
	ConfigFGATenantIDResourceSuffix string                      `json:"configFGATenantIDResourceSuffix,omitempty"`

	// NOTICE - the following fields should be overridden only in case of SSO migration, otherwise, do not modify these fields
	SpACSUrl   string `json:"spACSUrl,omitempty"`
	SpEntityID string `json:"spEntityId,omitempty"`
}

type SSOSAMLSettingsByMetadata added in v1.6.1

type SSOSAMLSettingsByMetadata struct {
	IdpMetadataURL                  string                      `json:"idpMetadataUrl,omitempty"`
	AttributeMapping                *AttributeMapping           `json:"attributeMapping,omitempty"`
	RoleMappings                    []*RoleMapping              `json:"roleMappings,omitempty"`
	DefaultSSORoles                 []string                    `json:"defaultSSORoles,omitempty"` // roles names
	GroupsPriority                  []string                    `json:"groupsPriority,omitempty"`  // list of group names in priority order (first = highest priority)
	FgaMappings                     map[string]*FGAGroupMapping `json:"fgaMappings,omitempty"`
	ConfigFGATenantIDResourcePrefix string                      `json:"configFGATenantIDResourcePrefix,omitempty"`
	ConfigFGATenantIDResourceSuffix string                      `json:"configFGATenantIDResourceSuffix,omitempty"`

	// NOTICE - the following fields should be overridden only in case of SSO migration, otherwise, do not modify these fields
	SpACSUrl   string `json:"spACSUrl,omitempty"`
	SpEntityID string `json:"spEntityId,omitempty"`
}

type SSOSAMLSettingsResponse added in v1.6.1

type SSOSAMLSettingsResponse struct {
	IdpEntityID                     string                      `json:"idpEntityId,omitempty"`
	IdpSSOURL                       string                      `json:"idpSSOUrl,omitempty"`
	IdpCertificate                  string                      `json:"idpCertificate,omitempty"`
	IdpMetadataURL                  string                      `json:"idpMetadataUrl,omitempty"`
	SpEntityID                      string                      `json:"spEntityId,omitempty"`
	SpACSUrl                        string                      `json:"spACSUrl,omitempty"`
	SpCertificate                   string                      `json:"spCertificate,omitempty"`
	AttributeMapping                *AttributeMapping           `json:"attributeMapping,omitempty"`
	GroupsMapping                   []*GroupsMapping            `json:"groupsMapping,omitempty"`
	DefaultSSORoles                 []string                    `json:"defaultSSORoles,omitempty"`
	GroupsPriority                  []string                    `json:"groupsPriority,omitempty"` // list of group names in priority order (first = highest priority)
	RedirectURL                     string                      `json:"redirectUrl,omitempty"`
	FgaMappings                     map[string]*FGAGroupMapping `json:"fgaMappings,omitempty"`
	ConfigFGATenantIDResourcePrefix string                      `json:"configFGATenantIDResourcePrefix,omitempty"`
	ConfigFGATenantIDResourceSuffix string                      `json:"configFGATenantIDResourceSuffix,omitempty"`
}

type SSOSettingsResponse added in v1.5.0

type SSOSettingsResponse struct {
	TenantID       string           `json:"tenantId,omitempty"`
	IdpEntityID    string           `json:"idpEntityId,omitempty"`
	IdpSSOURL      string           `json:"idpSSOUrl,omitempty"`
	IdpCertificate string           `json:"idpCertificate,omitempty"`
	IdpMetadataURL string           `json:"idpMetadataUrl,omitempty"`
	SpEntityID     string           `json:"spEntityId,omitempty"`
	SpACSUrl       string           `json:"spACSUrl,omitempty"`
	SpCertificate  string           `json:"spCertificate,omitempty"`
	UserMapping    *UserMapping     `json:"userMapping,omitempty"`
	GroupsMapping  []*GroupsMapping `json:"groupsMapping,omitempty"`
	RedirectURL    string           `json:"redirectUrl,omitempty"`
	Domains        []string         `json:"domains,omitempty"`
	// Deprecated - prefer using domains
	Domain string `json:"domain,omitempty"`
}

type SSOTenantAllSettingsResponse added in v1.6.11

type SSOTenantAllSettingsResponse struct {
	SSOSettings []*SSOTenantSettingsResponse `json:"SSOSettings,omitempty"`
}

type SSOTenantSettingsResponse added in v1.6.1

type SSOTenantSettingsResponse struct {
	Tenant *Tenant                  `json:"tenant,omitempty"`
	Saml   *SSOSAMLSettingsResponse `json:"saml,omitempty"`
	Oidc   *SSOOIDCSettings         `json:"oidc,omitempty"`
	SSOID  string                   `json:"ssoId,omitempty"`
}

type SignUpOptions added in v1.6.1

type SignUpOptions struct {
	CustomClaims    map[string]any    `json:"customClaims,omitempty"`
	TemplateID      string            `json:"templateId,omitempty"`      // for overriding the default messaging template
	TemplateOptions map[string]string `json:"templateOptions,omitempty"` // for providing messaging template options (templates that are being sent via email / text message)
}

type SnapshotSecret added in v1.6.3

type SnapshotSecret struct {
	// The id of the project entity that requires this secret
	ID string `json:"id"`
	// The name of the project entity that requires this secret
	Name string `json:"name"`
	// The type of secret, e.g., "bearertoken", "password"
	Type string `json:"type"`
	// The cleartext value of the secret. This value must not be empty when used in
	// request objects when calling ValidateSnapshot and ImportSnapshot. Conversely,
	// this value is an empty string when returned in ValidateSnapshotResponse to
	// signify that this is a missing secret.
	Value string `json:"value,omitempty"`
}

type SnapshotSecrets added in v1.6.3

type SnapshotSecrets struct {
	// Any missing or input secrets for connectors in a snapshot
	Connectors []*SnapshotSecret `json:"connectors,omitempty"`
	// Any missing or input secrets for OAuth providers in a snapshot
	OAuthProviders []*SnapshotSecret `json:"oauthProviders,omitempty"`
	// Any missing or input secrets for outbound applications in a snapshot
	OutboundApps []*SnapshotSecret `json:"outboundApps,omitempty"`
}

type TOTPResponse added in v0.9.4

type TOTPResponse struct {
	ProvisioningURL string `json:"provisioningURL,omitempty"`
	Image           string `json:"image,omitempty"`
	Key             string `json:"key,omitempty"`
}

TOTPResponse - returns all relevant data to complete a TOTP registration One can select which method of registration to use for handshaking with an Authenticator app

type Tenant added in v0.9.4

type Tenant struct {
	ID                      string          `json:"id"`
	Name                    string          `json:"name"`
	SelfProvisioningDomains []string        `json:"selfProvisioningDomains"`
	CustomAttributes        map[string]any  `json:"customAttributes,omitempty"`
	AuthType                string          `json:"authType,omitempty"`
	Domains                 []string        `json:"domains,omitempty"`
	CreatedTime             int32           `json:"createdTime,omitempty"`
	EnforceSSO              bool            `json:"enforceSSO,omitempty"`
	Disabled                bool            `json:"disabled,omitempty"`
	EnforceSSOExclusions    []string        `json:"enforceSSOExclusions,omitempty"`
	RoleInheritance         RoleInheritance `json:"roleInheritance,omitempty"`
}

type TenantRequest added in v1.5.7

type TenantRequest struct {
	Name                    string          `json:"name"`
	SelfProvisioningDomains []string        `json:"selfProvisioningDomains"`
	CustomAttributes        map[string]any  `json:"customAttributes,omitempty"`
	EnforceSSO              bool            `json:"enforceSSO,omitempty"`
	Disabled                bool            `json:"disabled,omitempty"`
	ParentTenantID          string          `json:"parentId,omitempty"` // applicable only for creation request
	EnforceSSOExclusions    []string        `json:"enforceSSOExclusions,omitempty"`
	RoleInheritance         RoleInheritance `json:"roleInheritance,omitempty"`
}

type TenantSearchOptions added in v1.5.7

type TenantSearchOptions struct {
	IDs                     []string
	Names                   []string
	SelfProvisioningDomains []string
	CustomAttributes        map[string]any
	AuthType                string
}

type TenantSettings added in v1.6.1

type TenantSettings struct {
	Domains                    []string `json:"domains,omitempty"`
	SelfProvisioningDomains    []string `json:"selfProvisioningDomains,omitempty"`
	AuthType                   string   `json:"authType,omitempty"`
	SessionSettingsEnabled     bool     `json:"sessionSettingsEnabled,omitempty"`
	RefreshTokenExpiration     int32    `json:"refreshTokenExpiration,omitempty"`
	RefreshTokenExpirationUnit string   `json:"refreshTokenExpirationUnit,omitempty"`
	SessionTokenExpiration     int32    `json:"sessionTokenExpiration,omitempty"`
	SessionTokenExpirationUnit string   `json:"sessionTokenExpirationUnit,omitempty"`
	StepupTokenExpiration      int32    `json:"stepupTokenExpiration,omitempty"`
	StepupTokenExpirationUnit  string   `json:"stepupTokenExpirationUnit,omitempty"`
	EnableInactivity           bool     `json:"enableInactivity,omitempty"`
	InactivityTime             int32    `json:"inactivityTime,omitempty"`
	InactivityTimeUnit         string   `json:"inactivityTimeUnit,omitempty"`
	JITDisabled                bool     `json:"JITDisabled,omitempty"`
}

type TenantsResponse added in v1.6.7

type TenantsResponse struct {
	Tenants []MeTenant `json:"tenants,omitempty"`
}

type ThirdPartyApplication added in v1.6.10

type ThirdPartyApplication struct {
	ID                   string                        `json:"id"`
	Name                 string                        `json:"name"`
	Description          string                        `json:"description"`
	LoginPageURL         string                        `json:"loginPageUrl"`
	ClientID             string                        `json:"clientId"`
	ApprovedCallbackUrls []string                      `json:"approvedCallbackUrls"`
	PermissionsScopes    []*ThirdPartyApplicationScope `json:"permissionsScopes"`
	AttributesScopes     []*ThirdPartyApplicationScope `json:"attributesScopes"`
	JWTBearerSettings    *JWTBearerSettings            `json:"jwtBearerSettings,omitempty"`
}

type ThirdPartyApplicationConsent added in v1.6.10

type ThirdPartyApplicationConsent struct {
	// Consent ID
	ID string `json:"id"`
	// Associated third party application ID
	AppID string `json:"appId"`
	// Associated user ID
	UserID string `json:"userId"`
	// Scopes granted by this user consent
	Scopes []string `json:"scopes"`
	// The user id the consent was granted by
	GrantedBy string `json:"grantedBy"`
	// The time the consent was granted in milliseconds since epoch
	CreatedTime int32 `json:"createdTime"`
	// The tenant id the consent was granted for
	TenantID string `json:"tenantId"`
	// The consent expiry time
	ExpireTime int32 `json:"expireTime,omitempty"`
	// The consent modified time in milliseconds since epoch
	ModifiedTime int32 `json:"modifiedTime,omitempty"`
}

func (*ThirdPartyApplicationConsent) GetCreatedTime added in v1.6.10

func (c *ThirdPartyApplicationConsent) GetCreatedTime() time.Time

type ThirdPartyApplicationConsentDeleteOptions added in v1.6.10

type ThirdPartyApplicationConsentDeleteOptions struct {
	ConsentIDs []string `json:"consentIds"`
	AppID      string   `json:"appId"`
	UserIDs    []string `json:"userIds"`
	TenantID   string   `json:"tenantId"`
}

Options for deleting third party application consents. At least one of ConsentIDs, AppID or UserIDs must be provided.

ConsentIDs - allows to delete any consents by their given id. AppID - allows to delete all consents by a given third party application id. UserID - allows to delete all consents of a given user by user id. TenantID - allows to delete all consents of a given tenant by tenant id.

type ThirdPartyApplicationConsentSearchOptions added in v1.6.10

type ThirdPartyApplicationConsentSearchOptions struct {
	AppID     string `json:"appId"`
	UserID    string `json:"userId"`
	ConsentID string `json:"consentId"`
	Page      int32  `json:"page"`
	Limit     int32  `json:"limit"`
	TenantID  string `json:"tenantId"`
}

Options for searching and filtering third party application consents

AppID - allows to filter consents by a given third party application id. UserID - allows to filter by a given user id. ConsentID - search a specific consent by id. Page - allows to paginate over the results. Pages start at 0 and must non-negative. TenantID - allows to filter by a given tenant id.

type ThirdPartyApplicationRequest added in v1.6.10

type ThirdPartyApplicationRequest struct {
	ID                   string                        `json:"id"`
	Name                 string                        `json:"name"`
	Description          string                        `json:"description"`
	LoginPageURL         string                        `json:"loginPageUrl"`
	ApprovedCallbackUrls []string                      `json:"approvedCallbackUrls"`
	PermissionsScopes    []*ThirdPartyApplicationScope `json:"permissionsScopes"`
	AttributesScopes     []*ThirdPartyApplicationScope `json:"attributesScopes"`
	JWTBearerSettings    *JWTBearerSettings            `json:"jwtBearerSettings,omitempty"`
}

type ThirdPartyApplicationScope added in v1.6.10

type ThirdPartyApplicationScope struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Values      []string `json:"values"`
}

type ThirdPartyApplicationSearchOptions added in v1.6.22

type ThirdPartyApplicationSearchOptions struct {
	Page  int32 `json:"page"`
	Limit int32 `json:"limit"`
}

Options for loading third party applications

Page - allows to paginate over the results. Pages start at 0 and must be non-negative. Limit - limits the number of returned applications. Leave at 0 to return the default amount.

type ThirdPartyApplicationTenantConsentDeleteOptions added in v1.6.10

type ThirdPartyApplicationTenantConsentDeleteOptions struct {
	ConsentIDs []string `json:"consentIds"`
	AppID      string   `json:"appId"`
	TenantID   string   `json:"tenantId"`
}

Options for deleting third party application tenant level consents. At least one of ConsentIDs, AppID must be provided.

ConsentIDs - allows to delete any consents by their given id. AppID - allows to delete all consents by a given third party application id. TenantID - allows to delete all consents of a given tenant by tenant id.

type Token added in v0.9.4

type Token struct {
	RefreshExpiration int64          `json:"refreshExpiration,omitempty"`
	Expiration        int64          `json:"expiration,omitempty"`
	JWT               string         `json:"jwt,omitempty"`
	ID                string         `json:"id,omitempty"`
	ProjectID         string         `json:"projectId,omitempty"`
	Claims            map[string]any `json:"claims,omitempty"`
}

func NewToken added in v0.9.4

func NewToken(JWT string, token jwt.Token) *Token

func (*Token) AuthFactors added in v0.9.4

func (to *Token) AuthFactors() []AuthFactor

func (*Token) CustomClaim added in v0.9.4

func (to *Token) CustomClaim(value string) any

func (*Token) GetTenantValue added in v0.9.4

func (to *Token) GetTenantValue(tenant, key string) any

func (*Token) GetTenants added in v0.9.4

func (to *Token) GetTenants() []string

func (*Token) IsMFA added in v0.9.4

func (to *Token) IsMFA() bool

func (*Token) IsPermitted added in v1.5.2

func (to *Token) IsPermitted(permission string) bool

func (*Token) IsPermittedPerTenant added in v1.5.2

func (to *Token) IsPermittedPerTenant(tenant string, permission string) bool

type URLParam added in v1.6.14

type URLParam struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type UpdateOptions added in v1.5.0

type UpdateOptions struct {
	AddToLoginIDs      bool              `json:"addToLoginIDs,omitempty"`
	OnMergeUseExisting bool              `json:"onMergeUseExisting,omitempty"`
	TemplateOptions    map[string]string `json:"templateOptions,omitempty"` // for providing messaging template options (templates that are being sent via email / text message)
	TemplateID         string            `json:"templateId,omitempty"`
	ProviderID         string            `json:"providerId,omitempty"`
}

type User added in v0.9.4

type User struct {
	Name       string `json:"name,omitempty"`
	GivenName  string `json:"givenName,omitempty"`
	MiddleName string `json:"middleName,omitempty"`
	FamilyName string `json:"familyName,omitempty"`
	Phone      string `json:"phone,omitempty"`
	Email      string `json:"email,omitempty"`
}

type UserHistoryResponse added in v1.6.2

type UserHistoryResponse struct {
	UserID         string `json:"userId,omitempty"`
	LoginTime      int32  `json:"loginTime,omitempty"`
	City           string `json:"city,omitempty"`
	Country        string `json:"country,omitempty"`
	IP             string `json:"ip,omitempty"`
	SelectedTenant string `json:"selectedTenant,omitempty"`
}

type UserImportFailure added in v1.5.7

type UserImportFailure struct {
	User   string `json:"user"`
	Reason string `json:"reason"`
}

type UserImportResponse added in v1.5.7

type UserImportResponse struct {
	Users    []*UserResponse      `json:"users,omitempty"`
	Failures []*UserImportFailure `json:"failures,omitempty"`
}

type UserMapping added in v1.5.0

type UserMapping struct {
	Name        string `json:"name,omitempty"`
	Email       string `json:"email,omitempty"`
	Username    string `json:"username,omitempty"`
	PhoneNumber string `json:"phoneNumber,omitempty"`
	Group       string `json:"group,omitempty"`
}

type UserRequest added in v1.5.0

type UserRequest struct {
	User               `json:",inline"`
	Roles              []string            `json:"roles,omitempty"`
	Tenants            []*AssociatedTenant `json:"tenants,omitempty"`
	CustomAttributes   map[string]any      `json:"customAttributes,omitempty"`
	Picture            string              `json:"picture,omitempty"`
	VerifiedEmail      *bool               `json:"verifiedEmail,omitempty"`
	VerifiedPhone      *bool               `json:"verifiedPhone,omitempty"`
	AdditionalLoginIDs []string            `json:"additionalLoginIds,omitempty"`
	SSOAppIDs          []string            `json:"ssoAppIDs,omitempty"`
}

type UserResponse added in v0.9.4

type UserResponse struct {
	User             `json:",inline"`
	UserID           string                          `json:"userId,omitempty"`
	LoginIDs         []string                        `json:"loginIds,omitempty"`
	VerifiedEmail    bool                            `json:"verifiedEmail,omitempty"`
	VerifiedPhone    bool                            `json:"verifiedPhone,omitempty"`
	RoleNames        []string                        `json:"roleNames,omitempty"`
	UserTenants      []*UserResponseAssociatedTenant `json:"userTenants,omitempty"`
	Status           string                          `json:"status,omitempty"`
	Picture          string                          `json:"picture,omitempty"`
	Test             bool                            `json:"test,omitempty"`
	CustomAttributes map[string]any                  `json:"customAttributes,omitempty"`
	CreatedTime      int32                           `json:"createdTime,omitempty"`
	TOTP             bool                            `json:"totp,omitempty"`
	WebAuthn         bool                            `json:"webauthn,omitempty"`
	Password         bool                            `json:"password,omitempty"`
	SAML             bool                            `json:"saml,omitempty"`
	SCIM             bool                            `json:"scim,omitempty"`
	OAuth            map[string]bool                 `json:"oauth,omitempty"`
	SSOAppIDs        []string                        `json:"ssoAppIds,omitempty"`
}

func (*UserResponse) GetCreatedTime added in v1.5.0

func (ur *UserResponse) GetCreatedTime() time.Time

type UserResponseAssociatedTenant added in v1.6.22

type UserResponseAssociatedTenant struct {
	AssociatedTenant `json:",inline"`
	Permissions      []string `json:"permissions,omitempty"`
}

type UserSearchOptions added in v1.1.0

type UserSearchOptions struct {
	Page              int32
	Limit             int32
	Sort              []UserSearchSort
	Text              string
	Emails            []string
	Phones            []string
	Statuses          []UserStatus
	Roles             []string
	TenantIDs         []string
	SSOAppIDs         []string
	CustomAttributes  map[string]any
	WithTestUsers     bool
	TestUsersOnly     bool
	LoginIDs          []string
	UserIDs           []string
	FromCreatedTime   int64
	ToCreatedTime     int64
	FromModifiedTime  int64
	ToModifiedTime    int64
	TenantRoleIDs     map[string]*RoleList
	TenantRoleNames   map[string]*RoleList
	IncludeSubTenants bool
}

Options for searching and filtering users

Limit - limits the number of returned users. Leave at 0 to return the default amount. Page - allows to paginate over the results. Pages start at 0 and must non-negative. Sort - allows to sort by fields. Text - allows free text search among all user's attributes. TenantIDs - filter by tenant IDs. Roles - filter by role names. CustomAttributes map is an optional filter for custom attributes: where the keys are the attribute names and the values are either a value we are searching for or list of these values in a slice. We currently support string, int and bool values

type UserSearchSort added in v1.6.1

type UserSearchSort struct {
	Field string `json:"field"`
	Desc  bool   `json:"desc"`
}

type UserStatus added in v1.5.5

type UserStatus string
const (
	UserStatusEnabled  UserStatus = "enabled"
	UserStatusDisabled UserStatus = "disabled"
	UserStatusInvited  UserStatus = "invited"
	UserStatusExpired  UserStatus = "expired"
)

type UserTrustedDevice added in v1.6.19

type UserTrustedDevice struct {
	ID             string    `json:"id,omitempty"`
	Name           string    `json:"name,omitempty"`
	DeviceType     string    `json:"deviceType,omitempty"`
	LastLoginTime  time.Time `json:"lastLoginTime,omitempty"`
	ExpirationTime time.Time `json:"expirationTime,omitempty"`
	LastLocation   string    `json:"lastLocation,omitempty"`
}

UserTrustedDevice represents a device trusted for a user (i.e. remembered device for MFA bypass).

type UsersBatchResponse added in v1.5.7

type UsersBatchResponse struct {
	CreatedUsers     []*UserResponse        `json:"createdUsers,omitempty"`
	PatchedUsers     []*UserResponse        `json:"patchedUsers,omitempty"`
	FailedUsers      []*UsersFailedResponse `json:"failedUsers,omitempty"`
	AdditionalErrors map[string]string      `json:"additionalErrors,omitempty"`
}

type UsersFailedResponse added in v1.5.7

type UsersFailedResponse struct {
	Failure string        `json:"failure,omitempty"`
	User    *UserResponse `json:"user,omitempty"`
}

type ValidateSnapshotRequest added in v1.6.3

type ValidateSnapshotRequest struct {
	// All project settings and configurations represented as JSON files
	Files map[string]any `json:"files"`
	// An optional map of project entities and their secrets that will be
	// injected into the snapshot before validation (see below)
	InputSecrets *SnapshotSecrets `json:"inputSecrets,omitempty"`
}

type ValidateSnapshotResponse added in v1.6.3

type ValidateSnapshotResponse struct {
	// Whether the validation passed or not (true if and only if Failures is empty)
	Ok bool `json:"ok"`
	// A string representation of any validation failures that were found
	Failures []string `json:"failures,omitempty"`
	// An optional object that lists which if any secret values need to be provided in
	// the request for an ImportSnapshot call so it doesn't fail (see below)
	MissingSecrets *SnapshotSecrets `json:"missingSecrets,omitempty"`
}

type WebAuthnFinishRequest added in v0.9.4

type WebAuthnFinishRequest struct {
	TransactionID string `json:"transactionID,omitempty"`
	Response      string `json:"response,omitempty"`
}

type WebAuthnTransactionResponse added in v0.9.4

type WebAuthnTransactionResponse struct {
	TransactionID string `json:"transactionId,omitempty"`
	Options       string `json:"options,omitempty"`
	Create        bool   `json:"create,omitempty"`
}

Directories

Path Synopsis
gin module
internal
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL