Documentation ¶
Overview ¶
Package qra contains QuickRobutsAdmin interfaces for RBAC, MAC, DAC, ABAC and ZBAC systems.
MIT License ¶
Copyright (c) 2016 Angel Del Castillo ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Variables
- func Allow(ctx Identity, password, permission, resource, dst string, expiresAt time.Time) error
- func Authenticate(ctx Identity, password string, dst interface{}) error
- func Close(ctx Identity) error
- func MustRegisterAuthentication(a Authentication)
- func MustRegisterDesignation(d Designation)
- func RegisterAuthentication(a Authentication) error
- func RegisterDesignation(d Designation) error
- func Revoke(ctx Identity, password, permission, resource, dst string) error
- func Search(ctx Identity, v interface{}, filter string) error
- type Authentication
- type Designation
- type Identity
- type QRA
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultManager is the default QRA Manager. DefaultManager = defaultQRA() // ErrAuthenticationNil returned when QRA authentication // interface is nil. ErrAuthenticationNil = errors.New("qra: authentication interface is nil") // ErrDesignationNil returned when QRA authorization-designation // interface is nil. ErrDesignationNil = errors.New("qra: authorization-designation interface is nil") ErrSystemNotFound = errors.New("system identity not found") ErrInvalidCredentials = errors.New("invalid username or password") ErrResourceNotSpecified = errors.New("resource not specified") ErrPasswordSize = errors.New("invalid password size") // ErrOwnSign error returned when an identity try to auto sign a permission. ErrOwnSign = errors.New("can't allow own permission") // ErrIdentityNotFound error returned when identity not exists in database. ErrIdentityNotFound = errors.New("identity not found") )
Functions ¶
func Authenticate ¶ added in v0.0.2
Authenticate wrapper for DefaultManager.Authentication.Authenticate.
func MustRegisterAuthentication ¶ added in v0.0.2
func MustRegisterAuthentication(a Authentication)
MustRegisterAuthentication calls RegisterAuthentication function or panics.
func MustRegisterDesignation ¶ added in v0.0.2
func MustRegisterDesignation(d Designation)
MustRegisterDesignation calls RegisterDesignation function or panics.
func RegisterAuthentication ¶ added in v0.0.2
func RegisterAuthentication(a Authentication) error
RegisterAuthentication replaces Authentication of DefaultManager.
func RegisterDesignation ¶ added in v0.0.2
func RegisterDesignation(d Designation) error
RegisterDesignation replaces Authentication of DefaultManager.
Types ¶
type Authentication ¶ added in v0.0.2
type Authentication interface { // Authenticate method makes login to user. It will call // Me method to retrieve Identity username, validate // if not session is present with Session method. Authenticate(ctx Identity, password string, dst interface{}) error // Close method will delete session of current identity. Close(ctx Identity) error }
Authentication interface for session management of users.
type Designation ¶ added in v0.0.2
type Designation interface { // Search permission-designations and binds table designation content to v. // Return error if not permission for identity was found. // Filter parameter will allow search permissions by // name, resource and has pagination (e.g.: `permission:resource/1-36` or // `permission:resource/since/123abc`). Search(ctx Identity, v interface{}, filter string) error // Allow method shares identity permission over resource with dst. Allow(ctx Identity, password, permission, resource, dst string, expiresAt time.Time) error // Revoke method will revoke a permission that ctx previously // give to dst. Revoke(ctx Identity, password, permission, resource, dst string) error }
Designation interface stands for Authorization-Designation operations.
type Identity ¶ added in v0.0.2
type Identity interface { // Me method returns identity name (username, userID, etc.) Me() string // Session method binds the current session. If identity has no session error // is returned Session(dst interface{}) error }
Identity interface for management of identities (users).
type QRA ¶
type QRA struct { Authentication Authentication DesignationAuthorization Designation }
QRA struct is the container for common administrator operations split between interfaces.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
pgterm
Package main contains terminal session for pgmanager.
|
Package main contains terminal session for pgmanager. |
Package pgmanager contains a QRA manager for PostgreSQL.
|
Package pgmanager contains a QRA manager for PostgreSQL. |
Package qmenu contains QuickRobutsAdmin interfaces for RBAC, MAC, DAC, ABAC and ZBAC systems.
|
Package qmenu contains QuickRobutsAdmin interfaces for RBAC, MAC, DAC, ABAC and ZBAC systems. |
Package qsess contains QRA integration with gorilla sessions cookie store.
|
Package qsess contains QRA integration with gorilla sessions cookie store. |