Documentation
¶
Index ¶
- Constants
- func GetNextRoleUserCheckpointToken(next string) string
- func GetNextToken(page int, limit int, total int) string
- func GetNextUsersToken(page int, limit int, total int, since string, newestCreatedAt *time.Time) (string, error)
- func ParsePaginationToken(pToken *pagination.Token) (int, int, string, error)
- func ParsePaginationTokenString(pToken string) (int, int, string, error)
- func ParseRoleUserCheckpointToken(token string) (string, error)
- func ParseUserPaginationToken(pToken *pagination.Token) (int, int, string, string, *time.Time, error)
- func WithBearerToken(token string) uhttp.RequestOption
- type AuthRequest
- type AuthResponse
- type Client
- func (c *Client) AddUserToOrganization(ctx context.Context, organizationId string, userId string) (*v2.RateLimitDescription, error)
- func (c *Client) AddUserToRole(ctx context.Context, roleId string, userId string) (*v2.RateLimitDescription, error)
- func (c *Client) Authorize(ctx context.Context, clientId string, clientSecret string) error
- func (c *Client) GetOrganizationMembers(ctx context.Context, organizationId string, limit int, page int) ([]User, int, *v2.RateLimitDescription, error)
- func (c *Client) GetOrganizations(ctx context.Context, limit int, page int) ([]Organization, int, *v2.RateLimitDescription, error)
- func (c *Client) GetResourceServer(ctx context.Context, id string) (*ResourceServer, *v2.RateLimitDescription, error)
- func (c *Client) GetResourceServers(ctx context.Context, limit int, page int) ([]*ResourceServer, int, *v2.RateLimitDescription, error)
- func (c *Client) GetRolePermissions(ctx context.Context, id string) ([]*RolePermission, *v2.RateLimitDescription, error)
- func (c *Client) GetRoleUsersCheckpoint(ctx context.Context, roleId string, from string, take int) ([]User, string, *v2.RateLimitDescription, error)
- func (c *Client) GetRoles(ctx context.Context, limit int, page int) ([]Role, int, *v2.RateLimitDescription, error)
- func (c *Client) GetUsers(ctx context.Context, limit int, page int, since string, until string) ([]User, int, *v2.RateLimitDescription, error)
- func (c *Client) List(ctx context.Context, path string, target interface{}, opts ...ReqOpt) (*v2.RateLimitDescription, error)
- func (c *Client) RemoveUserFromOrganization(ctx context.Context, organizationId string, userId string) (*v2.RateLimitDescription, error)
- func (c *Client) RemoveUserFromRole(ctx context.Context, roleId string, userId string) (*v2.RateLimitDescription, error)
- type Organization
- type OrganizationMembersResponse
- type OrganizationsResponse
- type PaginatedResponse
- type Pagination
- type ReqOpt
- type ResourceServer
- type ResourceServerResponse
- type ResourceServerScope
- type Role
- type RolePermission
- type RoleUserCheckpointPagination
- type RolesResponse
- type RolesUsersCheckpointResponse
- type User
- type UserIdentities
- type UserPagination
- type UsersResponse
Constants ¶
const Auth0UserSearchMaxResults = 1000
Auth0UserSearchMaxResults is the hard limit imposed by Auth0's User Search API. Paginating beyond this limit results in a 400 error. See https://auth0.com/docs/manage-users/user-search/view-search-results-by-page#limitation.
const PageSizeDefault = 100
Variables ¶
This section is empty.
Functions ¶
func GetNextRoleUserCheckpointToken ¶ added in v0.0.12
GetNextRoleUserCheckpointToken serializes the checkpoint token returned by Auth0 into a pagination token string. Returns "" when next is empty (no more pages).
func GetNextToken ¶
GetNextToken given a limit and page that were used to fetch _this_ page of data, and total number of resources, return the next pagination token as a string.
func GetNextUsersToken ¶
func ParsePaginationToken ¶
ParsePaginationToken - takes as pagination token and returns page, limit, and `pagingRequestId` in that order.
func ParseRoleUserCheckpointToken ¶ added in v0.0.12
ParseRoleUserCheckpointToken extracts the checkpoint "from" value from a serialized RoleUserCheckpointPagination token. Returns "" for the first page.
func ParseUserPaginationToken ¶
func ParseUserPaginationToken(pToken *pagination.Token) ( int, int, string, string, *time.Time, error, )
ParseUserPaginationToken - takes as pagination token and returns page, limit, also it includes since and until dates to search users, and the date the newest user was created.
func WithBearerToken ¶
func WithBearerToken(token string) uhttp.RequestOption
WithBearerToken - TODO(marcos): move this function to `baton-sdk`.
Types ¶
type AuthRequest ¶
type AuthResponse ¶
type Client ¶
type Client struct {
BearerToken string
BaseUrl *url.URL
// contains filtered or unexported fields
}
func (*Client) AddUserToOrganization ¶
func (*Client) AddUserToRole ¶
func (*Client) GetOrganizationMembers ¶
func (*Client) GetOrganizations ¶
func (c *Client) GetOrganizations( ctx context.Context, limit int, page int, ) ( []Organization, int, *v2.RateLimitDescription, error, )
func (*Client) GetResourceServer ¶
func (c *Client) GetResourceServer( ctx context.Context, id string, ) ( *ResourceServer, *v2.RateLimitDescription, error, )
func (*Client) GetResourceServers ¶
func (c *Client) GetResourceServers( ctx context.Context, limit int, page int, ) ( []*ResourceServer, int, *v2.RateLimitDescription, error, )
func (*Client) GetRolePermissions ¶
func (c *Client) GetRolePermissions( ctx context.Context, id string, ) ( []*RolePermission, *v2.RateLimitDescription, error, )
func (*Client) GetRoleUsersCheckpoint ¶ added in v0.0.12
func (c *Client) GetRoleUsersCheckpoint( ctx context.Context, roleId string, from string, take int, ) ( []User, string, *v2.RateLimitDescription, error, )
GetRoleUsersCheckpoint fetches one page of users assigned to a role using Auth0's checkpoint-based pagination, which has no 1000-record hard cap unlike page-based pagination. Pass an empty "from" to fetch the first page; subsequent pages use the "next" value returned in the previous response.
func (*Client) RemoveUserFromOrganization ¶
func (*Client) RemoveUserFromRole ¶
type Organization ¶
type OrganizationMembersResponse ¶
type OrganizationMembersResponse struct {
Members []User `json:"members"`
PaginatedResponse
}
type OrganizationsResponse ¶
type OrganizationsResponse struct {
Organizations []Organization `json:"organizations"`
PaginatedResponse
}
type PaginatedResponse ¶
type Pagination ¶
type ReqOpt ¶
func WithQueryParam ¶
type ResourceServer ¶
type ResourceServer struct {
Id string `json:"id"`
Name string `json:"name"`
IsSystem bool `json:"is_system"`
Identifier string `json:"identifier"`
Scopes []ResourceServerScope `json:"scopes"`
SigningAlg string `json:"signing_alg"`
AllowOfflineAccess bool `json:"allow_offline_access"`
SkipConsentForVerifiableFirstPartyClients bool `json:"skip_consent_for_verifiable_first_party_clients"`
TokenLifetime int `json:"token_lifetime"`
TokenLifetimeForWeb int `json:"token_lifetime_for_web"`
EnforcePolicies bool `json:"enforce_policies"`
TokenDialect string `json:"token_dialect"`
ConsentPolicy string `json:"consent_policy"`
}
type ResourceServerResponse ¶
type ResourceServerResponse struct {
PaginatedResponse
ResourceServers []*ResourceServer `json:"resource_servers"`
}
type ResourceServerScope ¶
type RolePermission ¶
type RoleUserCheckpointPagination ¶ added in v0.0.12
type RoleUserCheckpointPagination struct {
From string `json:"from,omitempty"`
}
RoleUserCheckpointPagination holds the opaque checkpoint token used by Auth0's checkpoint-based pagination for the GET /api/v2/roles/{id}/users endpoint.
type RolesResponse ¶
type RolesResponse struct {
PaginatedResponse
Roles []Role `json:"roles"`
}
type RolesUsersCheckpointResponse ¶ added in v0.0.12
type RolesUsersCheckpointResponse struct {
Users []User `json:"users"`
// Next is the opaque checkpoint token for the next page; empty when there are no more pages.
Next string `json:"next"`
}
RolesUsersCheckpointResponse is the response shape for Auth0's checkpoint-based pagination on the GET /api/v2/roles/{id}/users endpoint. Unlike page-based pagination, checkpoint pagination has no 1000-record hard cap.
type User ¶
type User struct {
CreatedAt time.Time `json:"created_at"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Identities []UserIdentities `json:"identities"`
Name string `json:"name"`
Nickname string `json:"nickname"`
Picture string `json:"picture"`
UpdatedAt time.Time `json:"updated_at"`
UserId string `json:"user_id"`
}
type UserIdentities ¶
type UserPagination ¶
type UsersResponse ¶
type UsersResponse struct {
PaginatedResponse
Length int `json:"length"`
Users []User `json:"users"`
}