session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_session_proto protoreflect.FileDescriptor

Functions

func WithSession

func WithSession(ctx context.Context, s *Session) context.Context

WithSession returns a Context.

Types

type ID

type ID struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,json=d,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func NewID

func NewID() *ID

NewID constructs a new ID.

func ParseID

func ParseID(x string) (*ID, error)

ParseID will parse the input as either a canonically-formatted UUID or as a base64-encoded collection of bytes.

func (*ID) AsUUID

func (x *ID) AsUUID() uuid.UUID

AsUUID converts the message to a validated UUID or returns the zero value.

func (*ID) Descriptor deprecated

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

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) GetData

func (x *ID) GetData() []byte

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect

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

func (*ID) Reset

func (x *ID) Reset()

func (*ID) Scan

func (x *ID) Scan(v interface{}) error

Scan implements sql.Scanner.

func (*ID) String

func (x *ID) String() string

func (*ID) Value

func (x *ID) Value() (driver.Value, error)

Value implements driver.Valuer.

func (*ID) Zero

func (x *ID) Zero() bool

Zero returns true if the ID is the zero value.

type Location

type Location struct {

	// The tenant.
	TenantId *tenant.ID `protobuf:"bytes,1,opt,name=tenant_id,json=t,proto3" json:"tenant_id,omitempty"`
	// A specific path (e.g. /foo/bar/baz) or a path prefix
	// (e.g. /foo/bar/*).
	Path string `protobuf:"bytes,2,opt,name=path,json=p,proto3" json:"path,omitempty"`
	// Restricts access to a specific version of the data on the path.
	Version int64 `protobuf:"varint,3,opt,name=version,json=v,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetPath

func (x *Location) GetPath() string

func (*Location) GetTenantId

func (x *Location) GetTenantId() *tenant.ID

func (*Location) GetVersion

func (x *Location) GetVersion() int64

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

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

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type Scope

type Scope struct {

	// Types that are assignable to Kind:
	//	*Scope_SuperToken
	//	*Scope_OnPrincipal
	//	*Scope_OnLocation
	Kind isScope_Kind `protobuf_oneof:"Kind"`
	// contains filtered or unexported fields
}

func (*Scope) Descriptor deprecated

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

Deprecated: Use Scope.ProtoReflect.Descriptor instead.

func (*Scope) GetKind

func (m *Scope) GetKind() isScope_Kind

func (*Scope) GetOnLocation

func (x *Scope) GetOnLocation() *Location

func (*Scope) GetOnPrincipal

func (x *Scope) GetOnPrincipal() *principal.ID

func (*Scope) GetSuperToken

func (x *Scope) GetSuperToken() bool

func (*Scope) IsSubsetOf

func (x *Scope) IsSubsetOf(other *Scope) bool

IsSubsetOf returns true if the target scope is a subset of or equal to another Scope.

func (*Scope) ProtoMessage

func (*Scope) ProtoMessage()

func (*Scope) ProtoReflect

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

func (*Scope) Reset

func (x *Scope) Reset()

func (*Scope) String

func (x *Scope) String() string

type Scope_OnLocation

type Scope_OnLocation struct {
	// Delegates operations within a tenancy.
	OnLocation *Location `protobuf:"bytes,3,opt,name=on_location,json=l,proto3,oneof"`
}

type Scope_OnPrincipal

type Scope_OnPrincipal struct {
	// Delegates access to a principal (which may be the top-level principal_id).
	OnPrincipal *principal.ID `protobuf:"bytes,2,opt,name=on_principal,json=p,proto3,oneof"`
}

type Scope_SuperToken

type Scope_SuperToken struct {
	// A super-token is only used internally and allows anything.
	SuperToken bool `protobuf:"varint,1,opt,name=super_token,json=s,proto3,oneof"`
}

type Session

type Session struct {
	ID           *ID                        `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Capabilities *capabilities.Capabilities `protobuf:"bytes,2,opt,name=capabilities,json=c,proto3" json:"capabilities,omitempty"`
	PrincipalId  *principal.ID              `protobuf:"bytes,3,opt,name=principal_id,json=p,proto3" json:"principal_id,omitempty"`
	Scope        *Scope                     `protobuf:"bytes,4,opt,name=scope,json=s,proto3" json:"scope,omitempty"`
	ExpiresAt    *timestamppb.Timestamp     `protobuf:"bytes,5,opt,name=expires_at,json=x,proto3" json:"expires_at,omitempty"`
	// A long-form note, to describe the session to a human.
	Note string `protobuf:"bytes,6,opt,name=note,proto3" json:"note,omitempty"`
	// A key that is unique per principal, to allow easy
	// programmatic access to a specific session.
	Name string `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) *Session

FromContext returns the Session associated with the context, or nil.

func (*Session) Descriptor deprecated

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

Deprecated: Use Session.ProtoReflect.Descriptor instead.

func (*Session) GetCapabilities

func (x *Session) GetCapabilities() *capabilities.Capabilities

func (*Session) GetExpiresAt

func (x *Session) GetExpiresAt() *timestamppb.Timestamp

func (*Session) GetID

func (x *Session) GetID() *ID

func (*Session) GetName

func (x *Session) GetName() string

func (*Session) GetNote

func (x *Session) GetNote() string

func (*Session) GetPrincipalId

func (x *Session) GetPrincipalId() *principal.ID

func (*Session) GetScope

func (x *Session) GetScope() *Scope

func (*Session) IsSubsetOf

func (x *Session) IsSubsetOf(other *Session) bool

IsSubsetOf returns tue if the capabilities and scope of the the target session are a subset of or equal to those of another session. It will also return true if the other session is a super-token.

func (*Session) MarshalJSON

func (x *Session) MarshalJSON() ([]byte, error)

MarshalJSON allows the Session to be correctly encoded into a JWT.

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) ProtoReflect

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

func (*Session) Reset

func (x *Session) Reset()

func (*Session) String

func (x *Session) String() string

func (*Session) UnmarshalJSON

func (x *Session) UnmarshalJSON(data []byte) error

UnmarshalJSON allows the Session to be correctly decoded from a JWT.

Jump to

Keyboard shortcuts

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