management

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncludeTotals added in v0.1.0

func IncludeTotals(include bool) reqOption

IncludeTotals configures a call to include totals.

func Page added in v0.1.0

func Page(page int) reqOption

Page configures a call to receive a specific page, if the results where concatenated.

func Parameter added in v0.1.0

func Parameter(key, value string) reqOption

Parameter is a generic configuration to add arbitrary query parameters to calls made to Auth0.

func PerPage added in v0.1.0

func PerPage(items int) reqOption

PerPage configures a call to limit the amount of items in the result.

func WithDebug added in v0.2.0

func WithDebug(d bool) apiOption

WithDebug configures the management client to dump http requests and responses to stdout.

func WithFields added in v0.1.0

func WithFields(fields ...string) reqOption

WithFields configures a call to include the desired fields.

func WithTimeout added in v0.2.0

func WithTimeout(t time.Duration) apiOption

WithTimeout configures the management client with a request timeout.

func WithoutFields added in v0.1.0

func WithoutFields(fields ...string) reqOption

WithoutFields configures a call to exclude the desired fields.

Types

type Client

type Client struct {

	// The name of the client
	Name *string `json:"name,omitempty"`

	// Free text description of the purpose of the Client. (Max character length
	// is 140)
	Description *string `json:"description,omitempty"`

	// The id of the client
	ClientID *string `json:"client_id,omitempty"`

	// The client secret, it must not be public
	ClientSecret *string `json:"client_secret,omitempty"`

	// The type of application this client represents
	AppType *string `json:"app_type,omitempty"`

	// The URL of the client logo (recommended size: 150x150)
	LogoURI *string `json:"logo_uri,omitempty"`

	// Whether this client a first party client or not
	IsFirstParty *bool `json:"is_first_party,omitempty"`

	// Set header `auth0-forwarded-for` as trusted to be used as source
	// of end user ip for brute-force-protection on token endpoint.
	IsTokenEndpointIPHeaderTrusted *bool `json:"is_token_endpoint_ip_header_trusted,omitempty"`

	// Whether this client will conform to strict OIDC specifications
	OIDCConformant *bool `json:"oidc_conformant,omitempty"`

	// The URLs that Auth0 can use to as a callback for the client
	Callbacks      []interface{} `json:"callbacks,omitempty"`
	AllowedOrigins []interface{} `json:"allowed_origins,omitempty"`

	// A set of URLs that represents valid web origins for use with web message
	// response mode
	WebOrigins        []interface{}           `json:"web_origins,omitempty"`
	ClientAliases     []interface{}           `json:"client_aliases,omitempty"`
	AllowedClients    []interface{}           `json:"allowed_clients,omitempty"`
	AllowedLogoutURLs []interface{}           `json:"allowed_logout_urls,omitempty"`
	JWTConfiguration  *ClientJWTConfiguration `json:"jwt_configuration,omitempty"`

	// Client signing keys
	SigningKeys   []map[string]string `json:"-"`
	EncryptionKey map[string]string   `json:"encryption_key,omitempty"`
	SSO           *bool               `json:"sso,omitempty"`

	// True to disable Single Sign On, false otherwise (default: false)
	SSODisabled *bool `json:"sso_disabled,omitempty"`

	// True if this client can be used to make cross-origin authentication
	// requests, false otherwise (default: false)
	CrossOriginAuth *bool `json:"cross_origin_auth,omitempty"`

	// List of acceptable Grant Types for this Client
	GrantTypes []interface{} `json:"grant_types,omitempty"`

	// URL for the location in your site where the cross origin verification
	// takes place for the cross-origin auth flow when performing Auth in your
	// own domain instead of Auth0 hosted login page
	CrossOriginLocation *string `json:"cross_origin_loc,omitempty"`

	// True if the custom login page is to be used, false otherwise. Defaults to
	// true
	CustomLoginPageOn      *bool                  `json:"custom_login_page_on,omitempty"`
	CustomLoginPage        *string                `json:"custom_login_page,omitempty"`
	CustomLoginPagePreview *string                `json:"custom_login_page_preview,omitempty"`
	FormTemplate           *string                `json:"form_template,omitempty"`
	Addons                 map[string]interface{} `json:"addons,omitempty"`

	// Defines the requested authentication method for the token endpoint.
	// Possible values are:
	// 	'none' (public client without a client secret),
	// 	'client_secret_post' (client uses HTTP POST parameters) or
	// 	'client_secret_basic' (client uses HTTP Basic)
	TokenEndpointAuthMethod *string                `json:"token_endpoint_auth_method,omitempty"`
	ClientMetadata          map[string]string      `json:"client_metadata,omitempty"`
	Mobile                  map[string]interface{} `json:"mobile,omitempty"`
}

func (*Client) String added in v1.0.1

func (c *Client) String() string

type ClientGrant

type ClientGrant struct {

	// A generated string identifying the client grant.
	ID *string `json:"id,omitempty"`

	// The identifier of the client.
	ClientID *string `json:"client_id,omitempty"`

	// The audience.
	Audience *string `json:"audience,omitempty"`

	Scope []interface{} `json:"scope"`
}

