model

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatementEffectAllow = "allow"
	StatementEffectDeny  = "deny"
	PartitionKey         = "auth"
)

Variables

View Source
var ErrInvalidStatementSrcFormat = errors.New("invalid statements src format")
View Source
var ErrValidationError = errors.New("validation error")
View Source
var File_auth_model_model_proto protoreflect.FileDescriptor

Functions

func ConvertDBID added in v0.67.0

func ConvertDBID(id int64) string

func CreateID added in v0.68.0

func CreateID() string

func CredentialPath added in v0.68.0

func CredentialPath(userName string, accessKeyID string) []byte

func DecryptSecret added in v0.68.0

func DecryptSecret(s crypt.SecretStore, value []byte) (string, error)

func EncryptSecret added in v0.68.0

func EncryptSecret(s crypt.SecretStore, secretAccessKey string) ([]byte, error)

func ExpiredTokenPath added in v0.68.0

func ExpiredTokenPath(tokenID string) []byte

func ExpiredTokensPath added in v0.70.0

func ExpiredTokensPath() []byte

func GroupPath added in v0.68.0

func GroupPath(displayName string) []byte

func GroupPolicyPath added in v0.68.0

func GroupPolicyPath(groupDisplayName string, policyDisplayName string) []byte

func GroupUserPath added in v0.68.0

func GroupUserPath(groupDisplayName string, userName string) []byte

func HashPassword added in v0.63.0

func HashPassword(password string) ([]byte, error)

HashPassword generates a hashed password from a plaintext string

func MetadataKeyPath added in v0.69.0

func MetadataKeyPath(key string) string

func PolicyPath added in v0.67.0

func PolicyPath(displayName string) []byte

func UserPath added in v0.68.0

func UserPath(userName string) []byte

func UserPolicyPath added in v0.68.0

func UserPolicyPath(userName string, policyDisplayName string) []byte

func ValidateActionName

func ValidateActionName(name string) error

func ValidateArn

func ValidateArn(name string) error

func ValidateAuthEntityID

func ValidateAuthEntityID(name string) error

func ValidateStatementEffect

func ValidateStatementEffect(effect string) error

Types

type ACL added in v0.98.0

type ACL struct {
	Permission ACLPermission `json:"permission"`
}

type ACLData added in v0.98.0

