auth

package
v0.31.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 11 Imported by: 0

README

auth

Client implementation in go for the Freym service auth.

Docs

Please have a look at our documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const OWNER_SCOPE = "FRAYM_AUTH_OWNER"

Variables

View Source
var (
	TokenTypeMisc    = TokenType("token")
	TokenTypeAccess  = TokenType("access_token")
	TokenTypeRefresh = TokenType("refresh_token")
)
View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

This section is empty.

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

func ValidateTokenAndGetData

func ValidateTokenAndGetData(token string) (*Data, error)

func (*Data) CheckAuthorization

func (d *Data) CheckAuthorization(permissions []string) error

func (*Data) GetData

func (d *Data) GetData() map[string]any

func (*Data) GetDataValue

func (d *Data) GetDataValue(key string) any

func (*Data) GetScopes

func (d *Data) GetScopes() []string

func (*Data) GetTenantId

func (d *Data) GetTenantId() string

func (*Data) GetUserId

func (d *Data) GetUserId() string

type DeploymentOptions

type DeploymentOptions struct {
	Target managementpb.DeploymentTarget
	Force  bool
}

type FraymClaims

type FraymClaims struct {
	jwt.RegisteredClaims
	Type     TokenType      `json:"type,omitempty"`
	TenantID string         `json:"tenantId,omitempty"`
	Scopes   []string       `json:"scopes,omitempty"`
	Data     map[string]any `json:"data,omitempty"`
}

type ManagementClient

type ManagementClient interface {
	DeploySchema(
		ctx context.Context,
		namespace string,
		permissions []string,
		options *DeploymentOptions,
	) error
	ConfirmSchema(ctx context.Context, deploymentId int64) error
	RollbackSchema(ctx context.Context, deploymentId int64) error
	GetSchemaDeployment(ctx context.Context, deploymentId int64) (uint32, error)
	Close() error
}

func NewManagementClient

func NewManagementClient(
	ctx context.Context,
	conf *config.Config,
) (ManagementClient, error)

type MockManagementClient

type MockManagementClient struct {
	mock.Mock
}

func (*MockManagementClient) Close

func (c *MockManagementClient) Close() error

func (*MockManagementClient) ConfirmSchema

func (c *MockManagementClient) ConfirmSchema(ctx context.Context, deploymentId int64) error

func (*MockManagementClient) DeploySchema

func (c *MockManagementClient) DeploySchema(
	ctx context.Context,
	namespace string,
	permissions []string,
	options *DeploymentOptions,
) error

func (*MockManagementClient) GetSchemaDeployment

func (c *MockManagementClient) GetSchemaDeployment(ctx context.Context, deploymentId int64) (uint32, error)

func (*MockManagementClient) RollbackSchema

func (c *MockManagementClient) RollbackSchema(ctx context.Context, deploymentId int64) error

type TokenType

type TokenType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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