func (*ClientGrant) String added in v1.0.1

func (c *ClientGrant) String() string

type ClientGrantManager

type ClientGrantManager struct {
	// contains filtered or unexported fields
}

func NewClientGrantManager

func NewClientGrantManager(m *Management) *ClientGrantManager

func (*ClientGrantManager) Create

func (cg *ClientGrantManager) Create(g *ClientGrant) (err error)

func (*ClientGrantManager) Delete

func (cg *ClientGrantManager) Delete(id string) (err error)

func (*ClientGrantManager) Read

func (cg *ClientGrantManager) Read(id string) (*ClientGrant, error)

func (*ClientGrantManager) Update

func (cg *ClientGrantManager) Update(id string, g *ClientGrant) (err error)

type ClientJWTConfiguration

type ClientJWTConfiguration struct {
	// The amount of seconds the JWT will be valid (affects exp claim)
	LifetimeInSeconds *int `json:"lifetime_in_seconds,omitempty"`

	// True if the client secret is base64 encoded, false otherwise. Defaults to
	// true
	SecretEncoded *bool `json:"secret_encoded,omitempty"`

	Scopes interface{} `json:"scopes,omitempty"`

	// Algorithm used to sign JWTs. Can be "HS256" or "RS256"
	Algorithm *string `json:"alg,omitempty"`
}

type ClientManager

type ClientManager struct {
	// contains filtered or unexported fields
}

func NewClientManager

func NewClientManager(m *Management) *ClientManager

func (*ClientManager) Create

func (cm *ClientManager) Create(c *Client) (err error)

func (*ClientManager) Delete

func (cm *ClientManager) Delete(id string) (err error)

func (*ClientManager) List added in v0.2.1

func (cm *ClientManager) List(opts ...reqOption) ([]*Client, error)

func (*ClientManager) Read

func (cm *ClientManager) Read(id string, opts ...reqOption) (*Client, error)

func (*ClientManager) RotateSecret added in v0.2.1

func (cm *ClientManager) RotateSecret(id string) (*Client, error)

func (*ClientManager) Update

func (cm *ClientManager) Update(id string, c *Client) (err error)

type Connection

type Connection struct {
	// A generated string identifying the connection.
	ID *string `json:"id,omitempty"`

	// The name of the connection. Must start and end with an alphanumeric
	// character and can only contain alphanumeric characters and '-'. Max
	// length 128.
	Name *string `json:"name,omitempty"`

	// The identity provider identifier for the connection. Can be any of the
	// following:
	//
	// "ad", "adfs", "amazon", "dropbox", "bitbucket", "aol", "auth0-adldap",
	// "auth0-oidc", "auth0", "baidu", "bitly", "box", "custom", "daccount",
	// "dwolla", "email", "evernote-sandbox", "evernote", "exact", "facebook",
	// "fitbit", "flickr", "github", "google-apps", "google-oauth2", "guardian",
	//  "instagram", "ip", "linkedin", "miicard", "oauth1", "oauth2",
	// "office365", "paypal", "paypal-sandbox", "pingfederate",
	// "planningcenter", "renren", "salesforce-community", "salesforce-sandbox",
	//  "salesforce", "samlp", "sharepoint", "shopify", "sms", "soundcloud",
	// "thecity-sandbox", "thecity", "thirtysevensignals", "twitter", "untappd",
	//  "vkontakte", "waad", "weibo", "windowslive", "wordpress", "yahoo",
	// "yammer" or "yandex".
	Strategy *string `json:"strategy,omitempty"`

	// True if the connection is domain level
	IsDomainConnection *bool `json:"is_domain_connection,omitempty"`

	// Options for validation.
	Options *ConnectionOptions `json:"options,omitempty"`

	// The identifiers of the clients for which the connection is to be
	// enabled. If the array is empty or the property is not specified, no
	// clients are enabled.
	EnabledClients []interface{} `json:"enabled_clients,omitempty"`

	// Defines the realms for which the connection will be used (ie: email
	// domains). If the array is empty or the property is not specified, the
	// connection name will be added as realm.
	Realms []interface{} `json:"realms,omitempty"`

	Metadata *interface{} `json:"metadata,omitempty"`
}

func (*Connection) String added in v1.0.1

func (c *Connection) String() string

type ConnectionManager

type ConnectionManager struct {
	// contains filtered or unexported fields
}

func NewConnectionManager

func NewConnectionManager(m *Management) *ConnectionManager

func (*ConnectionManager) Create

func (cm *ConnectionManager) Create(c *Connection) error

func (*ConnectionManager) Delete

func (cm *ConnectionManager) Delete(id string) (err error)

func (*ConnectionManager) Read

func (cm *ConnectionManager) Read(id string, opts ...reqOption) (*Connection, error)

func (*ConnectionManager) Update

func (cm *ConnectionManager) Update(id string, c *Connection) (err error)

type ConnectionOptions

