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 ¶
func RequireAuthByToken ¶
func RequireAuthByToken(ctx context.Context) *TrustedAuthByToken
Click to show internal directories.
Click to hide internal directories.