auth

package
v1.0.0-beta.117 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GotrueAudHeaderKey       = "X-JWT-AUD"
	ClientIdPrefix           = "tid_"
	ClientSecretPrefix       = "tsec_"
	GlobalClientIdPrefix     = "tgid_"
	GlobalClientSecretPrefix = "tgsec_"
	ApiKeyPrefix             = "tkey_"
	Component                = "component"
	AppKey                   = "app_key"
	AppKeyUser               = "app key"

	InvitationStatusPending  = "PENDING"
	InvitationStatusAccepted = "ACCEPTED"
	InvitationStatusExpired  = "EXPIRED"

	AppKeyTypeCredentials = "credentials"
	AppKeyTypeApiKey      = "api_key"

	ClusterAdminRoleName = "cluster_admin"
	ReadOnlyRoleName     = "ro"
	EditorRoleName       = "e"
	OwnerRoleName        = "o"
)
View Source
const (
	CreatedStatus = "created"
	DeletedStatus = "deleted"
)

Variables

View Source
var InvalidInvitationCodeErr = errors.Unauthenticated("Failed to verify invitation code")

Functions

func GetCurrentSub

func GetCurrentSub(ctx context.Context) (string, error)

Types

type CreateInvitationPayload

type CreateInvitationPayload struct {
	Email string `json:"email"`
	Role  string `json:"role"`

	TigrisNamespace     string `json:"tigris_namespace"`
	TigrisNamespaceName string `json:"tigris_namespace_name"`

	CreatedBy      string `json:"created_by"`
	CreatedByName  string `json:"created_by_name"`
	ExpirationTime int64  `json:"expiration_time"`
}

type CreateUserPayload

type CreateUserPayload struct {
	Email    string      `json:"email"`
	Password string      `json:"password"`
	AppData  UserAppData `json:"app_data"`
}

type DefaultUsersManager

type DefaultUsersManager struct {
	Management    *management.Management
	TenantManager *metadata.TenantManager
}

func NewDefaultUsersManager

func NewDefaultUsersManager(tm *metadata.TenantManager) *DefaultUsersManager

func (*DefaultUsersManager) CreateInvitations

func (*DefaultUsersManager) DeleteInvitations

func (*DefaultUsersManager) ListInvitations

func (*DefaultUsersManager) ListUsers

func (*DefaultUsersManager) VerifyInvitation

type DeleteInvitationsPayload

type DeleteInvitationsPayload struct {
	Email           string `json:"email"`
	CreatedBy       string `json:"created_by"`
	TigrisNamespace string `json:"tigris_namespace"`
	Status          string `json:"status"`
}

type GetUserResp

type GetUserResp struct {
	InstanceID        uuid.UUID `json:"instance_id"`
	ID                uuid.UUID `json:"id"`
	Aud               string    `json:"aud"`
	Role              string    `json:"role"`
	Email             string    `json:"email"`
	EncryptedPassword string    `json:"encrypted_password"`

	AppMetaData *UserAppData `db:"app_metadata" json:"app_metadata"`
}

type Provider

func NewGotrueProvider

func NewGotrueProvider() Provider

func NewProvider

func NewProvider(userstore *metadata.UserSubspace, txMgr *transaction.Manager) Provider

type UserAppData

type UserAppData struct {
	CreatedAt       int64  `json:"created_at"`
	CreatedBy       string `json:"created_by"`
	UpdatedAt       int64  `json:"updated_at"`
	UpdatedBy       string `json:"updated_by"`
	TigrisNamespace string `json:"tigris_namespace"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	Project         string `json:"tigris_project"`
	// Gotrue has multiple roles in user. We use it as an array but app key has single role (first and only element of array)
	Roles   []string `json:"roles"`
	KeyType string   `json:"key_type"`
}

type VerifyInvitationPayload

type VerifyInvitationPayload struct {
	Email string `json:"email"`
	Code  string `json:"code"`
	Dry   bool   `json:"dry"`
}

Jump to

Keyboard shortcuts

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