type ConnectionOptions struct {
	// Options for validation.
	Validation map[string]interface{} `json:"validation,omitempty"`

	// Password strength level, can be one of:
	// "none", "low", "fair", "good", "excellent" or null.
	PasswordPolicy *string `json:"passwordPolicy,omitempty"`

	// Options for password history policy.
	PasswordHistory map[string]interface{} `json:"password_history,omitempty"`

	// Options for password expiration policy.
	PasswordNoPersonalInfo map[string]interface{} `json:"password_no_personal_info,omitempty"`

	// Options for password dictionary policy.
	PasswordDictionary map[string]interface{} `json:"password_dictionary,omitempty"`

	APIEnableUsers               *bool `json:"api_enable_users,omitempty"`
	BasicProfile                 *bool `json:"basic_profile,omitempty"`
	ExtAdmin                     *bool `json:"ext_admin,omitempty"`
	ExtIsSuspended               *bool `json:"ext_is_suspended,omitempty"`
	ExtAgreedTerms               *bool `json:"ext_agreed_terms,omitempty"`
	ExtGroups                    *bool `json:"ext_groups,omitempty"`
	ExtNestedGroups              *bool `json:"ext_nested_groups,omitempty"`
	ExtAssignedPlans             *bool `json:"ext_assigned_plans,omitempty"`
	ExtProfile                   *bool `json:"ext_profile,omitempty"`
	EnabledDatabaseCustomization *bool `json:"enabledDatabaseCustomization,omitempty"`
	BruteForceProtection         *bool `json:"brute_force_protection,omitempty"`
	ImportMode                   *bool `json:"import_mode,omitempty"`
	DisableSignup                *bool `json:"disable_signup,omitempty"`
	RequiresUsername             *bool `json:"requires_username,omitempty"`

	// Options for adding parameters in the request to the upstream IdP.
	UpstreamParams *interface{} `json:"upstream_params,omitempty"`

	ClientID            *string       `json:"client_id,omitempty"`
	ClientSecret        *string       `json:"client_secret,omitempty"`
	TenantDomain        *string       `json:"tenant_domain,omitempty"`
	DomainAliases       []interface{} `json:"domain_aliases,omitempty"`
	UseWsfed            *bool         `json:"use_wsfed,omitempty"`
	WaadProtocol        *string       `json:"waad_protocol,omitempty"`
	WaadCommonEndpoint  *bool         `json:"waad_common_endpoint,omitempty"`
	AppID               *string       `json:"app_id,omitempty"`
	AppDomain           *string       `json:"app_domain,omitempty"`
	MaxGroupsToRetrieve *string       `json:"max_groups_to_retrieve,omitempty"`

	// Scripts for the connection
	// Allowed keys are: "get_user", "login", "create", "verify", "change_password", "delete" or "change_email".
	CustomScripts map[string]interface{} `json:"customScripts,omitempty"`
	// configuration variables that can be used in custom scripts
	Configuration map[string]interface{} `json:"configuration,omitempty"`
}

ConnectionOptions general options

type CustomDomain

type CustomDomain struct {

	// The id of the custom domain
	ID *string `json:"custom_domain_id,omitempty"`

	// The custom domain.
	Domain *string `json:"domain,omitempty"`

	// The custom domain provisioning type. Can be either "auth0_managed_certs"
	// or "self_managed_certs"
	Type *string `json:"type,omitempty"`

	// Primary is true if the domain was marked as "primary", false otherwise.
	Primary *bool `json:"primary,omitempty"`

	// The custom domain configuration status. Can be any of the following:
	//
	// "disabled", "pending", "pending_verification" or "ready"
	Status *string `json:"status,omitempty"`

	// The custom domain verification method. The only allowed value is "txt".
	VerificationMethod *string `json:"verification_method,omitempty"`

	Verification *CustomDomainVerification `json:"verification,omitempty"`
}

func (*CustomDomain) String added in v1.0.1

func (c *CustomDomain) String() string

type CustomDomainManager

type CustomDomainManager struct {
	// contains filtered or unexported fields
}

func NewCustomDomainManager

func NewCustomDomainManager(m *Management) *CustomDomainManager

func (*CustomDomainManager) Create

func (cm *CustomDomainManager) Create(c *CustomDomain) (err error)

func (*CustomDomainManager) Delete

func (cm *CustomDomainManager) Delete(id string) (err error)

func (*CustomDomainManager) Read

func (cm *CustomDomainManager) Read(id string, opts ...reqOption) (*CustomDomain, error)

func (*CustomDomainManager) Update

func (cm *CustomDomainManager) Update(id string, c *CustomDomain) (err error)

type CustomDomainVerification

type CustomDomainVerification struct {

	// The custom domain verification methods.
	Methods []map[string]interface{} `json:"methods,omitempty"`
}

type DailyStat added in v0.2.0

type DailyStat struct {
	Date            *time.Time `json:"date"`
	Logins          *int       `json:"logins"`
	Signups         *int       `json:"signups"`
	LeakedPasswords *int       `json:"leaked_passwords"`
	UpdatedAt       *time.Time `json:"updated_at"`
	CreatedAt       *time.Time `json:"created_at"`
}

func (*DailyStat) String added in v1.0.1

func (ds *DailyStat) String() string

type Email

