Documentation
¶
Index ¶
- Variables
- func PermissionsFromContext(ctx context.Context) []string
- func RolesFromContext(ctx context.Context) []string
- func TenantIDFromContext(ctx context.Context) string
- func UserIDFromContext(ctx context.Context) string
- func WithIdentity(ctx context.Context, id *Identity) context.Context
- func WithTenantID(ctx context.Context, tenantID string) context.Context
- type AuthorizationHook
- type Identity
- type Provider
- type TrustProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAuthorizationDenied = fmt.Errorf("authorization denied by dynamic hook")
)
Functions ¶
func PermissionsFromContext ¶
PermissionsFromContext extracts the permissions from the context.
func RolesFromContext ¶
RolesFromContext extracts the roles from the context.
func TenantIDFromContext ¶
TenantIDFromContext extracts the tenant ID from the context.
func UserIDFromContext ¶
UserIDFromContext extracts the user ID from the context.
func WithIdentity ¶
WithIdentity stores the identity in the context.
Types ¶
type AuthorizationHook ¶
type AuthorizationHook struct {
// contains filtered or unexported fields
}
AuthorizationHook calls the consuming system's dynamic authorization endpoint to determine if a checker is allowed to act on a request.
func NewAuthorizationHook ¶
func NewAuthorizationHook(timeout time.Duration) *AuthorizationHook
func (*AuthorizationHook) Check ¶
func (h *AuthorizationHook) Check(ctx context.Context, hookURL string, secret string, hookReq model.AuthorizationHookRequest) error
func (*AuthorizationHook) SetMetrics ¶
func (h *AuthorizationHook) SetMetrics(m *metrics.Metrics)
type TrustProvider ¶
type TrustProvider struct {
UserIDHeader string
RolesHeader string
PermissionsHeader string
TenantIDHeader string
}
TrustProvider trusts identity headers from the host app.
func NewTrustProvider ¶
func NewTrustProvider(userIDHeader, rolesHeader, permissionsHeader, tenantIDHeader string) *TrustProvider
func (*TrustProvider) Authenticate ¶
func (p *TrustProvider) Authenticate(r *http.Request) (*Identity, error)
Click to show internal directories.
Click to hide internal directories.