Documentation ¶
Index ¶
- func IncludeTotals(include bool) reqOption
- func Page(page int) reqOption
- func Parameter(key, value string) reqOption
- func PerPage(items int) reqOption
- func Stringify(v interface{}) string
- func WithContext(ctx context.Context) apiOption
- func WithDebug(d bool) apiOption
- func WithFields(fields ...string) reqOption
- func WithTimeout(t time.Duration) apiOption
- func WithoutFields(fields ...string) reqOption
- type BlacklistManager
- type BlacklistToken
- type Branding
- type BrandingColors
- type BrandingFont
- type BrandingManager
- type Client
- type ClientGrant
- type ClientGrantManager
- func (cg *ClientGrantManager) Create(g *ClientGrant) (err error)
- func (cg *ClientGrantManager) Delete(id string) (err error)
- func (cg *ClientGrantManager) List(opts ...reqOption) (gs []*ClientGrant, err error)
- func (cg *ClientGrantManager) Read(id string) (*ClientGrant, error)
- func (cg *ClientGrantManager) Update(id string, g *ClientGrant) (err error)
- type ClientJWTConfiguration
- type ClientManager
- func (cm *ClientManager) Create(c *Client) (err error)
- func (cm *ClientManager) Delete(id string) (err error)
- func (cm *ClientManager) List(opts ...reqOption) ([]*Client, error)
- func (cm *ClientManager) Read(id string, opts ...reqOption) (*Client, error)
- func (cm *ClientManager) RotateSecret(id string) (*Client, error)
- func (cm *ClientManager) Update(id string, c *Client) (err error)
- type Connection
- type ConnectionManager
- func (cm *ConnectionManager) Create(c *Connection) error
- func (cm *ConnectionManager) Delete(id string) (err error)
- func (cm *ConnectionManager) List(opts ...reqOption) ([]*Connection, error)
- func (cm *ConnectionManager) Read(id string, opts ...reqOption) (*Connection, error)
- func (cm *ConnectionManager) ReadByName(name string, opts ...reqOption) (*Connection, error)
- func (cm *ConnectionManager) Update(id string, c *Connection) (err error)
- type ConnectionOptions
- type ConnectionOptionsTotp
- type CustomDomain
- type CustomDomainManager
- func (cm *CustomDomainManager) Create(c *CustomDomain) (err error)
- func (cm *CustomDomainManager) Delete(id string) (err error)
- func (cm *CustomDomainManager) List(opts ...reqOption) ([]*CustomDomain, error)
- func (cm *CustomDomainManager) Read(id string, opts ...reqOption) (*CustomDomain, error)
- func (cm *CustomDomainManager) Verify(id string) (*CustomDomain, error)
- type CustomDomainVerification
- type DailyStat
- type Email
- type EmailCredentials
- type EmailManager
- type EmailTemplate
- type EmailTemplateManager
- func (em *EmailTemplateManager) Create(e *EmailTemplate) error
- func (em *EmailTemplateManager) Read(template string, opts ...reqOption) (*EmailTemplate, error)
- func (em *EmailTemplateManager) Replace(template string, e *EmailTemplate) (err error)
- func (em *EmailTemplateManager) Update(template string, e *EmailTemplate) (err error)
- type Error
- type Grant
- type GrantManager
- type GuardianManager
- type Identity
- type Job
- type JobManager
- type Log
- type LogManager
- type Management
- type MultiFactor
- type MultiFactorDUO
- type MultiFactorEmail
- type MultiFactorManager
- type MultiFactorOTP
- type MultiFactorProviderAmazonSNS
- type MultiFactorProviderTwilio
- type MultiFactorPush
- type MultiFactorSMS
- func (sm *MultiFactorSMS) Enable(enabled bool) error
- func (sm *MultiFactorSMS) Template() (*MultiFactorSMSTemplate, error)
- func (sm *MultiFactorSMS) Twilio() (*MultiFactorProviderTwilio, error)
- func (sm *MultiFactorSMS) UpdateTemplate(st *MultiFactorSMSTemplate) error
- func (sm *MultiFactorSMS) UpdateTwilio(twilio *MultiFactorProviderTwilio) error
- type MultiFactorSMSTemplate
- type Permission
- type Prompt
- type PromptManager
- type ResourceServer
- type ResourceServerManager
- func (r *ResourceServerManager) Create(rs *ResourceServer) (err error)
- func (r *ResourceServerManager) Delete(id string) (err error)
- func (r *ResourceServerManager) List(opts ...reqOption) ([]*ResourceServer, error)
- func (r *ResourceServerManager) Read(id string, opts ...reqOption) (*ResourceServer, error)
- func (r *ResourceServerManager) Update(id string, rs *ResourceServer) (err error)
- type ResourceServerScope
- type Role
- type RoleManager
- func (rm *RoleManager) AssignUsers(id string, users ...*User) error
- func (rm *RoleManager) AssociatePermissions(id string, permissions ...*Permission) error
- func (rm *RoleManager) Create(r *Role) error
- func (rm *RoleManager) Delete(id string) (err error)
- func (rm *RoleManager) List(opts ...reqOption) ([]*Role, error)
- func (rm *RoleManager) Permissions(id string, opts ...reqOption) ([]*Permission, error)
- func (rm *RoleManager) Read(id string, opts ...reqOption) (*Role, error)
- func (rm *RoleManager) RemovePermissions(id string, permissions ...*Permission) error
- func (rm *RoleManager) Update(id string, r *Role) (err error)
- func (rm *RoleManager) Users(id string, opts ...reqOption) ([]*User, error)
- type Rule
- type RuleConfig
- type RuleConfigManager
- type RuleManager
- type StatManager
- type Tenant
- type TenantChangePassword
- type TenantDeviceFlow
- type TenantErrorPage
- type TenantFlags
- type TenantGuardianMFAPage
- type TenantManager
- type TenantUniversalLogin
- type TenantUniversalLoginColors
- type Ticket
- type TicketManager
- type User
- type UserManager
- func (um *UserManager) AssignPermissions(id string, permissions ...*Permission) error
- func (um *UserManager) AssignRoles(id string, roles ...*Role) error
- func (um *UserManager) Create(u *User) error
- func (um *UserManager) Delete(id string) (err error)
- func (um *UserManager) GetRoles(id string, opts ...reqOption) (roles []*Role, err error)
- func (um *UserManager) List(opts ...reqOption) (us []*User, err error)
- func (um *UserManager) ListByEmail(email string, opts ...reqOption) (us []*User, err error)
- func (um *UserManager) Permissions(id string, opts ...reqOption) (permissions []*Permission, err error)
- func (um *UserManager) Read(id string, opts ...reqOption) (*User, error)
- func (um *UserManager) RemovePermissions(id string, permissions ...*Permission) error
- func (um *UserManager) RemoveRoles(id string, roles ...*Role) error
- func (um *UserManager) Search(opts ...reqOption) (us []*User, err error)
- func (um *UserManager) Update(id string, u *User) (err error)
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 Stringify ¶ added in v1.3.0
func Stringify(v interface{}) string
Stringify returns a string representation of the value passed as an argument.
func WithContext ¶ added in v1.3.0
WitContext configures the management client to use the provided context instead of the provided one.
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
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 BlacklistManager ¶ added in v1.3.0
type BlacklistManager struct {
// contains filtered or unexported fields
}
func NewBlacklistManager ¶ added in v1.3.0
func NewBlacklistManager(m *Management) *BlacklistManager
func (*BlacklistManager) Create ¶ added in v1.3.0
func (bm *BlacklistManager) Create(bt *BlacklistToken) error
Blacklist a token.
See: https://auth0.com/docs/api/management/v2#!/Blacklists/post_tokens
func (*BlacklistManager) List ¶ added in v1.3.0
func (bm *BlacklistManager) List() (bl []*BlacklistToken, err error)
Retrieve all tokens that are blacklisted.
Note: The JWT specification states that the `jti` field can be used to prevent replay attacks. Though Auth0 tokens do not include a `jti`, you can nevertheless blacklist a `jti` to prevent a token being used more than a predetermined number of times. This behavior is similar to implementing a nonce (where the token's signature can be thought of as the nonce). If a token gets stolen, it (or the tokens issued after it) should be blacklisted and let expire.
See: https://auth0.com/docs/api/management/v2#!/Blacklists/get_tokens
type BlacklistToken ¶ added in v1.3.0
type BlacklistToken struct { // The "aud" (audience) claim identifies the recipients that the JWT is // intended for. // // See: https://tools.ietf.org/html/rfc7519#section-4.1.3 Audience string `json:"aud,omitempty"` // The "jti" (JWT ID) claim provides a unique (within "aud") identifier for // the JWT. // // See: https://tools.ietf.org/html/rfc7519#section-4.1.7 JTI string `json:"jti,omitempty"` }
func (*BlacklistToken) String ¶ added in v1.3.0
func (b *BlacklistToken) String() string
type Branding ¶ added in v1.3.0
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"` }
type BrandingColors ¶ added in v1.3.0
type BrandingFont ¶ added in v1.3.0
type BrandingFont struct { // URL for the custom font. Must use HTTPS. URL *string `json:"url,omitempty"` }
type BrandingManager ¶ added in v1.3.0
type BrandingManager struct {
// contains filtered or unexported fields
}
func NewBrandingManager ¶ added in v1.3.0
func NewBrandingManager(m *Management) *BrandingManager
func (*BrandingManager) Read ¶ added in v1.3.0
func (bm *BrandingManager) Read(opts ...reqOption) (*Branding, error)
Retrieve various settings related to branding.
See: https://auth0.com/docs/api/management/v2#!/Branding/get_branding
func (*BrandingManager) Update ¶ added in v1.3.0
func (bm *BrandingManager) Update(t *Branding) (err error)
Update various fields related to branding.
See: https://auth0.com/docs/api/management/v2#!/Branding/patch_branding
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/Innov8-Indonesia/auth0" "github.com/Innov8-Indonesia/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!
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)
Create a client grant.
See: https://auth0.com/docs/api/management/v2#!/Client_Grants/post_client_grants
func (*ClientGrantManager) Delete ¶
func (cg *ClientGrantManager) Delete(id string) (err error)
Delete a client grant.
See: https://auth0.com/docs/api/management/v2#!/Client_Grants/delete_client_grants_by_id
func (*ClientGrantManager) List ¶ added in v1.3.0
func (cg *ClientGrantManager) List(opts ...reqOption) (gs []*ClientGrant, err error)
Retrieve client grants.
See: https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants
func (*ClientGrantManager) Read ¶
func (cg *ClientGrantManager) Read(id string) (*ClientGrant, error)
Retrieves a client grant by its id.
The Auth0 Management API does not offer a method to retrieve a client grant by id, we fake this by listing all client grants and matching by id on the client side. For this reason this method should be used with caution.
func (*ClientGrantManager) Update ¶
func (cg *ClientGrantManager) Update(id string, g *ClientGrant) (err error)
Update a client grant.
See: https://auth0.com/docs/api/management/v2#!/Client_Grants/patch_client_grants_by_id
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)
Creates a new client application.
See: https://auth0.com/docs/api/management/v2#!/Clients/post_clients
func (*ClientManager) Delete ¶
func (cm *ClientManager) Delete(id string) (err error)
Deletes a client and all its related assets (like rules, connections, etc) given its id.
See: https://auth0.com/docs/api/management/v2#!/Clients/delete_clients_by_id
func (*ClientManager) List ¶ added in v0.2.1
func (cm *ClientManager) List(opts ...reqOption) ([]*Client, error)
Retrieves a list of all client applications.
See: https://auth0.com/docs/api/management/v2#!/Clients/get_clients
func (*ClientManager) Read ¶
func (cm *ClientManager) Read(id string, opts ...reqOption) (*Client, error)
Retrieves a client by its id.
See: https://auth0.com/docs/api/management/v2#!/Clients/get_clients_by_id
func (*ClientManager) RotateSecret ¶ added in v0.2.1
func (cm *ClientManager) RotateSecret(id string) (*Client, error)
Rotate a client secret.
See: https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret
func (*ClientManager) Update ¶
func (cm *ClientManager) Update(id string, c *Client) (err error)
Updates a client.
See: https://auth0.com/docs/api/management/v2#!/Clients/patch_clients_by_id
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
Creates a new connection.
See: https://auth0.com/docs/api/management/v2#!/Connections/post_connections
func (*ConnectionManager) Delete ¶
func (cm *ConnectionManager) Delete(id string) (err error)
Deletes a connection and all its users.
See: https://auth0.com/docs/api/management/v2#!/Connections/delete_connections_by_id
func (*ConnectionManager) List ¶ added in v1.3.0
func (cm *ConnectionManager) List(opts ...reqOption) ([]*Connection, error)
Retrieves every connection matching the specified strategy.
See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections
func (*ConnectionManager) Read ¶
func (cm *ConnectionManager) Read(id string, opts ...reqOption) (*Connection, error)
Retrieves a connection by its id.
See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id
func (*ConnectionManager) ReadByName ¶ added in v1.3.0
func (cm *ConnectionManager) ReadByName(name string, opts ...reqOption) (*Connection, error)
Retrieves a connection by its name. This is a helper method when a connection id is not readily available.
func (*ConnectionManager) Update ¶
func (cm *ConnectionManager) Update(id string, c *Connection) (err error)
Updates a connection.
Note: if you use the options parameter, the whole options object will be overridden, so ensure that all parameters are present.
See: https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id
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"` // Options for password complexity options. PasswordComplexityOptions map[string]interface{} `json:"password_complexity_options,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"` // Options to add integration with Twilio // https://community.auth0.com/t/using-management-api-to-create-a-twilio-connection/23576/3 Totp *ConnectionOptionsTotp `json:"totp,omitempty"` Name *string `json:"name,omitempty"` TwilioSid *string `json:"twilio_sid,omitempty"` TwilioToken *string `json:"twilio_token,omitempty"` From *string `json:"from,omitempty"` Syntax *string `json:"syntax,omitempty"` Template *string `json:"template,omitempty"` MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` // Adfs AdfsServer *string `json:"adfs_server,omitempty"` // Salesforce community CommunityBaseURL *string `json:"community_base_url"` }
ConnectionOptions general options
type ConnectionOptionsTotp ¶ added in v1.3.0
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)
Create a new custom domain.
Note: The custom domain will need to be verified before it starts accepting requests.
See: https://auth0.com/docs/api/management/v2#!/Custom_Domains/post_custom_domains
func (*CustomDomainManager) Delete ¶
func (cm *CustomDomainManager) Delete(id string) (err error)
Delete a custom domain and stop serving requests for it.
See: https://auth0.com/docs/api/management/v2#!/Custom_Domains/delete_custom_domains_by_id
func (*CustomDomainManager) List ¶ added in v1.3.0
func (cm *CustomDomainManager) List(opts ...reqOption) ([]*CustomDomain, error)
Retrieve a list of custom domains.
See: https://auth0.com/docs/api/management/v2#!/Custom_Domains/get_custom_domains
func (*CustomDomainManager) Read ¶
func (cm *CustomDomainManager) Read(id string, opts ...reqOption) (*CustomDomain, error)
Retrieve a custom domain configuration and status.
See: https://auth0.com/docs/api/management/v2#!/Custom_Domains/get_custom_domains_by_id
func (*CustomDomainManager) Verify ¶ added in v1.3.0
func (cm *CustomDomainManager) Verify(id string) (*CustomDomain, error)
Run the verification process on a custom domain.
See: https://auth0.com/docs/api/management/v2#!/Custom_Domains/post_verify
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 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"` }
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
Create an email provider.
The credentials object requires different properties depending on the email provider (which is specified using the name property):
- `mandrill` requires `api_key` - `sendgrid` requires `api_key` - `sparkpost` requires `api_key`. Optionally, set `region` to `eu` to use the SparkPost service hosted in Western Europe; set to `null` to use the SparkPost service hosted in North America. `eu` or `null` are the only valid values for `region`. - ses requires accessKeyId, secretAccessKey, and region - smtp requires smtp_host, smtp_port, smtp_user, and smtp_pass
Depending on the type of provider it is possible to specify settings object with different configuration options, which will be used when sending an email:
- `smtp` provider, `settings` may contain `headers` object. When using AWS SES SMTP host, you may provide a name of configuration set in an `X-SES-Configuration-Set` header. The value must be a string.
See: https://auth0.com/docs/api/management/v2#!/Emails/post_provider
func (*EmailManager) Delete ¶
func (em *EmailManager) Delete() (err error)
Delete the email provider.
See: https://auth0.com/docs/api/management/v2#!/Emails/delete_provider
func (*EmailManager) Read ¶
func (em *EmailManager) Read(opts ...reqOption) (*Email, error)
Retrieve email provider details.
See: https://auth0.com/docs/api/management/v2#!/Emails/get_provider
func (*EmailManager) Update ¶
func (em *EmailManager) Update(e *Email) (err error)
Update an email provider.
See: https://auth0.com/docs/api/management/v2#!/Emails/patch_provider
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,omitempty"` // 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,omitempty"` }
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
Create an email template.
See: https://auth0.com/docs/api/management/v2#!/Email_Templates/post_email_templates
func (*EmailTemplateManager) Read ¶
func (em *EmailTemplateManager) Read(template string, opts ...reqOption) (*EmailTemplate, error)
Retrieve an email template by pre-defined name.
These names are `verify_email`, `reset_email`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, and `mfa_oob_code`.
The names `change_password`, and `password_reset` are also supported for legacy scenarios.
See: https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName
func (*EmailTemplateManager) Replace ¶ added in v0.0.11
func (em *EmailTemplateManager) Replace(template string, e *EmailTemplate) (err error)
Replace an email template.
See: https://auth0.com/docs/api/management/v2#!/Email_Templates/put_email_templates_by_templateName
func (*EmailTemplateManager) Update ¶
func (em *EmailTemplateManager) Update(template string, e *EmailTemplate) (err error)
Modify an email template.
See: https://auth0.com/docs/api/management/v2#!/Email_Templates/patch_email_templates_by_templateName
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"` }
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)
List the grants associated with your account.
See: https://auth0.com/docs/api/management/v2#!/Grants/get_grants
type GuardianManager ¶ added in v1.3.0
type GuardianManager struct {
MultiFactor *MultiFactorManager
}
func NewGuardianManager ¶ added in v1.3.0
func NewGuardianManager(m *Management) *GuardianManager
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"` }
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
Export all users to a file via a long-running job.
See: https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports
func (*JobManager) ImportUsers ¶ added in v1.1.0
func (jm *JobManager) ImportUsers(j *Job) error
Import users from a formatted file into a connection via a long-running job.
See: https://auth0.com/docs/api/management/v2#!/Jobs/post_users_imports
func (*JobManager) Read ¶ added in v1.1.0
func (jm *JobManager) Read(id string, opts ...reqOption) (*Job, error)
Retrieves a job. Useful to check its status.
See: https://auth0.com/docs/api/management/v2#!/Jobs/get_jobs_by_id
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"` }
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)
Retrieves log entries that match the specified search criteria (or lists all log entries if no criteria are used). Set custom search criteria using the `q` parameter, or search from a specific log id ("search from checkpoint").
For more information on all possible event types, their respective acronyms and descriptions, Log Data Event Listing.
See: https://auth0.com/docs/api/management/v2#!/Logs/get_logs
func (*LogManager) Read ¶ added in v0.2.1
func (lm *LogManager) Read(id string, opts ...reqOption) (*Log, error)
Retrieves the data related to the log entry identified by id. This returns a single log entry representation as specified in the schema.
See: https://auth0.com/docs/api/management/v2#!/Logs/get_logs_by_id
func (*LogManager) Search ¶ added in v0.2.1
func (lm *LogManager) Search(opts ...reqOption) ([]*Log, error)
Search is an alias for List
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 // 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 *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 // Branding settings such as company logo or primary color. Branding *BrandingManager // Guardian manages your Auth0 Guardian settings Guardian *GuardianManager // Prompt manages your prompt settings. Prompt *PromptManager // Blacklist manages the auth0 blacklists Blacklist *BlacklistManager // 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 MultiFactor ¶ added in v1.3.0
type MultiFactor struct { // States if this factor is enabled Enabled *bool `json:"enabled,omitempty"` // Guardian Factor name Name *string `json:"name,omitempty"` // For factors with trial limits (e.g. SMS) states if those limits have been exceeded TrialExpired *bool `json:"trial_expired,omitempty"` }
func (*MultiFactor) String ¶ added in v1.3.0
func (mfa *MultiFactor) String() string
type MultiFactorDUO ¶ added in v1.3.0
type MultiFactorDUO struct {
// contains filtered or unexported fields
}
func (*MultiFactorDUO) Enable ¶ added in v1.3.0
func (em *MultiFactorDUO) Enable(enabled bool) error
Enable enables or disables DUO Security Multi-factor Authentication.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
type MultiFactorEmail ¶ added in v1.3.0
type MultiFactorEmail struct {
// contains filtered or unexported fields
}
func (*MultiFactorEmail) Enable ¶ added in v1.3.0
func (em *MultiFactorEmail) Enable(enabled bool) error
Enable enables or disables the Email Multi-factor Authentication.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
type MultiFactorManager ¶ added in v1.3.0
type MultiFactorManager struct { SMS *MultiFactorSMS Push *MultiFactorPush Email *MultiFactorEmail DUO *MultiFactorDUO OTP *MultiFactorOTP // contains filtered or unexported fields }
func (*MultiFactorManager) List ¶ added in v1.3.0
func (mfm *MultiFactorManager) List(opts ...reqOption) ([]*MultiFactor, error)
Retrieves all factors.
See: https://auth0.com/docs/api/management/v2#!/Guardian/get_factors
type MultiFactorOTP ¶ added in v1.3.0
type MultiFactorOTP struct {
// contains filtered or unexported fields
}
func (*MultiFactorOTP) Enable ¶ added in v1.3.0
func (em *MultiFactorOTP) Enable(enabled bool) error
Enable enables or disables One-time Password Multi-factor Authentication.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
type MultiFactorProviderAmazonSNS ¶ added in v1.3.0
type MultiFactorProviderAmazonSNS struct { // AWS Access Key ID AccessKeyID *string `json:"aws_access_key_id,omitempty"` // AWS Secret Access Key ID SecretAccessKeyID *string `json:"aws_secret_access_key,omitempty"` // AWS Region Region *string `json:"aws_region,omitempty"` // SNS APNS Platform Application ARN APNSPlatformApplicationARN *string `json:"sns_apns_platform_application_arn,omitempty"` // SNS GCM Platform Application ARN GCMPlatformApplicationARN *string `json:"sns_gcm_platform_application_arn,omitempty"` }
func (*MultiFactorProviderAmazonSNS) String ¶ added in v1.3.0
func (sns *MultiFactorProviderAmazonSNS) String() string
type MultiFactorProviderTwilio ¶ added in v1.3.0
type MultiFactorProviderTwilio struct { // From number From *string `json:"from,omitempty"` // Copilot SID MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` // Twilio Authentication token AuthToken *string `json:"auth_token,omitempty"` // Twilio SID SID *string `json:"sid,omitempty"` }
func (*MultiFactorProviderTwilio) String ¶ added in v1.3.0
func (twilio *MultiFactorProviderTwilio) String() string
type MultiFactorPush ¶ added in v1.3.0
type MultiFactorPush struct {
// contains filtered or unexported fields
}
func (*MultiFactorPush) AmazonSNS ¶ added in v1.3.0
func (pm *MultiFactorPush) AmazonSNS() (*MultiFactorProviderAmazonSNS, error)
AmazonSNS returns the Amazon Web Services (AWS) Simple Notification Service (SNS) provider configuration.
See: https://auth0.com/docs/api/management/v2#!/Guardian/get_sns
func (*MultiFactorPush) Enable ¶ added in v1.3.0
func (pm *MultiFactorPush) Enable(enabled bool) error
Enable enables or disables the Push Notification (via Auth0 Guardian) Multi-factor Authentication.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
func (*MultiFactorPush) UpdateAmazonSNS ¶ added in v1.3.0
func (pm *MultiFactorPush) UpdateAmazonSNS(sc *MultiFactorProviderAmazonSNS) error
UpdateAmazonSNS updates the Amazon Web Services (AWS) Simple Notification Service (SNS) provider configuration.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_sns
type MultiFactorSMS ¶ added in v1.3.0
type MultiFactorSMS struct {
// contains filtered or unexported fields
}
func (*MultiFactorSMS) Enable ¶ added in v1.3.0
func (sm *MultiFactorSMS) Enable(enabled bool) error
Enable enables or disables the SMS Multi-factor Authentication.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
func (*MultiFactorSMS) Template ¶ added in v1.3.0
func (sm *MultiFactorSMS) Template() (*MultiFactorSMSTemplate, error)
Template retrieves enrollment and verification templates. You can use this to check the current values for your templates.
See: https://auth0.com/docs/api/management/v2#!/Guardian/get_templates
func (*MultiFactorSMS) Twilio ¶ added in v1.3.0
func (sm *MultiFactorSMS) Twilio() (*MultiFactorProviderTwilio, error)
Twilio returns the Twilio provider configuration.
See: https://auth0.com/docs/api/management/v2#!/Guardian/get_twilio
func (*MultiFactorSMS) UpdateTemplate ¶ added in v1.3.0
func (sm *MultiFactorSMS) UpdateTemplate(st *MultiFactorSMSTemplate) error
UpdateTemplate updates the enrollment and verification templates. It's useful to send custom messages on SMS enrollment and verification.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_templates
func (*MultiFactorSMS) UpdateTwilio ¶ added in v1.3.0
func (sm *MultiFactorSMS) UpdateTwilio(twilio *MultiFactorProviderTwilio) error
UpdateTwilio updates the Twilio provider configuration.
See: https://auth0.com/docs/api/management/v2#!/Guardian/put_twilio
type MultiFactorSMSTemplate ¶ added in v1.3.0
type MultiFactorSMSTemplate struct { // Message sent to the user when they are invited to enroll with a phone number EnrollmentMessage *string `json:"enrollment_message,omitempty"` // Message sent to the user when they are prompted to verify their account VerificationMessage *string `json:"verification_message,omitempty"` }
func (*MultiFactorSMSTemplate) String ¶ added in v1.3.0
func (sms *MultiFactorSMSTemplate) String() string
type Permission ¶ added in v1.3.0
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 Prompt ¶ added in v1.3.0
type Prompt struct { // Which login experience to use. Can be `new` or `classic`. UniversalLoginExperience string `json:"universal_login_experience,omitempty"` }
type PromptManager ¶ added in v1.3.0
type PromptManager struct {
// contains filtered or unexported fields
}
func NewPromptManager ¶ added in v1.3.0
func NewPromptManager(m *Management) *PromptManager
func (*PromptManager) Read ¶ added in v1.3.0
func (pm *PromptManager) Read() (*Prompt, error)
Read retrieves prompts settings.
See: https://auth0.com/docs/api/management/v2#!/Prompts/get_prompts
func (*PromptManager) Update ¶ added in v1.3.0
func (pm *PromptManager) Update(p *Prompt) error
Update prompts settings.
See: https://auth0.com/docs/api/management/v2#!/Prompts/patch_prompts
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"` // The dialect for the access token ["access_token" or "access_token_authz"]. TokenDialect *string `json:"token_dialect,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)
Creates a resource server.
See: https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers
func (*ResourceServerManager) Delete ¶
func (r *ResourceServerManager) Delete(id string) (err error)
Delete a resource server.
See: https://auth0.com/docs/api/management/v2#!/Resource_Servers/delete_resource_servers_by_id
func (*ResourceServerManager) List ¶ added in v1.3.0
func (r *ResourceServerManager) List(opts ...reqOption) ([]*ResourceServer, error)
Get all resource server
See: https://auth0.com/docs/api/management/v2#!/Resource_Servers/get_resource_servers
func (*ResourceServerManager) Read ¶
func (r *ResourceServerManager) Read(id string, opts ...reqOption) (*ResourceServer, error)
Retrieves a resource server by its id or audience.
See: https://auth0.com/docs/api/management/v2#!/Resource_Servers/get_resource_servers_by_id
func (*ResourceServerManager) Update ¶
func (r *ResourceServerManager) Update(id string, rs *ResourceServer) (err error)
Updates a resource server.
See: https://auth0.com/docs/api/management/v2#!/Resource_Servers/patch_resource_servers_by_id
type ResourceServerScope ¶
type Role ¶ added in v1.3.0
type RoleManager ¶ added in v1.3.0
type RoleManager struct {
// contains filtered or unexported fields
}
func NewRoleManager ¶ added in v1.3.0
func NewRoleManager(m *Management) *RoleManager
func (*RoleManager) AssignUsers ¶ added in v1.3.0
func (rm *RoleManager) AssignUsers(id string, users ...*User) error
Assign users to a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/post_role_users
func (*RoleManager) AssociatePermissions ¶ added in v1.3.0
func (rm *RoleManager) AssociatePermissions(id string, permissions ...*Permission) error
Associate permissions with a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/post_role_permission_assignment
func (*RoleManager) Create ¶ added in v1.3.0
func (rm *RoleManager) Create(r *Role) error
Create a new role.
See: https://auth0.com/docs/api/management/v2#!/Roles/post_roles
func (*RoleManager) Delete ¶ added in v1.3.0
func (rm *RoleManager) Delete(id string) (err error)
Delete a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/delete_roles_by_id
func (*RoleManager) List ¶ added in v1.3.0
func (rm *RoleManager) List(opts ...reqOption) ([]*Role, error)
Retrieve a list of roles that can be assigned to users or groups.
See: https://auth0.com/docs/api/management/v2#!/Roles/get_roles
func (*RoleManager) Permissions ¶ added in v1.3.0
func (rm *RoleManager) Permissions(id string, opts ...reqOption) ([]*Permission, error)
Retrieve list of permissions granted by a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/get_role_permission
func (*RoleManager) Read ¶ added in v1.3.0
func (rm *RoleManager) Read(id string, opts ...reqOption) (*Role, error)
Retrieve a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/get_roles_by_id
func (*RoleManager) RemovePermissions ¶ added in v1.3.0
func (rm *RoleManager) RemovePermissions(id string, permissions ...*Permission) error
Remove permissions associated with a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/delete_role_permission_assignment
func (*RoleManager) Update ¶ added in v1.3.0
func (rm *RoleManager) Update(id string, r *Role) (err error)
Update a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/patch_roles_by_id
func (*RoleManager) Users ¶ added in v1.3.0
func (rm *RoleManager) Users(id string, opts ...reqOption) ([]*User, error)
Retrieve users associated with a role.
See: https://auth0.com/docs/api/management/v2#!/Roles/get_role_user
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"` }
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)
Delete a rules config variable identified by its key.
See: https://auth0.com/docs/api/management/v2#!/Rules_Configs/delete_rules_configs_by_key
func (*RuleConfigManager) Read ¶
func (rm *RuleConfigManager) Read(key string) (*RuleConfig, error)
Retrieve rules config variable keys.
Note: For security, config variable values cannot be retrieved outside rule execution.
See: https://auth0.com/docs/api/management/v2#!/Rules_Configs/get_rules_configs
func (*RuleConfigManager) Upsert ¶
func (rm *RuleConfigManager) Upsert(key string, r *RuleConfig) (err error)
Sets a rules config variable.
See: https://auth0.com/docs/api/management/v2#!/Rules_Configs/put_rules_configs_by_key
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
Create a new rule.
Note: Changing a rule's stage of execution from the default `login_success` can change the rule's function signature to have user omitted.
See: https://auth0.com/docs/api/management/v2#!/Rules/post_rules
func (*RuleManager) Delete ¶
func (rm *RuleManager) Delete(id string) (err error)
Delete a rule.
See: https://auth0.com/docs/api/management/v2#!/Rules/delete_rules_by_id
func (*RuleManager) Read ¶
func (rm *RuleManager) Read(id string, opts ...reqOption) (*Rule, error)
Retrieve rule details. Accepts a list of fields to include or exclude in the result.
See: https://auth0.com/docs/api/management/v2#!/Rules/get_rules_by_id
func (*RuleManager) Update ¶
func (rm *RuleManager) Update(id string, r *Rule) (err error)
Update an existing rule.
See: https://auth0.com/docs/api/management/v2#!/Rules/patch_rules_by_id
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)
Retrieve the number of active users that logged in during the last 30 days.
See: https://auth0.com/docs/api/management/v2#!/Stats/get_active_users
func (*StatManager) Daily ¶ added in v0.2.0
func (sm *StatManager) Daily(opts ...reqOption) ([]*DailyStat, error)
Retrieve the number of logins, signups and breached-password detections (subscription required) that occurred each day within a specified date range.
See: https://auth0.com/docs/api/management/v2#!/Stats/get_daily
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"` }
type TenantChangePassword ¶ added in v0.2.0
type TenantDeviceFlow ¶ added in v1.3.0
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 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)
Retrieve tenant settings. A list of fields to include or exclude may also be specified.
See: https://auth0.com/docs/api/management/v2#!/Tenants/get_settings
func (*TenantManager) Update ¶ added in v0.2.0
func (tm *TenantManager) Update(t *Tenant) (err error)
Update settings for a tenant.
See: https://auth0.com/docs/api/management/v2#!/Tenants/patch_settings
type TenantUniversalLogin ¶ added in v1.3.0
type TenantUniversalLogin struct {
Colors *TenantUniversalLoginColors `json:"colors,omitempty"`
}
type TenantUniversalLoginColors ¶ added in v1.3.0
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"` // Whether to set the email_verified attribute to true (true) or whether it // should not be updated MarkEmailAsVerified *bool `json:"mark_email_as_verified,omitempty"` }
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)
Create a password change ticket for a user.
See: https://auth0.com/docs/api/management/v2#!/Tickets/post_password_change
func (*TicketManager) VerifyEmail ¶ added in v0.2.0
func (tm *TicketManager) VerifyEmail(t *Ticket) (*Ticket, error)
Create a ticket to verify a user's email address.
See: https://auth0.com/docs/api/management/v2#!/Tickets/post_email_verification
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"` // True if the user is blocked from the application, false if the user is enabled Blocked *bool `json:"blocked,omitempty"` }
Example ¶
package main import ( "fmt" "os" "github.com/Innov8-Indonesia/auth0" "github.com/Innov8-Indonesia/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!
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) AssignPermissions ¶ added in v1.3.0
func (um *UserManager) AssignPermissions(id string, permissions ...*Permission) error
Assign permissions to the user.
See: https://auth0.com/docs/api/management/v2#!/Users/post_permissions
func (*UserManager) AssignRoles ¶ added in v1.3.0
func (um *UserManager) AssignRoles(id string, roles ...*Role) error
Assign roles to a user.
See: https://auth0.com/docs/api/management/v2#!/Users/post_user_roles
func (*UserManager) Create ¶ added in v0.1.1
func (um *UserManager) Create(u *User) error
Creates a new user. It works only for database and passwordless connections.
The samples on the right show you every attribute that could be used. The attribute connection is always mandatory but depending on the type of connection you are using there could be others too. For instance, database connections require `email` and `password`.
See: https://auth0.com/docs/api/management/v2#!/Users/post_users
func (*UserManager) Delete ¶ added in v0.1.1
func (um *UserManager) Delete(id string) (err error)
This endpoint can be used to delete a single user based on the id.
See: https://auth0.com/docs/api/management/v2#!/Users/delete_users_by_id
func (*UserManager) GetRoles ¶ added in v1.3.0
func (um *UserManager) GetRoles(id string, opts ...reqOption) (roles []*Role, err error)
List the the roles associated with a user.
See: https://auth0.com/docs/api/management/v2#!/Users/get_user_roles
func (*UserManager) List ¶ added in v0.1.1
func (um *UserManager) List(opts ...reqOption) (us []*User, err error)
This endpoint can be used to retrieve a list of users.
See: https://auth0.com/docs/api/management/v2#!/Users/get_users
func (*UserManager) ListByEmail ¶ added in v1.3.0
func (um *UserManager) ListByEmail(email string, opts ...reqOption) (us []*User, err error)
If Auth0 is the identify provider (idP), the email address associated with a user is saved in lower case, regardless of how you initially provided it. For example, if you register a user as JohnSmith@example.com, Auth0 saves the user's email as johnsmith@example.com.
In cases where Auth0 is not the idP, the `email` is stored based on the rules of idP, so make sure the search is made using the correct capitalization.
When using this endpoint, make sure that you are searching for users via email addresses using the correct case.
See: https://auth0.com/docs/api/management/v2#!/Users_By_Email/get_users_by_email
func (*UserManager) Permissions ¶ added in v1.3.0
func (um *UserManager) Permissions(id string, opts ...reqOption) (permissions []*Permission, err error)
List the permissions associated to the user.
See: https://auth0.com/docs/api/management/v2#!/Users/get_permissions
func (*UserManager) Read ¶ added in v0.1.1
func (um *UserManager) Read(id string, opts ...reqOption) (*User, error)
This endpoint can be used to retrieve user details given the user_id.
See: https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
func (*UserManager) RemovePermissions ¶ added in v1.3.0
func (um *UserManager) RemovePermissions(id string, permissions ...*Permission) error
Removes permissions from a user.
See: https://auth0.com/docs/api/management/v2#!/Users/delete_permissions
func (*UserManager) RemoveRoles ¶ added in v1.3.0
func (um *UserManager) RemoveRoles(id string, roles ...*Role) error
Removes roles from a user.
See: https://auth0.com/docs/api/management/v2#!/Users/delete_user_roles
func (*UserManager) Search ¶ added in v0.2.1
func (um *UserManager) Search(opts ...reqOption) (us []*User, err error)
Search is an alias for List.
func (*UserManager) Update ¶ added in v0.1.1
func (um *UserManager) Update(id string, u *User) (err error)
Updates a user.
The following attributes can be updated at the root level:
- `app_metadata` - `blocked` - `email` - `email_verified` - `family_name` - `given_name` - `name` - `nickname` - `password` - `phone_number` - `phone_verified` - `picture` - `username` - `user_metadata` - `verify_email`
See: https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id