Documentation
¶
Overview ¶
Copyright © 2023 Harry C <hoveychen@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NewContext(ctx context.Context, token *AgentToken) context.Context
- type AgentToken
- func (*AgentToken) Descriptor() ([]byte, []int)deprecated
- func (x *AgentToken) GetExpireAt() int64
- func (x *AgentToken) GetId() int64
- func (x *AgentToken) GetName() string
- func (x *AgentToken) GetScopePaths() []string
- func (x *AgentToken) GetScopes() []string
- func (*AgentToken) ProtoMessage()
- func (x *AgentToken) ProtoReflect() protoreflect.Message
- func (x *AgentToken) Reset()
- func (x *AgentToken) String() string
- type TokenManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCipherTextTooShort = errors.New("ciphertext too short")
View Source
var File_github_com_hoveychen_slime_pkg_token_token_proto protoreflect.FileDescriptor
Functions ¶
func NewContext ¶
func NewContext(ctx context.Context, token *AgentToken) context.Context
Types ¶
type AgentToken ¶
type AgentToken struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` ExpireAt int64 `protobuf:"varint,3,opt,name=expire_at,json=expireAt,proto3" json:"expire_at,omitempty"` ScopePaths []string `protobuf:"bytes,4,rep,name=scope_paths,json=scopePaths,proto3" json:"scope_paths,omitempty"` Scopes []string `protobuf:"bytes,5,rep,name=scopes,proto3" json:"scopes,omitempty"` // contains filtered or unexported fields }
func FromContext ¶
func FromContext(ctx context.Context) *AgentToken
func (*AgentToken) Descriptor
deprecated
func (*AgentToken) Descriptor() ([]byte, []int)
Deprecated: Use AgentToken.ProtoReflect.Descriptor instead.
func (*AgentToken) GetExpireAt ¶
func (x *AgentToken) GetExpireAt() int64
func (*AgentToken) GetId ¶
func (x *AgentToken) GetId() int64
func (*AgentToken) GetName ¶
func (x *AgentToken) GetName() string
func (*AgentToken) GetScopePaths ¶
func (x *AgentToken) GetScopePaths() []string
func (*AgentToken) GetScopes ¶ added in v1.1.13
func (x *AgentToken) GetScopes() []string
func (*AgentToken) ProtoMessage ¶
func (*AgentToken) ProtoMessage()
func (*AgentToken) ProtoReflect ¶
func (x *AgentToken) ProtoReflect() protoreflect.Message
func (*AgentToken) Reset ¶
func (x *AgentToken) Reset()
func (*AgentToken) String ¶
func (x *AgentToken) String() string
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(key []byte) *TokenManager
func (*TokenManager) Decrypt ¶
func (tm *TokenManager) Decrypt(encrypted string) (*AgentToken, error)
func (*TokenManager) Encrypt ¶
func (tm *TokenManager) Encrypt(token *AgentToken) (string, error)
Click to show internal directories.
Click to hide internal directories.