type Email struct {

	// The name of the email provider. Can be one of "mandrill", "sendgrid",
	// "sparkpost", "ses" or "smtp".
	Name *string `json:"name,omitempty"`

	// True if the email provider is enabled, false otherwise (defaults to true)
	Enabled *bool `json:"enabled,omitempty"`

	// The default FROM address
	DefaultFromAddress *string `json:"default_from_address,omitempty"`

	Credentials *EmailCredentials      `json:"credentials,omitempty"`
	Settings    map[string]interface{} `json:"settings,omitempty"`
}

func (*Email) String added in v1.0.1

func (e *Email) String() string

type EmailCredentials

type EmailCredentials struct {
	// API User
	APIUser *string `json:"api_user,omitempty"`
	// API Key
	APIKey *string `json:"api_key,omitempty"`
	// AWS Access Key ID
	AccessKeyID *string `json:"accessKeyId,omitempty"`
	// AWS Secret Access Key
	SecretAccessKey *string `json:"secretAccessKey,omitempty"`
	// AWS default region
	Region *string `json:"region,omitempty"`
	// SMTP host
	SMTPHost *string `json:"smtp_host,omitempty"`
	// SMTP port
	SMTPPort *int `json:"smtp_port,omitempty"`
	// SMTP user
	SMTPUser *string `json:"smtp_user,omitempty"`
	// SMTP password
	SMTPPass *string `json:"smtp_pass,omitempty"`
}

type EmailManager

type EmailManager struct {
	// contains filtered or unexported fields
}

func NewEmailManager

func NewEmailManager(m *Management) *EmailManager

func (*EmailManager) Create

func (em *EmailManager) Create(e *Email) error

func (*EmailManager) Delete

func (em *EmailManager) Delete() (err error)

func (*EmailManager) Read

func (em *EmailManager) Read(opts ...reqOption) (*Email, error)

func (*EmailManager) Update

func (em *EmailManager) Update(e *Email) (err error)

type EmailTemplate

type EmailTemplate struct {

	// The template name. Can be one of "verify_email", "reset_email",
	// "welcome_email", "blocked_account", "stolen_credentials",
	// "enrollment_email", "change_password", "password_reset" or
	// "mfa_oob_code".
	Template *string `json:"template"`

	// The body of the template.
	Body *string `json:"body,omitempty"`

	// The sender of the email.
	From *string `json:"from,omitempty"`

	// The URL to redirect the user to after a successful action.
	ResultURL *string `json:"resultUrl,omitempty"`

	// The subject of the email.
	Subject *string `json:"subject,omitempty"`

	// The syntax of the template body.
	Syntax *string `json:"syntax,omitempty"`

	// The lifetime in seconds that the link within the email will be valid for.
	URLLifetimeInSecoonds *int `json:"urlLifetimeInSeconds,omitempty"`

	// Whether or not the template is enabled.
	Enabled *bool `json:"enabled"`
}

func (*EmailTemplate) String added in v1.0.1

func (e *EmailTemplate) String() string

type EmailTemplateManager

type EmailTemplateManager struct {
	// contains filtered or unexported fields
}

func NewEmailTemplateManager

func NewEmailTemplateManager(m *Management) *EmailTemplateManager

func (*EmailTemplateManager) Create

func (em *EmailTemplateManager) Create(e *EmailTemplate) error

func (*EmailTemplateManager) Read

func (em *EmailTemplateManager) Read(template string, opts ...reqOption) (*EmailTemplate, error)

func (*EmailTemplateManager) Replace added in v0.0.11

func (em *EmailTemplateManager) Replace(template string, e *EmailTemplate) (err error)

func (*EmailTemplateManager) Update

func (em *EmailTemplateManager) Update(template string, e *EmailTemplate) (err error)

type Error

type Error interface {
	Status() int
	error
}

type Grant added in v0.2.1

type Grant struct {

	// The id of the grant.
	ID *string `json:"id,omitempty"`

	// The id of the client.
	ClientID *string `json:"clientID,omitempty"`

	// The id of the user.
	UserID *string `json:"user_id`

	// The grant's audience.
	Audience *string `json:"audience,omitempty"`

	Scope []interface{} `json:"scope,omitempty"`
}

func (*Grant) String added in v1.0.1

func (g *Grant) String() string

type GrantManager added in v0.2.1

type GrantManager struct {
	// contains filtered or unexported fields
}

func NewGrantManager added in v0.2.1

func NewGrantManager(m *Management) *GrantManager

func (*GrantManager) List added in v0.2.1

func (gm *GrantManager) List(opts ...reqOption) ([]*Grant, error)

type Job added in v1.1.0

