libra

package module
v0.0.0-...-8671a8c Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 9

README

libra-go

libra sdk for golang

  • sdk Fundamentals
  • mvc Model-View-Controller package

Documentation

Index

Constants

View Source
const (
	XLibraPrefix           = "x-libra-"
	XLibraToken            = XLibraPrefix + "token"
	XLibraAppId            = XLibraPrefix + "app-id"
	XLibraAppSecret        = XLibraPrefix + "app-secret"
	XLibraAdminId          = XLibraPrefix + "admin-id"
	XLibraAdminSecret      = XLibraPrefix + "admin-secret"
	XLibraAuthBy           = XLibraPrefix + "auth-by"
	XLibraTrustedPrefix    = XLibraPrefix + "trusted-"
	XLibraTrustedAuthBy    = XLibraTrustedPrefix + "auth-by"
	XLibraTrustedAdminId   = XLibraTrustedPrefix + "admin-id"
	XLibraTrustedAppId     = XLibraTrustedPrefix + "app-id"
	XLibraTrustedUserId    = XLibraTrustedPrefix + "user-id"
	XLibraTrustedRoleId    = XLibraTrustedPrefix + "role-id"
	XLibraTrustedRoleIndex = XLibraTrustedPrefix + "role-index"
)

通用元数据键

View Source
const (
	// 必须提供正确token
	XLibraAuthByToken = "token"
	// 必须提供正确的secret
	XLibraAuthBySecret = "secret"
	// 必须提供正确的admin secret
	XLibraAuthByAdminSecret = "admin-secret"
)

基础策略 x-libra-trusted-auth-by列表只包含基础策略

View Source
const (
	// 必须提供正确secret,如果同时提供了token必须也是正确的且AppId匹配
	XLibraAuthBySecretAndOptionalToken = "secret-and-optional-token"
	// 必须提供secret和token中的至少1个,如果同时都提供则必须都正确且AppId匹配
	XLibraAuthBySecretOrToken = "secret-or-token"
	XLibraAuthByTokenOrSecret = "token-or-secret"
)

策略组合 用于网关策略配置

Variables

This section is empty.

Functions

This section is empty.

Types

type TrustedAuthBySecret

type TrustedAuthBySecret struct {
	AppId string
}

func RequireAuthBySecret

func RequireAuthBySecret(ctx context.Context) *TrustedAuthBySecret

type TrustedAuthByToken

type TrustedAuthByToken struct {
	AppId     string
	UserId    string
	RoleId    string
	RoleIndex uint32
}

func RequireAuthByToken

func RequireAuthByToken(ctx context.Context) *TrustedAuthByToken

Directories

Path Synopsis
api
examples
sdk

Jump to

Keyboard shortcuts

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