api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidEmail  = newError("invalid_email", "invalid email.", http.StatusBadRequest)
	ErrorVerifiedEmail = newError("verified_email", "Email already verified.", http.StatusBadRequest)

	ErrorInvalidClient = newError("invalid_client", "invalid email.", http.StatusBadRequest)

	ErrorDuplicateEmail   = newError("duplicate_email", "Email already in use.", http.StatusBadRequest)
	ErrorResourceNotFound = newError("resource_not_found", "Resource could not be found.", http.StatusNotFound)

	ErrorUnauthorized = newError("unauthorized", "Necessary credentials not provided.", http.StatusUnauthorized)
	ErrorForbidden    = newError("forbidden", "The given user and client are not authorized to make this request.", http.StatusForbidden)

	ErrorMaxResultsTooHigh = newError("max_results_too_high", fmt.Sprintf("The max number of results per page is %d", maxUsersPerPage), http.StatusBadRequest)

	ErrorInvalidRedirectURL = newError("invalid_redirect_url", "The provided redirect URL is invalid for the given client", http.StatusBadRequest)
)

Functions

This section is empty.

Types

type Creds

type Creds struct {
	ClientID string
	User     user.User
}

type Emailer

type Emailer interface {
	SendInviteEmail(string, url.URL, string) (*url.URL, error)
}

type Error

type Error struct {
	Type string

	// The HTTP Code to return for this type of error.
	Code int

	Desc string

	// The underlying error - not to be consumed by external users.
	Internal error
}

Error is the error type returned by AdminAPI methods.

func (Error) Error

func (e Error) Error() string

type UsersAPI

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

All calls take a Creds object with the ClientID of the calling app and the calling User. It is assumed that the clientID has already validated as an admin app before calling.

func NewUsersAPI

func NewUsersAPI(userManager *usermanager.UserManager, clientManager *clientmanager.ClientManager, refreshRepo refresh.RefreshTokenRepo, emailer Emailer, localConnectorID string) *UsersAPI

TODO(ericchiang): Don't pass a dbMap. See #385.

func (*UsersAPI) Authorize

func (u *UsersAPI) Authorize(creds Creds) bool

func (*UsersAPI) CreateUser

func (u *UsersAPI) CreateUser(creds Creds, usr schema.User, redirURL url.URL) (schema.UserCreateResponse, error)

func (*UsersAPI) DisableUser added in v0.2.0

func (u *UsersAPI) DisableUser(creds Creds, userID string, disable bool) (schema.UserDisableResponse, error)

func (*UsersAPI) GetUser

func (u *UsersAPI) GetUser(creds Creds, id string) (schema.User, error)

func (*UsersAPI) ListClientsWithRefreshTokens added in v0.5.0

func (u *UsersAPI) ListClientsWithRefreshTokens(creds Creds, userID string) ([]*schema.RefreshClient, error)

ListClientsWithRefreshTokens returns all clients issued refresh tokens for the authenticated user.

func (*UsersAPI) ListUsers

func (u *UsersAPI) ListUsers(creds Creds, maxResults int, nextPageToken string) ([]*schema.User, string, error)

func (*UsersAPI) ResendEmailInvitation added in v0.5.0

func (u *UsersAPI) ResendEmailInvitation(creds Creds, userID string, redirURL url.URL) (schema.ResendEmailInvitationResponse, error)

func (*UsersAPI) RevokeRefreshTokensForClient added in v0.5.0

func (u *UsersAPI) RevokeRefreshTokensForClient(creds Creds, userID, clientID string) error

RevokeClient revokes all refresh tokens issued to this client for the authenticiated user.

Jump to

Keyboard shortcuts

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