Documentation
¶
Overview ¶
Package pgmanager contains a QRA manager for PostgreSQL.
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.
Package pgmanager contains a QRA manager for PostgreSQL.
This implementation has no flavor for permission structure. In the meanwhile will be named "QRA PG A" flavor.
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.
Package pgmanager contains a QRA manager for PostgreSQL.
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 ¶
- Constants
- Variables
- func AESCBCDecrypt(key, ciphertext []byte) ([]byte, error)
- func AESCBCEncrypt(key, plaintext []byte) ([]byte, error)
- func Connect(driver, connectURL string) error
- func MakePassword(l int) (string, error)
- func Terminal(driver, connectURL string) error
- type Authenticationer
- type Context
- type Designation
- type Designationer
- type Filter
- type IdentityRevoke
- type IdentitySimple
- type NPE
Constants ¶
const ( // PermSessionOn permission for session on web, terminal or others that developer // want to implement. PermSessionOn = "session-on" // PermIdentityCreate _ PermIdentityCreate = "identity-create" // PermIdentityEdit _ PermIdentityEdit = "identity-edit" // PermIdentityDelete _ PermIdentityDelete = "identity-delete" // PermRead _ PermRead = "read" // PermWrite _ PermWrite = "write" // PermDelete _ PermDelete = "delete" )
const ( // PassMin defines the minimum length of a password. PassMin = 8 // System defines identity username for SYSTEM. System = "system" // SessionDuration defines the duration for a session on database. // default 3 months. SessionDuration = time.Duration(24 * time.Hour * 30 * 3) // PermissionDuration defines the duration default for a permission. // default 1 year. PermissionDuration = time.Duration(24 * time.Hour * 365 * 1) // StatusActive permission status active. StatusActive = "active" // StatusInactive permission status inactive. StatusInactive = "inactive" )
Variables ¶
Functions ¶
func AESCBCDecrypt ¶ added in v0.0.2
AESCBCDecrypt decrypts cipher text using AES CBC mode.
func AESCBCEncrypt ¶ added in v0.0.2
AESCBCEncrypt encrypts using AES CBC mode. FIXME; padding plaintext and key.
func MakePassword ¶ added in v0.0.2
MakePassword generates a random password of l length.
Types ¶
type Authenticationer ¶ added in v0.0.2
type Authenticationer struct{}
Authenticationer struct
func (*Authenticationer) Authenticate ¶ added in v0.0.2
func (s *Authenticationer) Authenticate(ctx qra.Identity, password string, dst interface{}) error
Authenticate makes login for Identity.
type Designation ¶ added in v0.0.2
type Designation struct { ID string `db:"id"` Identity string `db:"identity"` Permission []byte `db:"permission"` Resource []byte `db:"resource"` IssuerID string `db:"issuer_id"` IssuerSignature string `db:"issuer_signature"` ExpiresAt string `db:"expires_at"` }
Designation type from database.
type Designationer ¶ added in v0.0.2
type Designationer struct{}
Designationer struct
func (*Designationer) Allow ¶ added in v0.0.2
func (p *Designationer) Allow(ctx qra.Identity, password, permission, resource, dst string, expires time.Time) error
Allow method share permission from ctx to dst identity.
func (*Designationer) Revoke ¶ added in v0.0.2
func (p *Designationer) Revoke(ctx qra.Identity, password, permission, resource, dst string) error
Revoke method revokes a permission that ctx give to dst.
Every revoke operation verifies signed x509 encryption.
func (*Designationer) Search ¶ added in v0.0.2
func (p *Designationer) Search(ctx qra.Identity, v interface{}, filter string) error
Search method searchs permission-designation relations for Identity.
It doesn't validate permission signature because it would be CPU expensive. Every permission in database is view AS secure because Allow and Revoke methods do all the x509 operations.
if dst is nil then Search will act as "HasPermission" method.
format 1: permission:resource format 2: "designation.id" + "." + "designation.signature"
type IdentityRevoke ¶ added in v0.0.2
IdentityRevoke selects ID and Signature for comparison.
type IdentitySimple ¶ added in v0.0.2
IdentitySimple for identity retrieve.