type Job struct {
	// The job's identifier. Useful to retrieve its status
	ID *string `json:"id,omitempty"`
	// The job's status
	Status *string `json:"status,omitempty"`
	// The type of job
	Type *string `json:"type,omitempty"`
	// The date when the job was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// The user_id of the user to whom the email will be sent
	UserID *string `json:"user_id,omitempty"`
	// The id of the client, if not provided the global one will be used
	ClientID *string `json:"cliend_id,omitempty"`

	// The id of the connection.
	ConnectionID *string `json:"connection_id,omitempty"`
	// The url to download the result of the job.
	Location *string `json:"location,omitempty"`
	// The percentage of the work done so far.
	PercentageDone *int `json:"percentage_done,omitempty"`
	// Estimated amount of time remaining to finish the job.
	TimeLeftSeconds *int `json:"time_left_seconds,omitempty"`
	// The format of the file. Valid values are: "json" and "csv".
	Format *string `json:"format,omitempty"`
	// Limit the number of records.
	Limit *int `json:"limit,omitempty"`
	// A list of fields to be included in the CSV. If omitted, a set of
	// predefined fields will be exported.
	Fields []map[string]interface{} `json:"fields,omitempty"`

	// A list of users. Used when importing users in bulk.
	Users []map[string]interface{} `json:"users,omitempty"`
	// If false, users will only be inserted. If there are already user(s) with
	// the same emails as one or more of those being inserted, they will fail.
	// If this value is set to true and the user being imported already exists,
	// the user will be updated with the new information.
	Upsert *bool `json:"upsert,omitempty"`
	// Optional user defined string that can be used for correlating multiple
	// jobs, and is returned as part of the job status response.
	ExternalID *string `json:"external_id,omitempty"`
	// When true, sends a completion email to all tenant owners when the job is
	// finished. The default is true, so you must explicitly set this parameter
	// to false if you do not want emails sent.
	SendCompletionEmail *bool `json:"send_completion_email,omitempty"`
}

func (*Job) String added in v1.1.0

func (j *Job) String() string

type JobManager added in v1.1.0

type JobManager struct {
	// contains filtered or unexported fields
}

func NewJobManager added in v1.1.0

func NewJobManager(m *Management) *JobManager

func (*JobManager) ExportUsers added in v1.1.0

func (jm *JobManager) ExportUsers(j *Job) error

func (*JobManager) ImportUsers added in v1.1.0

func (jm *JobManager) ImportUsers(j *Job) error

func (*JobManager) Read added in v1.1.0

func (jm *JobManager) Read(id string, opts ...reqOption) (*Job, error)

func (*JobManager) VerifyEmail added in v1.1.0

func (jm *JobManager) VerifyEmail(j *Job) error

type Log added in v0.2.1

type Log struct {
	ID    *string `json:"_id"`
	LogID *string `json:"log_id"`

	// The date when the event was created
	Date *time.Time `json:"date"`

	// The log event type
	Type *string `json:"type"`

	// The id of the client
	ClientID *string `json:"client_id"`

	// The name of the client
	ClientName *string `json:"client_name"`

	// The IP of the log event source
	IP *string `json:"ip"`

	LocationInfo map[string]interface{} `json:"location_info"`
	Details      map[string]interface{} `json:"details"`

	// The user's unique identifier
	UserID *string `json:"user_id"`
}

func (*Log) String added in v1.0.1

func (l *Log) String() string

func (*Log) TypeName added in v0.2.1

func (l *Log) TypeName() string

type LogManager added in v0.2.1

type LogManager struct {
	// contains filtered or unexported fields
}

func NewLogManager added in v0.2.1

func NewLogManager(m *Management) *LogManager

func (*LogManager) List added in v0.2.1

func (lm *LogManager) List(opts ...reqOption) ([]*Log, error)

func (*LogManager) Read added in v0.2.1

func (lm *LogManager) Read(id string, opts ...reqOption) (*Log, error)

func (*LogManager) Search added in v0.2.1

func (lm *LogManager) Search(opts ...reqOption) ([]*Log, error)

type Management

type Management struct {
	// Client manages Auth0 Client (also known as Application) resources.
	Client *ClientManager

	// ClientGrant manages Auth0 ClientGrant resources.
	ClientGrant *ClientGrantManager

	// ResourceServer manages Auth0 Resource Server (also known as API)
	// resources.
	ResourceServer *ResourceServerManager

	// Connection manages Auth0 Connection resources.
	Connection *ConnectionManager

	// CustomDomain manages Auth0 Custom Domains.
	CustomDomain *CustomDomainManager

	// Grant manages Auth0 Grants.
	Grant *GrantManager

	// Log reads Auth0 Logs.
	Log *LogManager

	// RuleManager manages Auth0 Rules.
	Rule *RuleManager

	// RuleManager manages Auth0 Rule Configurations.
	RuleConfig *RuleConfigManager

	// Email manages Auth0 Email Providers.
	Email *EmailManager

	// EmailTemplate manages Auth0 Email Templates.
	EmailTemplate *EmailTemplateManager

	// User manages Auth0 User resources.
	User *UserManager

	// Job manages Auth0 jobs.
	Job *JobManager

	// Tenant manages your Auth0 Tenant.
	Tenant *TenantManager

	// Ticket creates verify email or change password tickets.
	Ticket *TicketManager

	// Stat is used to retrieve usage statistics.
	Stat *StatManager
	// contains filtered or unexported fields
}

Management is an Auth0 management client used to interact with the Auth0 Management API v2.

func New

func New(domain, clientID, clientSecret string, options ...apiOption) (*Management, error)

New creates a new Auth0 Management client by authenticating using the supplied client id and secret.

type ResourceServer