type ACLData struct {
	Permission string `protobuf:"bytes,1,opt,name=permission,proto3" json:"permission,omitempty"`
	// Deprecated: Marked as deprecated in auth/model/model.proto.
	AllRepositories bool `protobuf:"varint,2,opt,name=all_repositories,json=allRepositories,proto3" json:"all_repositories,omitempty"`
	// Deprecated: Marked as deprecated in auth/model/model.proto.
	Repositories []string `protobuf:"bytes,3,rep,name=repositories,proto3" json:"repositories,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.ACL struct

func (*ACLData) Descriptor deprecated added in v0.98.0

func (*ACLData) Descriptor() ([]byte, []int)

Deprecated: Use ACLData.ProtoReflect.Descriptor instead.

func (*ACLData) GetAllRepositories deprecated added in v0.98.0

func (x *ACLData) GetAllRepositories() bool

Deprecated: Marked as deprecated in auth/model/model.proto.

func (*ACLData) GetPermission added in v0.98.0

func (x *ACLData) GetPermission() string

func (*ACLData) GetRepositories deprecated added in v0.98.0

func (x *ACLData) GetRepositories() []string

Deprecated: Marked as deprecated in auth/model/model.proto.

func (*ACLData) ProtoMessage added in v0.98.0

func (*ACLData) ProtoMessage()

func (*ACLData) ProtoReflect added in v0.98.0

func (x *ACLData) ProtoReflect() protoreflect.Message

func (*ACLData) Reset added in v0.98.0

func (x *ACLData) Reset()

func (*ACLData) String added in v0.98.0

func (x *ACLData) String() string

type ACLPermission added in v0.98.0

type ACLPermission string

type BaseCredential added in v0.67.0

type BaseCredential struct {
	AccessKeyID                   string    `db:"access_key_id"`
	SecretAccessKey               string    `db:"-" json:"-"`
	SecretAccessKeyEncryptedBytes []byte    `db:"secret_access_key" json:"-"`
	IssuedDate                    time.Time `db:"issued_date"`
}

type Credential

type Credential struct {
	Username string
	BaseCredential
}

func ConvertCredDataList added in v0.68.0

func ConvertCredDataList(s crypt.SecretStore, creds []proto.Message) ([]*Credential, error)

func CredentialFromProto added in v0.68.0

func CredentialFromProto(s crypt.SecretStore, pb *CredentialData) (*Credential, error)

type CredentialData added in v0.67.0

type CredentialData struct {
	AccessKeyId                   string                 `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
	SecretAccessKeyEncryptedBytes []byte                 `` /* 154-byte string literal not displayed */
	IssuedDate                    *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=issued_date,json=issuedDate,proto3" json:"issued_date,omitempty"`
	UserId                        []byte                 `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.Credential struct

func ProtoFromCredential added in v0.68.0

func ProtoFromCredential(c *Credential) *CredentialData

func (*CredentialData) Descriptor deprecated added in v0.67.0

func (*CredentialData) Descriptor() ([]byte, []int)

Deprecated: Use CredentialData.ProtoReflect.Descriptor instead.

func (*CredentialData) GetAccessKeyId added in v0.67.0

func (x *CredentialData) GetAccessKeyId() string

func (*CredentialData) GetIssuedDate added in v0.67.0

func (x *CredentialData) GetIssuedDate() *timestamppb.Timestamp

func (*CredentialData) GetSecretAccessKeyEncryptedBytes added in v0.67.0

func (x *CredentialData) GetSecretAccessKeyEncryptedBytes() []byte

func (*CredentialData) GetUserId added in v0.67.0

func (x *CredentialData) GetUserId() []byte

func (*CredentialData) ProtoMessage added in v0.67.0

func (*CredentialData) ProtoMessage()

func (*CredentialData) ProtoReflect added in v0.67.0

func (x *CredentialData) ProtoReflect() protoreflect.Message

func (*CredentialData) Reset added in v0.67.0

func (x *CredentialData) Reset()

func (*CredentialData) String added in v0.67.0

func (x *CredentialData) String() string

type CredentialKeys

type CredentialKeys struct {
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
}

CredentialKeys - For JSON serialization:

type DBCredential added in v0.67.0

type DBCredential struct {
	UserID int64 `db:"user_id"`
	BaseCredential
}

type DBGroup added in v0.67.0

type DBGroup struct {
	ID int `db:"id"`
	Group
}

type DBPolicy added in v0.67.0

type DBPolicy struct {
	ID int `db:"id"`
	Policy
}

type DBUser added in v0.67.0

type DBUser struct {
	ID int64 `db:"id"`
	User
}

type Group

type Group struct {
	CreatedAt   time.Time `db:"created_at"`
	DisplayName string    `db:"display_name" json:"display_name"`
}

func ConvertGroupDataList added in v0.68.0

func ConvertGroupDataList(group []proto.Message) []*Group

func GroupFromProto added in v0.68.0

func GroupFromProto(pb *GroupData) *Group

type GroupData added in v0.67.0

type GroupData struct {
	CreatedAt   *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	DisplayName string                 `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.Group struct

func ProtoFromGroup added in v0.68.0

func ProtoFromGroup(g *Group) *GroupData

func (*GroupData) Descriptor deprecated added in v0.67.0

func (*GroupData) Descriptor() ([]byte, []int)

Deprecated: Use GroupData.ProtoReflect.Descriptor instead.

func (*GroupData) GetCreatedAt added in v0.67.0

func (x *GroupData) GetCreatedAt() *timestamppb.Timestamp

func (*GroupData) GetDisplayName added in v0.67.0

func (x *GroupData) GetDisplayName() string

func (*GroupData) ProtoMessage added in v0.67.0

func (*GroupData) ProtoMessage()

func (*GroupData) ProtoReflect added in v0.67.0

func (x *GroupData) ProtoReflect() protoreflect.Message

func (*GroupData) Reset added in v0.67.0

func (x *GroupData) Reset()

func (*GroupData) String added in v0.67.0

func (x *GroupData) String() string

type PaginationParams

type PaginationParams struct {
	Prefix string
	After  string
	Amount int
}

type Paginator

type Paginator struct {
	Amount        int
	NextPageToken string
}

Paginator describes the parameters of a slice of data from a database.

type Policy

type Policy struct {
	CreatedAt   time.Time  `db:"created_at"`
	DisplayName string     `db:"display_name" json:"display_name"`
	Statement   Statements `db:"statement"`
	ACL         ACL        `db:"acl" json:"acl,omitempty"`
}

func ConvertPolicyDataList added in v0.68.0

func ConvertPolicyDataList(policies []proto.Message) []*Policy

func PolicyFromProto added in v0.68.0

func PolicyFromProto(pb *PolicyData) *Policy

type PolicyData added in v0.67.0

type PolicyData struct {
	CreatedAt   *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	DisplayName string                 `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Statements  []*StatementData       `protobuf:"bytes,3,rep,name=statements,proto3" json:"statements,omitempty"`
	Acl         *ACLData               `protobuf:"bytes,4,opt,name=acl,proto3" json:"acl,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.Policy struct

func ProtoFromPolicy added in v0.68.0

func ProtoFromPolicy(p *Policy) *PolicyData

func (*PolicyData) Descriptor deprecated added in v0.67.0

func (*PolicyData) Descriptor() ([]byte, []int)

Deprecated: Use PolicyData.ProtoReflect.Descriptor instead.

func (*PolicyData) GetAcl added in v0.98.0

func (x *PolicyData) GetAcl() *ACLData

func (*PolicyData) GetCreatedAt added in v0.67.0

func (x *PolicyData) GetCreatedAt() *timestamppb.Timestamp

func (*PolicyData) GetDisplayName added in v0.67.0

func (x *PolicyData) GetDisplayName() string

func (*PolicyData) GetStatements added in v0.67.0

func (x *PolicyData) GetStatements() []*StatementData

func (*PolicyData) ProtoMessage added in v0.67.0

func (*PolicyData) ProtoMessage()

func (*PolicyData) ProtoReflect added in v0.67.0

func (x *PolicyData) ProtoReflect() protoreflect.Message

func (*PolicyData) Reset added in v0.67.0

func (x *PolicyData) Reset()

func (*PolicyData) String added in v0.67.0

func (x *PolicyData) String() string

type RepositoriesData added in v0.98.0

type RepositoriesData struct {
	All  bool     `protobuf:"varint,1,opt,name=all,proto3" json:"all,omitempty"`
	List []string `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"`
	// contains filtered or unexported fields
}

message data model for repositories / all repositories in UI

func (*RepositoriesData) Descriptor deprecated added in v0.98.0

func (*RepositoriesData) Descriptor() ([]byte, []int)

Deprecated: Use RepositoriesData.ProtoReflect.Descriptor instead.

func (*RepositoriesData) GetAll added in v0.98.0

func (x *RepositoriesData) GetAll() bool

func (*RepositoriesData) GetList added in v0.98.0

func (x *RepositoriesData) GetList() []string

func (*RepositoriesData) ProtoMessage added in v0.98.0

func (*RepositoriesData) ProtoMessage()

func (*RepositoriesData) ProtoReflect added in v0.98.0

func (x *RepositoriesData) ProtoReflect() protoreflect.Message

func (*RepositoriesData) Reset added in v0.98.0

func (x *RepositoriesData) Reset()

func (*RepositoriesData) String added in v0.98.0

func (x *RepositoriesData) String() string

type Statement

type Statement struct {
	Effect   string   `json:"Effect"`
	Action   []string `json:"Action"`
	Resource string   `json:"Resource"`
}

type StatementData added in v0.67.0

type StatementData struct {
	Effect   string   `protobuf:"bytes,1,opt,name=effect,proto3" json:"effect,omitempty"`
	Action   []string `protobuf:"bytes,2,rep,name=action,proto3" json:"action,omitempty"`
	Resource string   `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.Statement struct

func (*StatementData) Descriptor deprecated added in v0.67.0

func (*StatementData) Descriptor() ([]byte, []int)

Deprecated: Use StatementData.ProtoReflect.Descriptor instead.

func (*StatementData) GetAction added in v0.67.0

func (x *StatementData) GetAction() []string

func (*StatementData) GetEffect added in v0.67.0

func (x *StatementData) GetEffect() string

func (*StatementData) GetResource added in v0.67.0

func (x *StatementData) GetResource() string

func (*StatementData) ProtoMessage added in v0.67.0

func (*StatementData) ProtoMessage()

func (*StatementData) ProtoReflect added in v0.67.0

func (x *StatementData) ProtoReflect() protoreflect.Message

func (*StatementData) Reset added in v0.67.0

func (x *StatementData) Reset()

func (*StatementData) String added in v0.67.0

func (x *StatementData) String() string

type Statements

type Statements []Statement

func (*Statements) Scan

func (s *Statements) Scan(src interface{}) error

func (Statements) Value

func (s Statements) Value() (driver.Value, error)

type SuperuserConfiguration

type SuperuserConfiguration struct {
	User
	AccessKeyID     string
	SecretAccessKey string
}

SuperuserConfiguration requests a particular configuration for a superuser.

type TokenData added in v0.68.0

type TokenData struct {
	TokenId   string                 `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"`
	ExpiredAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"`
	// contains filtered or unexported fields
}

message data model for rest password token

func (*TokenData) Descriptor deprecated added in v0.68.0

func (*TokenData) Descriptor() ([]byte, []int)

Deprecated: Use TokenData.ProtoReflect.Descriptor instead.

func (*TokenData) GetExpiredAt added in v0.68.0

func (x *TokenData) GetExpiredAt() *timestamppb.Timestamp

func (*TokenData) GetTokenId added in v0.68.0

func (x *TokenData) GetTokenId() string

func (*TokenData) ProtoMessage added in v0.68.0

func (*TokenData) ProtoMessage()

func (*TokenData) ProtoReflect added in v0.68.0

func (x *TokenData) ProtoReflect() protoreflect.Message

func (*TokenData) Reset added in v0.68.0

func (x *TokenData) Reset()

func (*TokenData) String added in v0.68.0

func (x *TokenData) String() string

type UIData added in v0.98.0

type UIData struct {
	Permission   string            `protobuf:"bytes,1,opt,name=permission,proto3" json:"permission,omitempty"`
	Repositories *RepositoriesData `protobuf:"bytes,2,opt,name=repositories,proto3" json:"repositories,omitempty"`
	// contains filtered or unexported fields
}

message data model for UI structure

func (*UIData) Descriptor deprecated added in v0.98.0

func (*UIData) Descriptor() ([]byte, []int)

Deprecated: Use UIData.ProtoReflect.Descriptor instead.

func (*UIData) GetPermission added in v0.98.0

func (x *UIData) GetPermission() string

func (*UIData) GetRepositories added in v0.98.0

func (x *UIData) GetRepositories() *RepositoriesData

func (*UIData) ProtoMessage added in v0.98.0

func (*UIData) ProtoMessage()

func (*UIData) ProtoReflect added in v0.98.0

func (x *UIData) ProtoReflect() protoreflect.Message

func (*UIData) Reset added in v0.98.0

func (x *UIData) Reset()

func (*UIData) String added in v0.98.0

func (x *UIData) String() string

type User

type User struct {
	CreatedAt time.Time `db:"created_at"`
	// Username is a unique identifier for the user. In password-based authentication, it is the email.
	Username string `db:"display_name" json:"display_name"`
	// FriendlyName, if set, is a shorter name for the user than
	// Username.  Unlike Username it does not identify the user (it
	// might not be unique); use it in the user's GUI rather than in
	// backend code.
	FriendlyName      *string `db:"friendly_name" json:"friendly_name"`
	Email             *string `db:"email" json:"email"`
	EncryptedPassword []byte  `db:"encrypted_password" json:"encrypted_password"`
	Source            string  `db:"source" json:"source"`
	ExternalID        *string `db:"external_id" json:"external_id"`
}

func ConvertUsersDataList added in v0.68.0

func ConvertUsersDataList(users []proto.Message) []*User

func UserFromProto added in v0.68.0

func UserFromProto(pb *UserData) *User

func (*User) Authenticate added in v0.62.0

func (u *User) Authenticate(password string) error

Authenticate a user from a password Returns nil on success, or an error on failure.

func (*User) Committer added in v1.2.0

func (u *User) Committer() string

func (*User) UpdatePassword added in v0.62.0

func (u *User) UpdatePassword(password string) error

type UserData added in v0.67.0

type UserData struct {
	CreatedAt         *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	Username          string                 `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	FriendlyName      string                 `protobuf:"bytes,3,opt,name=friendly_name,json=friendlyName,proto3" json:"friendly_name,omitempty"`
	Email             string                 `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"`
	EncryptedPassword []byte                 `protobuf:"bytes,5,opt,name=encrypted_password,json=encryptedPassword,proto3" json:"encrypted_password,omitempty"`
	Source            string                 `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
	ExternalId        string                 `protobuf:"bytes,7,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"`
	// contains filtered or unexported fields
}

message data model for model.User struct

func ProtoFromUser added in v0.68.0

func ProtoFromUser(u *User) *UserData

func (*UserData) Descriptor deprecated added in v0.67.0

func (*UserData) Descriptor() ([]byte, []int)

Deprecated: Use UserData.ProtoReflect.Descriptor instead.

func (*UserData) GetCreatedAt added in v0.67.0

func (x *UserData) GetCreatedAt() *timestamppb.Timestamp

func (*UserData) GetEmail added in v0.67.0

func (x *UserData) GetEmail() string

func (*UserData) GetEncryptedPassword added in v0.67.0

func (x *UserData) GetEncryptedPassword() []byte

func (*UserData) GetExternalId added in v0.69.0

func (x *UserData) GetExternalId() string

func (*UserData) GetFriendlyName added in v0.67.0

func (x *UserData) GetFriendlyName() string

func (*UserData) GetSource added in v0.67.0

func (x *UserData) GetSource() string

func (*UserData) GetUsername added in v0.67.0

func (x *UserData) GetUsername() string

func (*UserData) ProtoMessage added in v0.67.0

func (*UserData) ProtoMessage()

func (*UserData) ProtoReflect added in v0.67.0

func (x *UserData) ProtoReflect() protoreflect.Message

func (*UserData) Reset added in v0.67.0

func (x *UserData) Reset()

func (*UserData) String added in v0.67.0

func (x *UserData) String() string

Jump to

Keyboard shortcuts

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