ident

package
v0.0.0-...-09899ef Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApplicationOrganization

func CreateApplicationOrganization(token, applicationID string, params map[string]interface{}) error

CreateApplicationOrganization associates an organization with an application

func CreateApplicationUser

func CreateApplicationUser(token, applicationID string, params map[string]interface{}) error

CreateApplicationUser associates a user with an application

func CreateInvitation

func CreateInvitation(token string, params map[string]interface{}) error

CreateInvitation creates a user invitation

func CreateOrganizationUser

func CreateOrganizationUser(token, orgID string, params map[string]interface{}) error

CreateOrganizationUser associates a user with an organization

func DeleteApplication

func DeleteApplication(token, applicationID string) error

DeleteApplication soft-deletes the application using the given API token

func DeleteApplicationOrganization

func DeleteApplicationOrganization(token, applicationID, organizationID string) error

DeleteApplicationOrganization disassociates an organization with an application

func DeleteApplicationUser

func DeleteApplicationUser(token, applicationID, userID string) error

DeleteApplicationUser disassociates a user with an application

func DeleteOrganizationUser

func DeleteOrganizationUser(token, orgID, userID string) error

DeleteOrganizationUser disassociates a user with an organization

func DeleteToken

func DeleteToken(token, tokenID string) error

DeleteToken removes a previously authorized API token, effectively deauthorizing future calls using the token

func RequestPasswordReset

func RequestPasswordReset(token, applicationID *string, email string) error

RequestPasswordReset initiates a password reset request

func ResetPassword

func ResetPassword(token *string, resetPasswordToken, passwd string) error

ResetPassword completes a previously-requested password reset operation for a user

func Status

func Status() error

Status returns the status of the endpoint

func UpdateApplication

func UpdateApplication(token, applicationID string, params map[string]interface{}) error

UpdateApplication using the given API token, application id and params

func UpdateOrganization

func UpdateOrganization(token, organizationID string, params map[string]interface{}) error

UpdateOrganization updates an organization

func UpdateOrganizationUser

func UpdateOrganizationUser(token, orgID, userID string, params map[string]interface{}) error

UpdateOrganizationUser updates an associated organization user=

func UpdateUser

func UpdateUser(token, userID string, params map[string]interface{}) error

UpdateUser updates an existing user

Types

type Application

type Application struct {
	api.Model

	NetworkID   uuid.UUID              `json:"network_id,omitempty"`
	UserID      uuid.UUID              `json:"user_id,omitempty"` // this is the user that initially created the app
	Name        *string                `json:"name"`
	Description *string                `json:"description"`
	Status      *string                `json:"status,omitempty"` // this is for enrichment purposes only
	Type        *string                `json:"type"`
	Config      map[string]interface{} `json:"config"`
	Hidden      bool                   `json:"hidden"`
}

Application model which is initially owned by the user who created it

func CreateApplication

func CreateApplication(token string, params map[string]interface{}) (*Application, error)

CreateApplication on behalf of the given API token

func GetApplicationDetails

func GetApplicationDetails(token, applicationID string, params map[string]interface{}) (*Application, error)

GetApplicationDetails retrives application details for the given API token and application id

func ListApplications

func ListApplications(token string, params map[string]interface{}) ([]*Application, error)

ListApplications retrieves a paginated list of applications scoped to the given API token

type AuthenticationResponse

type AuthenticationResponse struct {
	User  *User  `json:"user"`
	Token *Token `json:"token"`
}

AuthenticationResponse is returned upon successful authentication of a user (i.e., by email address)

func Authenticate

func Authenticate(email, passwd string) (*AuthenticationResponse, error)

Authenticate a user by email address and password, returning a newly-authorized API token

type Invite

type Invite struct {
	api.Model

	ApplicationID    *uuid.UUID             `json:"application_id,omitempty"`
	UserID           *uuid.UUID             `json:"user_id,omitempty"`
	FirstName        *string                `json:"first_name,omitempty"`
	LastName         *string                `json:"last_name,omitempty"`
	Email            *string                `json:"email,omitempty"`
	InvitorID        *uuid.UUID             `json:"invitor_id,omitempty"`
	InvitorName      *string                `json:"invitor_name,omitempty"`
	OrganizationID   *uuid.UUID             `json:"organization_id,omitempty"`
	OrganizationName *string                `json:"organization_name,omitempty"`
	Permissions      uint32                 `json:"permissions,omitempty"`
	Params           map[string]interface{} `json:"params,omitempty"`
}

Invite model

type JSONWebKey

type JSONWebKey struct {
	Kid string   `json:"kid,omitempty"`
	Use string   `json:"use,omitempty"`
	N   string   `json:"n,omitempty"`
	E   string   `json:"e,omitempty"`
	X5c []string `json:"x5c,omitempty"`

	Fingerprint string `json:"fingerprint,omitempty"`
	PublicKey   string `json:"public_key,omitempty"`
}

JSONWebKey represents the public part of a JWT

func GetJWKs

func GetJWKs() ([]*JSONWebKey, error)

GetJWKs returns the set of keys containing the public keys used to verify JWTs

type Organization