type ResourceServer struct {

	// A generated string identifying the resource server.
	ID *string `json:"id,omitempty"`

	// The name of the resource server. Must contain at least one character.
	// Does not allow '<' or '>'
	Name *string `json:"name,omitempty"`

	// The identifier of the resource server.
	Identifier *string `json:"identifier,omitempty"`

	// Scopes supported by the resource server.
	Scopes []*ResourceServerScope `json:"scopes,omitempty"`

	// The algorithm used to sign tokens ["HS256" or "RS256"].
	SigningAlgorithm *string `json:"signing_alg,omitempty"`

	// The secret used to sign tokens when using symmetric algorithms.
	SigningSecret *string `json:"signing_secret,omitempty"`

	// Allows issuance of refresh tokens for this entity.
	AllowOfflineAccess *bool `json:"allow_offline_access,omitempty"`

	// The amount of time in seconds that the token will be valid after being
	// issued.
	TokenLifetime *int `json:"token_lifetime,omitempty"`

	// The amount of time in seconds that the token will be valid after being
	// issued from browser based flows. Value cannot be larger than
	// token_lifetime.
	TokenLifetimeForWeb *int `json:"token_lifetime_for_web,omitempty"`

	// Flag this entity as capable of skipping consent
	SkipConsentForVerifiableFirstPartyClients *bool `json:"skip_consent_for_verifiable_first_party_clients,omitempty"`

	// A URI from which to retrieve JWKs for this resource server used for
	// verifying the JWT sent to Auth0 for token introspection.
	VerificationLocation *string `json:"verificationLocation,omitempty"`

	Options map[string]interface{} `json:"options,omitempty"`
}

func (*ResourceServer) String added in v1.0.1

func (r *ResourceServer) String() string

type ResourceServerManager

type ResourceServerManager struct {
	// contains filtered or unexported fields
}

func NewResourceServerManager

func NewResourceServerManager(m *Management) *ResourceServerManager

func (*ResourceServerManager) Create

func (r *ResourceServerManager) Create(rs *ResourceServer) (err error)

func (*ResourceServerManager) Delete

func (r *ResourceServerManager) Delete(id string) (err error)

func (*ResourceServerManager) Read

func (r *ResourceServerManager) Read(id string, opts ...reqOption) (*ResourceServer, error)

func (*ResourceServerManager) Update

func (r *ResourceServerManager) Update(id string, rs *ResourceServer) (err error)

type ResourceServerScope

type ResourceServerScope struct {
	// The scope name. Use the format <action>:<resource> for example
	// 'delete:client_grants'.
	Value *string `json:"value,omitempty"`

	// Description of the scope
	Description *string `json:"description,omitempty"`
}

type Rule

type Rule struct {

	// The rule's identifier.
	ID *string `json:"id,omitempty"`

	// The name of the rule. Can only contain alphanumeric characters, spaces
	// and '-'. Can neither start nor end with '-' or spaces.
	Name *string `json:"name,omitempty"`

	// A script that contains the rule's code.
	Script *string `json:"script,omitempty"`

	// The rule's order in relation to other rules. A rule with a lower order
	// than another rule executes first. If no order is provided it will
	// automatically be one greater than the current maximum.
	Order *int `json:"order,omitempty"`

	// Enabled should be set to true if the rule is enabled, false otherwise.
	Enabled *bool `json:"enabled,omitempty"`
}

func (*Rule) String added in v1.0.1

func (r *Rule) String() string

type RuleConfig

type RuleConfig struct {

	// The key for a RuleConfigs config
	Key *string `json:"key,omitempty"`

	// The value for the rules config
	Value *string `json:"value,omitempty"`
}

func (*RuleConfig) String added in v1.0.1

func (r *RuleConfig) String() string

type RuleConfigManager

type RuleConfigManager struct {
	// contains filtered or unexported fields
}

func NewRuleConfigManager

func NewRuleConfigManager(m *Management) *RuleConfigManager

func (*RuleConfigManager) Delete

func (rm *RuleConfigManager) Delete(key string) (err error)

func (*RuleConfigManager) Read

func (rm *RuleConfigManager) Read(key string) (*RuleConfig, error)

func (*RuleConfigManager) Upsert

func (rm *RuleConfigManager) Upsert(key string, r *RuleConfig) (err error)

type RuleManager

type RuleManager struct {
	// contains filtered or unexported fields
}

func NewRuleManager

func NewRuleManager(m *Management) *RuleManager

func (*RuleManager) Create

func (rm *RuleManager) Create(r *Rule) error

func (*RuleManager) Delete

func (rm *RuleManager) Delete(id string) (err error)

func (*RuleManager) Read

func (rm *RuleManager) Read(id string, opts ...reqOption) (*Rule, error)

func (*RuleManager) Update

func (rm *RuleManager) Update(id string, r *Rule) (err error)

type StatManager added in v0.2.0

type StatManager struct {
	// contains filtered or unexported fields
}

func NewStatManager added in v0.2.0

func NewStatManager(m *Management) *StatManager

func (*StatManager) ActiveUsers added in v0.2.0

func (sm *StatManager) ActiveUsers() (int, error)

