management

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

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 WithTimeout added in v0.2.0

func WithTimeout(t time.Duration) apiOption

WithTimeout configures the management client with a request timeout.

Types

type Branding added in v1.2.3

type Branding struct {
	// Change password page settings
	Colors *BrandingColors `json:"colors,omitempty"`

	// URL for the favicon. Must use HTTPS.
	FaviconURL *string `json:"favicon_url,omitempty"`

	// URL for the logo. Must use HTTPS.
	LogoURL *string `json:"logo_url,omitempty"`

	Font *BrandingFont `json:"font,omitempty"`
}

func (*Branding) String added in v1.2.3

func (branding *Branding) String() string

type BrandingColors added in v1.2.3

type BrandingColors struct {
	// Accent color
	Primary *string `json:"primary,omitempty"`
	// Page background color
	PageBackground *string `json:"page_background,omitempty"`
}

type BrandingFont added in v1.2.3

type BrandingFont struct {
	// URL for the custom font. Must use HTTPS.
	URL *string `json:"url,omitempty"`
}

type BrandingManager added in v1.2.3

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

func NewBrandingManager added in v1.2.3

func NewBrandingManager(m *Management) *BrandingManager

func (*BrandingManager) Read added in v1.2.3

func (bm *BrandingManager) Read(opts ...ReqOption) (*Branding, error)

func (*BrandingManager) Update added in v1.2.3

func (bm *BrandingManager) Update(t *Branding) (err error)

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:"signing_keys,omitempty"`
	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"`
}
Example
package main

import (
	"fmt"
	"os"

	"github.com/confluentinc/auth0"
	"github.com/confluentinc/auth0/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)
	}

	c := &management.Client{
		Name:        auth0.String("Client Name"),
		Description: auth0.String("Long description of client"),
	}

	err = m.Client.Create(c)
	if err != nil {
		fmt.Printf("Failed creating client. %s", err)
	}
	defer m.Client.Delete(auth0.StringValue(c.ClientID))

	fmt.Print("Client created!")
}
Output:

Client created!

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 ConnectionManager

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

func (*ConnectionManager) Create

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

func (*ConnectionManager) Delete

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

func (*ConnectionManager) GetConnectionID added in v1.2.3

func (cm *ConnectionManager) GetConnectionID(connectionName string) (string, error)

func (*ConnectionManager) List added in v1.2.3

func (cm *ConnectionManager) List(opts ...ReqOption) ([]*authv1.Connection, error)

func (*ConnectionManager) Read

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

func (*ConnectionManager) Update

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

type ConnectionManagerInterface added in v1.2.6

type ConnectionManagerInterface interface {
	Create(c *authv1.Connection) error
	Read(id string, opts ...ReqOption) (*authv1.Connection, error)
	List(opts ...ReqOption) ([]*authv1.Connection, error)
	Update(id string, c *authv1.Connection) (err error)
	Delete(id string) (err error)
	GetConnectionID(connectionName string) (string, error)
}

func NewConnectionManager

func NewConnectionManager(m *Management) ConnectionManagerInterface

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 Identity added in v1.2.3

type Identity struct {
	Connection *string `json:"connection,omitempty"`
	UserID     *string `json:"user_id,omitempty"`
	Provider   *string `json:"provider,omitempty"`
	IsSocial   *bool   `json:"isSocial,omitempty"`
}

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 ConnectionManagerInterface

	// CustomDomain manages Auth0 Custom Domains.
	CustomDomain *CustomDomainManager

	// Grant manages Auth0 Grants.
	Grant *GrantManager

	// Log reads Auth0 Logs.
	Log *LogManager

	// RoleManager manages Auth0 Roles.
	Role *RoleManager

	// 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 UserManagerInterface

	// 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

	// Branding settings such as company logo or primary color.
	Branding *BrandingManager
	// 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 Permission added in v1.2.3

type Permission struct {
	// The resource server that the permission is attached to.
	ResourceServerIdentifier *string `json:"resource_server_identifier,omitempty"`

	// The name of the resource server.
	ResourceServerName *string `json:"resource_server_name,omitempty"`

	// The name of the permission.
	Name *string `json:"permission_name,omitempty"`

	// The description of the permission.
	Description *string `json:"description,omitempty"`
}

type ReqOption added in v1.2.6

type ReqOption func(url.Values)

ReqOption configures a call (typically to retrieve a resource) to Auth0 with query parameters.

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 WithFields added in v0.1.0

func WithFields(fields ...string) ReqOption

WithFields configures a call to include the desired fields.

func WithoutFields added in v0.1.0

func WithoutFields(fields ...string) ReqOption

