Documentation ¶
Index ¶
- Constants
- func GetUserJwtCacheKey(prefix, userId, deviceId string) string
- func IsSame(u1 *RawJwtUser, u2 *RawJwtUser) bool
- type Client
- type CommonPermitResult
- type CommonRenewTokenResult
- type HttpClient
- func (c *HttpClient) SetHttpHeaderNames(accessCodeHeader, randomKeyHeader string) Client
- func (c *HttpClient) SetTimeout(timeout int) Client
- func (c *HttpClient) SetToken(token string) Client
- func (c *HttpClient) ValidateJwt() error
- func (c *HttpClient) ValidatePermAction(service, path, method string) error
- func (c *HttpClient) ValidatePermOperationByCode(operationCode string) error
- func (c *HttpClient) ValidatePermOrgById(orgId string) error
- type JwtUser
- type NormalHttpResponse
- type PermitHttpResponse
- type RawJwtUser
- type RenewTokenHttpResponse
- type RpcClient
- func (c *RpcClient) SetHttpHeaderNames(accessCodeHeader, randomKeyHeader string) Client
- func (c *RpcClient) SetTimeout(timeout int) Client
- func (c *RpcClient) SetToken(token string) Client
- func (c *RpcClient) ValidateJwt() error
- func (c *RpcClient) ValidatePermAction(service, path, method string) error
- func (c *RpcClient) ValidatePermOperationByCode(operationCode string) error
- func (c *RpcClient) ValidatePermOrgById(orgId string) error
- type Validator
Constants ¶
View Source
const ( DefaultHeaderRandomKey = "Random-Key" DefaultHeaderAccessCode = "Access-Code" DefaultNoPermMsg = "权限不足" DefaultTimeout = 3 ValidateJwtURL = "/api/v1/ucs/current/blank" ValidatePermOperationByCodeURL = "/api/v1/ucs/current/check-operation" ValidatePermActionURL = "/api/v1/ucs/current/check-action" ValidatePermOrgByIdURL = "/api/v1/ucs/current/check-org" ValidateRenewTokenURL = "/api/v1/ucs/public/renew-token" )
View Source
const ( JwtTokenClaimsId = "id" JwtTokenClaimsName = "name" JwtTokenClaimsDeviceId = "did" JwtTokenClaimsDeviceName = "dn" JwtTokenClaimsIssuer = "iss" JwtTokenClaimsIssueAt = "iat" JwtTokenClaimsExpireAt = "exp" )
View Source
const ( JwtKeySplitter = "_" JwtErrInternal = "内部错误" JwtErrFormat = "令牌格式错误" JwtErrVersion = "令牌版本错误" )
Variables ¶
This section is empty.
Functions ¶
func GetUserJwtCacheKey ¶ added in v1.3.0
GetUserJwtCacheKey 获取Jwt存储的key
func IsSame ¶ added in v1.3.0
func IsSame(u1 *RawJwtUser, u2 *RawJwtUser) bool
Types ¶
type Client ¶
type Client interface { SetTimeout(timeout int) Client SetToken(token string) Client SetHttpHeaderNames(accessCodeHeader, randomKeyHeader string) Client ValidateJwt() error ValidatePermOperationByCode(operationCode string) error ValidatePermAction(service, path, method string) error ValidatePermOrgById(orgId string) error }
func NewHttpClient ¶ added in v1.1.0
func NewRpcClient ¶ added in v1.1.0
func NewTLSRpcClient ¶ added in v1.1.0
type CommonPermitResult ¶ added in v1.1.0
type CommonPermitResult struct {
Permit bool `json:"permit"`
}
type CommonRenewTokenResult ¶ added in v1.3.0
type CommonRenewTokenResult struct {
Token string `json:"token"`
}
type HttpClient ¶ added in v1.1.0
type HttpClient struct {
// contains filtered or unexported fields
}
func (*HttpClient) SetHttpHeaderNames ¶ added in v1.1.0
func (c *HttpClient) SetHttpHeaderNames(accessCodeHeader, randomKeyHeader string) Client
func (*HttpClient) SetTimeout ¶ added in v1.1.0
func (c *HttpClient) SetTimeout(timeout int) Client
func (*HttpClient) SetToken ¶ added in v1.1.0
func (c *HttpClient) SetToken(token string) Client
func (*HttpClient) ValidateJwt ¶ added in v1.1.0
func (c *HttpClient) ValidateJwt() error
func (*HttpClient) ValidatePermAction ¶ added in v1.1.0
func (c *HttpClient) ValidatePermAction(service, path, method string) error
func (*HttpClient) ValidatePermOperationByCode ¶ added in v1.1.0
func (c *HttpClient) ValidatePermOperationByCode(operationCode string) error
func (*HttpClient) ValidatePermOrgById ¶ added in v1.1.0
func (c *HttpClient) ValidatePermOrgById(orgId string) error
type JwtUser ¶
type JwtUser struct { RawJwtUser Token string `json:"token"` // 令牌字符串 }
func GenerateJwt ¶ added in v1.3.0
type NormalHttpResponse ¶ added in v1.1.0
type PermitHttpResponse ¶ added in v1.1.0
type PermitHttpResponse struct { Code int `json:"code"` Message string `json:"message"` Result CommonPermitResult `json:"result"` }
type RawJwtUser ¶ added in v1.3.0
type RenewTokenHttpResponse ¶ added in v1.3.0
type RenewTokenHttpResponse struct { Code int `json:"code"` Message string `json:"message"` Result CommonRenewTokenResult `json:"result"` }
type RpcClient ¶ added in v1.1.0
type RpcClient struct {
// contains filtered or unexported fields
}
func (*RpcClient) SetHttpHeaderNames ¶ added in v1.1.0
func (*RpcClient) SetTimeout ¶ added in v1.1.0
func (*RpcClient) ValidateJwt ¶ added in v1.1.0
func (*RpcClient) ValidatePermAction ¶ added in v1.1.0
func (*RpcClient) ValidatePermOperationByCode ¶ added in v1.1.0
func (*RpcClient) ValidatePermOrgById ¶ added in v1.1.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.