func (*StatManager) Daily added in v0.2.0

func (sm *StatManager) Daily(opts ...reqOption) ([]*DailyStat, error)

type Tenant added in v0.2.0

type Tenant struct {
	// Change password page settings
	ChangePassword *TenantChangePassword `json:"change_password,omitempty"`

	// Guardian MFA page settings
	GuardianMFAPage *TenantGuardianMFAPage `json:"guardian_mfa_page,omitempty"`

	// Default audience for API Authorization
	DefaultAudience *string `json:"default_audience,omitempty"`

	// Name of the connection that will be used for password grants at the token
	// endpoint. Only the following connection types are supported: LDAP, AD,
	// Database Connections, Passwordless, Windows Azure Active Directory, ADFS.
	DefaultDirectory *string `json:"default_directory,omitempty"`

	ErrorPage *TenantErrorPage `json:"error_page,omitempty"`

	Flags *TenantFlags `json:"flags,omitempty"`

	// The friendly name of the tenant
	FriendlyName *string `json:"friendly_name,omitempty"`

	// The URL of the tenant logo (recommended size: 150x150)
	PictureURL *string `json:"picture_url,omitempty"`

	// User support email
	SupportEmail *string `json:"support_email,omitempty"`

	// User support URL
	SupportURL *string `json:"support_url,omitempty"`

	// A set of URLs that are valid to redirect to after logout from Auth0.
	AllowedLogoutURLs []interface{} `json:"allowed_logout_urls,omitempty"`

	// Login session lifetime, how long the session will stay valid (unit:
	// hours).
	SessionLifetime *int `json:"session_lifetime,omitempty"`

	// The selected sandbox version to be used for the extensibility environment
	SandboxVersion *string `json:"sandbox_version,omitempty"`

	// A set of available sandbox versions for the extensibility environment
	SandboxVersionAvailable []interface{} `json:"sandbox_versions_available,omitempty"`
}

func (*Tenant) String added in v1.0.1

func (t *Tenant) String() string

type TenantChangePassword added in v0.2.0

type TenantChangePassword struct {
	// True to use the custom change password html, false otherwise.
	Enabled *bool `json:"enabled,omitempty"`
	// Replace default change password page with a custom HTML (Liquid syntax is
	// supported).
	HTML *string `json:"html,omitempty"`
}

type TenantErrorPage added in v0.2.0

type TenantErrorPage struct {
	// Replace default error page with a custom HTML (Liquid syntax is
	// supported).
	HTML *string `json:"html,omitempty"`
	// True to show link to log as part of the default error page, false
	// otherwise (default: true).
	ShowLogLink *bool `json:"show_log_link,omitempty"`
	// Redirect to specified url instead of show the default error page
	URL *string `json:"url,omitempty"`
}

type TenantFlags added in v0.2.0

type TenantFlags struct {
	// Enables the first version of the Change Password flow. We've deprecated
	// this option and recommending a safer flow. This flag is only for
	// backwards compatibility.
	ChangePasswordFlowV1 *bool `json:"change_pwd_flow_v1,omitempty"`

	// This flag determines whether all current connections shall be enabled
	// when a new client is created. Default value is true.
	EnableClientConnections *bool `json:"enable_client_connections,omitempty"`

	// This flag enables the API section in the Auth0 Management Dashboard.
	EnableAPIsSection *bool `json:"enable_apis_section,omitempty"`

	// If set to true all Impersonation functionality is disabled for the
	// Tenant. This is a read-only attribute.
	DisableImpersonation *bool `json:"disable_impersonation,omitempty"`

	// This flag enables advanced API Authorization scenarios.
	EnablePipeline2 *bool `json:"enable_pipeline2,omitempty"`

	// This flag enables dynamic client registration.
	EnableDynamicClientRegistration *bool `json:"enable_dynamic_client_registration,omitempty"`

	// If enabled, All your email links and urls will use your configured custom
	// domain. If no custom domain is found the email operation will fail.
	EnableCustomDomainInEmails *bool `json:"enable_custom_domain_in_emails,omitempty"`
}

type TenantGuardianMFAPage added in v0.2.0

type TenantGuardianMFAPage struct {
	// True to use the custom html for Guardian page, false otherwise.
	Enabled *bool `json:"enabled,omitempty"`
	// Replace default Guardian page with a custom HTML (Liquid syntax is
	// supported).
	HTML *string `json:"html,omitempty"`
}

type TenantManager added in v0.2.0

type TenantManager struct {
	// contains filtered or unexported fields
}

func NewTenantManager added in v0.2.0

func NewTenantManager(m *Management) *TenantManager

func (*TenantManager) Read added in v0.2.0

func (tm *TenantManager) Read(opts ...reqOption) (*Tenant, error)

func (*TenantManager) Update added in v0.2.0

func (tm *TenantManager) Update(t *Tenant) (err error)

type Ticket added in v0.2.0