WithoutFields configures a call to exclude the desired fields.

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"`

	// Enables the enforcement of the authorization policies.
	EnforcePolicies *bool `json:"enforce_policies,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 Role added in v1.2.3

type Role struct {
	// A unique ID for the role.
	ID *string `json:"id,omitempty"`

	// The name of the role created.
	Name *string `json:"name,omitempty"`

	// A description of the role created.
	Description *string `json:"description,omitempty"`
}

func (*Role) String added in v1.2.3

func (r *Role) String() string

type RoleManager added in v1.2.3

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

func NewRoleManager added in v1.2.3

func NewRoleManager(m *Management) *RoleManager

func (*RoleManager) AssignPermissions added in v1.2.3

func (rm *RoleManager) AssignPermissions(id string, permissions ...*Permission) error

func (*RoleManager) AssignUsers added in v1.2.3

func (rm *RoleManager) AssignUsers(id string, users ...*User) error

func (*RoleManager) Create added in v1.2.3

func (rm *RoleManager) Create(r *Role) error

func (*RoleManager) Delete added in v1.2.3

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

func (*RoleManager) List added in v1.2.3

func (rm *RoleManager) List(opts ...ReqOption) ([]*Role, error)

func (*RoleManager) Permissions added in v1.2.3

func (rm *RoleManager) Permissions(id string, opts ...ReqOption) ([]*Permission, error)

func (*RoleManager) Read added in v1.2.3

func (rm *RoleManager) Read(id string, opts ...ReqOption) (*Role, error)

func (*RoleManager) UnassignPermissions added in v1.2.3

func (rm *RoleManager) UnassignPermissions(id string, permissions ...*Permission) error

func (*RoleManager) Update added in v1.2.3

func (rm *RoleManager) Update(id string, r *Role) (err error)

func (*RoleManager) Users added in v1.2.3

func (rm *RoleManager) Users(id string, opts ...ReqOption) ([]*User, error)

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"`

	// Force a user to login after they have been inactive for the specified number (unit: hours)
	IdleSessionLifetime *int `json:"idle_session_lifetime,omitempty"`

	// Used to store additional metadata
	UniversalLogin *TenantUniversalLogin `json:"universal_login,omitempty"`

	// Supported locales for the UI
	EnabledLocales []interface{} `json:"enabled_locales,omitempty"`

	DeviceFlow *TenantDeviceFlow `json:"device_flow,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 TenantDeviceFlow added in v1.2.3

type TenantDeviceFlow struct {
	// The character set for generating a User Code ['base20' or 'digits']
	Charset *string `json:"charset,omitempty"`

	// The mask used to format the generated User Code to a friendly, readable format with possible spaces or hyphens
	Mask *string `json:"mask,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"`

	// If enabled, users will not be prompted to confirm log in before SSO redirection.
	EnableSSO *bool `json:"enable_sso,omitempty"`

	AllowChangingEnableSso *bool `json:"allow_changing_enable_sso,omitempty"`

	// If enabled, activate the new look and feel for Universal Login
	UniversalLogin *bool `json:"universal_login,omitempty"`

	// If enabled, the legacy Logs Search Engine V2 will be enabled for your account.
	// Turn it off to opt-in for the latest Logs Search Engine V3.
	EnableLegacyLogsSearchV2 *bool `json:"enable_legacy_logs_search_v2,omitempty"`

	// If enabled, additional HTTP security headers will not be included in the response
	// to prevent embedding of the Universal Login prompts in an IFRAME.
	DisableClickjackProtectionHeaders *bool `json:"disable_clickjack_protection_headers,omitempty"`

	// If enabled, this will use a generic response in the public signup API
	// which will prevent users from being able to find out if an e-mail address or username has previously registered
	EnablePublicSignupUserExistsError *bool `json:"enable_public_signup_user_exists_error,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 TenantUniversalLogin added in v1.2.3

type TenantUniversalLogin struct {
	Colors *TenantUniversalLoginColors `json:"colors,omitempty"`
}

type TenantUniversalLoginColors added in v1.2.3

type TenantUniversalLoginColors struct {
	// Primary button background color
	Primary *string `json:"primary,omitempty"`

	// Background color of your login pages
	PageBackground *string `json:"page_background,omitempty"`
}

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 users given name
	GivenName *string `json:"given_name,omitempty"`

	// The users family name
	FamilyName *string `json:"family_name,omitempty"`

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

	// The user's nickname
	Nickname *string `json:"nickname,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"`

	Identities []*Identity `json:"identities,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"`

	// The user's picture url
	Picture *string `json:"picture,omitempty"`
}
Example
package main

import (
	"fmt"
	"os"

	"github.com/confluentinc/auth0"
	"github.com/confluentinc/auth0/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"),
		Username:   auth0.String("smith"),
		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.Print("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 (*UserManager) AssignRoles added in v1.2.3

func (um *UserManager) AssignRoles(id string, roles ...*Role) error

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) GetRoles added in v1.2.3

func (um *UserManager) GetRoles(id string, opts ...ReqOption) (roles []*Role, err error)

func (*UserManager) List added in v0.1.1

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

func (*UserManager) ListByEmail added in v1.2.3

func (um *UserManager) ListByEmail(email string, 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) UnassignRoles added in v1.2.3

func (um *UserManager) UnassignRoles(id string, roles ...*Role) error

func (*UserManager) Update added in v0.1.1

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

type UserManagerInterface added in v1.2.3

type UserManagerInterface interface {
	Create(u *User) error
	Read(id string, opts ...ReqOption) (*User, error)
	Update(id string, u *User) (err error)
	Delete(id string) (err error)
	List(opts ...ReqOption) (us []*User, err error)
	Search(opts ...ReqOption) (us []*User, err error)
	ListByEmail(email string, opts ...ReqOption) (us []*User, err error)
	GetRoles(id string, opts ...ReqOption) (roles []*Role, err error)
	AssignRoles(id string, roles ...*Role) error
	UnassignRoles(id string, roles ...*Role) error
}

func NewUserManager added in v0.1.1

func NewUserManager(m *Management) UserManagerInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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