Documentation
¶
Index ¶
- Constants
- func CtxWithServiceSubject(ctx context.Context, name string) context.Context
- func CtxWithSubject(ctx context.Context, sub Subject) context.Context
- func HasRole(sub Subject, roles ...string) bool
- func IsSystemService(sub Subject) bool
- func ValidateScopes(scopes []string) bool
- type APIKeySubject
- type LocalAdminSubject
- type PublicSubject
- type Resource
- type Subject
- type SubjectWrapper
- type SystemServiceSubject
Constants ¶
View Source
const ( RoleUser = "User" RoleSubmitter = "Submitter" RoleAdmin = "Admin" RoleSystem = "System" RolePublic = "Public" RoleTranscriber = "Transcriber" ResourceCall = "Call" ResourceIncident = "Incident" ResourceTalkgroup = "Talkgroup" ResourceSystem = "System" // P25 system ResourceAlert = "Alert" ResourceAPIKey = "APIKey" ResourceCallStats = "CallStats" ResourceSetting = "Setting" ResourceUser = "User" ResourceNexus = "Nexus" ResourcePushSub = "PushSubscription" ResourceWebPushSub = "WebPushSubscription" ActionRead = "read" ActionReadPrivileged = "readPrivileged" ActionCreate = "create" ActionUpdate = "update" ActionDelete = "delete" ActionUpdatePrivileged = "updatePrivileged" ActionTranscribe = "updateTranscription" ActionSimulate = "simulate" ActionTestNotify = "testNotify" ActionMoveCallAudio = "moveCallAudio" ActionConnect = "connect" ScopeSubmit = "submit" ScopeTranscribe = "transcribe" )
View Source
const SubjectCtxKey subjectContextKey = "sub"
Variables ¶
This section is empty.
Functions ¶
func CtxWithServiceSubject ¶
func IsSystemService ¶
func ValidateScopes ¶
ValidateScopes validates that all scopes exist. If any are invalid, it returns false.
Types ¶
type APIKeySubject ¶
type APIKeySubject struct {
Subject
// contains filtered or unexported fields
}
func NewAPIKeySubject ¶
func NewAPIKeySubject(user Subject, scope ...string) *APIKeySubject
func (*APIKeySubject) GetRoles ¶
func (s *APIKeySubject) GetRoles() []string
func (*APIKeySubject) UnwrapSubject ¶
func (s *APIKeySubject) UnwrapSubject() Subject
type LocalAdminSubject ¶
type LocalAdminSubject struct {
}
func NewLocalAdminSubject ¶
func NewLocalAdminSubject() *LocalAdminSubject
func (*LocalAdminSubject) GetName ¶
func (s *LocalAdminSubject) GetName() string
func (*LocalAdminSubject) GetRoles ¶
func (s *LocalAdminSubject) GetRoles() []string
func (*LocalAdminSubject) String ¶
func (s *LocalAdminSubject) String() string
type PublicSubject ¶
type PublicSubject struct {
RemoteAddr string
}
func NewPublicSubject ¶
func NewPublicSubject(r *http.Request) *PublicSubject
func (*PublicSubject) GetName ¶
func (s *PublicSubject) GetName() string
func (*PublicSubject) GetRoles ¶
func (s *PublicSubject) GetRoles() []string
func (*PublicSubject) String ¶
func (s *PublicSubject) String() string
type Subject ¶
func SubjectFrom ¶
type SubjectWrapper ¶
type SubjectWrapper interface {
UnwrapSubject() Subject
}
type SystemServiceSubject ¶
type SystemServiceSubject struct {
Name string
}
func (*SystemServiceSubject) GetName ¶
func (s *SystemServiceSubject) GetName() string
func (*SystemServiceSubject) GetRoles ¶
func (s *SystemServiceSubject) GetRoles() []string
func (*SystemServiceSubject) String ¶
func (s *SystemServiceSubject) String() string
Click to show internal directories.
Click to hide internal directories.