type Ticket struct {
	// The user will be redirected to this endpoint once the ticket is used
	ResultURL *string `json:"result_url,omitempty"`

	// The UserID for which the ticket is to be created
	UserID *string `json:"user_id,omitempty"`

	// The ticket's lifetime in seconds starting from the moment of creation.
	// After expiration the ticket can not be used to verify the users's email.
	// If not specified or if you send 0 the Auth0 default lifetime will be
	// applied.
	TTLSec *int `json:"ttl_sec,omitempty"`

	// The connection that provides the identity for which the password is to be
	// changed. If sending this parameter, the email is also required and the
	// UserID is invalid.
	//
	// Requires: Email
	// Conflicts with: UserID
	ConnectionID *string `json:"connection_id,omitempty"`

	// The user's email
	//
	// Requires: ConnectionID
	// Conflicts with: UserID
	Email *string `json:"email,omitempty"`

	// The URL that represents the ticket
	Ticket *string `json:"ticket,omitempty"`
}

func (*Ticket) String added in v1.0.1

func (t *Ticket) String() string

type TicketManager added in v0.2.0

type TicketManager struct {
	// contains filtered or unexported fields
}

func NewTicketManager added in v0.2.0

func NewTicketManager(m *Management) *TicketManager

func (*TicketManager) ChangePassword added in v0.2.0

func (tm *TicketManager) ChangePassword(t *Ticket) (*Ticket, error)

func (*TicketManager) VerifyEmail added in v0.2.0

func (tm *TicketManager) VerifyEmail(t *Ticket) (*Ticket, error)

type User added in v0.1.1

type User struct {

	// The users identifier.
	ID *string `json:"user_id,omitempty"`

	// The connection the user belongs to.
	Connection *string `json:"connection,omitempty"`

	// The user's email
	Email *string `json:"email,omitempty"`

	// The users name
	Name *string `json:"name,omitempty"`

	// The user's username. Only valid if the connection requires a username
	Username *string `json:"username,omitempty"`

	// The user's password (mandatory for non SMS connections)
	Password *string `json:"password,omitempty"`

	// The user's phone number (following the E.164 recommendation), only valid
	// for users to be added to SMS connections.
	PhoneNumber *string `json:"phone_number,omitempty"`

	// The time the user is created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// The last time the user is updated.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// The last time the user has logged in.
	LastLogin *time.Time `json:"last_login,omitempty"`

	// UserMetadata holds data that the user has read/write access to (e.g.
	// color_preference, blog_url, etc).
	UserMetadata map[string]interface{} `json:"user_metadata,omitempty"`

	// True if the user's email is verified, false otherwise. If it is true then
	// the user will not receive a verification email, unless verify_email: true
	// was specified.
	EmailVerified *bool `json:"email_verified,omitempty"`

	// If true, the user will receive a verification email after creation, even
	// if created with email_verified set to true. If false, the user will not
	// receive a verification email, even if created with email_verified set to
	// false. If unspecified, defaults to the behavior determined by the value
	// of email_verified.
	VerifyEmail *bool `json:"verify_email,omitempty"`

	// True if the user's phone number is verified, false otherwise. When the
	// user is added to a SMS connection, they will not receive an verification
	// SMS if this is true.
	PhoneVerified *bool `json:"phone_verified,omitempty"`

	// AppMetadata holds data that the user has read-only access to (e.g. roles,
	// permissions, vip, etc).
	AppMetadata map[string]interface{} `json:"app_metadata,omitempty"`
}
Example
package main

import (
	"fmt"
	"os"

	"gopkg.in/auth0.v1"
	"gopkg.in/auth0.v1/management"
)

var (
	domain = os.Getenv("AUTH0_DOMAIN")
	id     = os.Getenv("AUTH0_CLIENT_ID")
	secret = os.Getenv("AUTH0_CLIENT_SECRET")
)

func main() {
	m, err := management.New(domain, id, secret)
	if err != nil {
		fmt.Printf("Failed creating management client. %s", err)
	}

	u := &management.User{
		Connection: auth0.String("Username-Password-Authentication"),
		Email:      auth0.String("smith@example.com"),
		Password:   auth0.String("F4e3DA1a6cDD"),
	}

	err = m.User.Create(u)
	if err != nil {
		fmt.Printf("Failed creating user. %s", err)
	}
	defer m.User.Delete(auth0.StringValue(u.ID))

	fmt.Printf("User created!")
}
Output:

User created!

func (*User) String added in v1.0.1

func (u *User) String() string

type UserManager added in v0.1.1

type UserManager struct {
	// contains filtered or unexported fields
}

func NewUserManager added in v0.1.1

func NewUserManager(m *Management) *UserManager

func (*UserManager) Create added in v0.1.1

func (um *UserManager) Create(u *User) error

func (*UserManager) Delete added in v0.1.1

func (um *UserManager) Delete(id string) (err error)

func (*UserManager) List added in v0.1.1

func (um *UserManager) List(opts ...reqOption) (us []*User, err error)

func (*UserManager) Read added in v0.1.1

func (um *UserManager) Read(id string, opts ...reqOption) (*User, error)

func (*UserManager) Search added in v0.2.1

func (um *UserManager) Search(opts ...reqOption) (us []*User, err error)

func (*UserManager) Update added in v0.1.1

func (um *UserManager) Update(id string, u *User) (err error)

Jump to

Keyboard shortcuts

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