type Organization struct {
	api.Model

	Name        *string                `json:"name"`
	UserID      *uuid.UUID             `json:"user_id,omitempty"`
	Description *string                `json:"description"`
	Permissions uint32                 `json:"permissions,omitempty"`
	Metadata    map[string]interface{} `json:"metadata"`
}

Organization model

func CreateOrganization

func CreateOrganization(token string, params map[string]interface{}) (*Organization, error)

CreateOrganization creates a new organization

func GetOrganizationDetails

func GetOrganizationDetails(token, organizationID string, params map[string]interface{}) (*Organization, error)

GetOrganizationDetails retrieves details for the given organization

func ListApplicationOrganizations

func ListApplicationOrganizations(token, applicationID string, params map[string]interface{}) ([]*Organization, error)

ListApplicationOrganizations retrieves a paginated list of organizations scoped to the given API token

func ListOrganizations

func ListOrganizations(token string, params map[string]interface{}) ([]*Organization, error)

ListOrganizations retrieves a paginated list of organizations scoped to the given API token

type Service

type Service struct {
	api.Client
}

Service for the ident api

func InitDefaultIdentService

func InitDefaultIdentService(token *string) *Service

InitDefaultIdentService convenience method to initialize a default `ident.Service` (i.e., production) instance

func InitIdentService

func InitIdentService(token *string) *Service

InitIdentService convenience method to initialize an `ident.Service` instance

type Token

type Token struct {
	api.Model

	Token *string `json:"token,omitempty"`

	// OAuth 2 fields
	AccessToken  *string `json:"access_token,omitempty"`
	RefreshToken *string `json:"refresh_token,omitempty"`
	Scope        *string `json:"scope,omitempty"`

	// Ephemeral JWT header fields and claims; these are here for convenience and
	// are not always populated, even if they exist on the underlying token
	Kid       *string    `json:"kid,omitempty"` // key fingerprint
	Audience  *string    `json:"audience,omitempty"`
	Issuer    *string    `json:"issuer,omitempty"`
	IssuedAt  *time.Time `json:"issued_at,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	ExpiresIn *uint64    `json:"expires_in,omitempty"`
	NotBefore *time.Time `json:"not_before_at,omitempty"`
	Subject   *string    `json:"subject,omitempty"`

	Permissions uint32                 `json:"permissions,omitempty"`
	Data        map[string]interface{} `json:"data,omitempty"`
}

Token represents a bearer JWT

func CreateApplicationToken

func CreateApplicationToken(token, applicationID string, params map[string]interface{}) (*Token, error)

CreateApplicationToken creates a new API token for the given application ID.

func CreateToken

func CreateToken(token string, params map[string]interface{}) (*Token, error)

CreateToken creates a new API token.

func GetTokenDetails

func GetTokenDetails(token, tokenID string, params map[string]interface{}) (*Token, error)

GetTokenDetails retrieves details for the given API token id

func ListApplicationTokens

func ListApplicationTokens(token, applicationID string, params map[string]interface{}) ([]*Token, error)

ListApplicationTokens retrieves a paginated list of application API tokens

func ListTokens

func ListTokens(token string, params map[string]interface{}) ([]*Token, error)

ListTokens retrieves a paginated list of API tokens scoped to the given API token

type User

type User struct {
	api.Model

	Name                   string                 `json:"name"`
	FirstName              string                 `json:"first_name"`
	LastName               string                 `json:"last_name"`
	Email                  string                 `json:"email"`
	Permissions            uint32                 `json:"permissions,omitempty,omitempty"`
	PrivacyPolicyAgreedAt  *time.Time             `json:"privacy_policy_agreed_at,omitempty"`
	TermsOfServiceAgreedAt *time.Time             `json:"terms_of_service_agreed_at,omitempty"`
	Metadata               map[string]interface{} `json:"metadata,omitempty"`
}

User represents a user

func CreateUser

func CreateUser(token string, params map[string]interface{}) (*User, error)

CreateUser creates a new user for which API tokens and managed signing identities can be authorized

func GetUserDetails

func GetUserDetails(token, userID string, params map[string]interface{}) (*User, error)

GetUserDetails retrieves details for the given user id

func ListApplicationInvitations

func ListApplicationInvitations(token, applicationID string, params map[string]interface{}) ([]*User, error)

ListApplicationInvitations retrieves a paginated list of invitations scoped to the given API token

func ListApplicationUsers

func ListApplicationUsers(token, applicationID string, params map[string]interface{}) ([]*User, error)

ListApplicationUsers retrieves a paginated list of users scoped to the given API token

func ListOrganizationInvitations

func ListOrganizationInvitations(token, organizationID string, params map[string]interface{}) ([]*User, error)

ListOrganizationInvitations retrieves a paginated list of organization invitations scoped to the given API token

func ListOrganizationUsers

func ListOrganizationUsers(token, orgID string, params map[string]interface{}) ([]*User, error)

ListOrganizationUsers retrieves a paginated list of users scoped to an organization

func ListUsers

func ListUsers(token string, params map[string]interface{}) ([]*User, error)

ListUsers retrieves a paginated list of users scoped to the given API token

Jump to

Keyboard shortcuts

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