fix: harden API principal config after review
Add require_direct_header toggle, external user ID validation, JWT TTL limits, SaveToken error handling, ru-RU i18n, API docs, and Go SDK methods.
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
const (
|
||||
PrincipalWebUser = "web_user"
|
||||
PrincipalAPITenant = "api_tenant"
|
||||
PrincipalAPIUser = "api_user"
|
||||
PrincipalAPIExternalUser = "api_external_user"
|
||||
PrincipalIMUser = "im_user"
|
||||
PrincipalEmbedChannel = "embed_channel"
|
||||
|
||||
@@ -232,7 +232,11 @@ type APIPrincipalConfig struct {
|
||||
Mode APIPrincipalMode `json:"mode"`
|
||||
DirectHeaderName string `json:"direct_header_name,omitempty"`
|
||||
SignedTokenHeaderName string `json:"signed_token_header_name,omitempty"`
|
||||
HMACSecret string `json:"hmac_secret,omitempty"`
|
||||
// RequireDirectHeader, when true in direct_header mode, rejects API-key
|
||||
// requests that omit the configured user-id header instead of falling
|
||||
// back to the tenant-level principal.
|
||||
RequireDirectHeader bool `json:"require_direct_header,omitempty"`
|
||||
HMACSecret string `json:"hmac_secret,omitempty"`
|
||||
}
|
||||
|
||||
func (c *APIPrincipalConfig) Value() (driver.Value, error) {
|
||||
|
||||
Reference in New Issue
Block a user