npm.io
3.0.0 • Published 6 years ago

next-core-security

Licence
Apache-2.0
Version
3.0.0
Deps
1
Size
93 kB
Vulns
0
Weekly
0

next-core-security

Augmented.js Next Core - Security

API

Table of Contents

AbstractSecurityClient

Extends Object

The abstract Security Client - for use to extend your own

Parameters
  • type
Properties
  • type Security.ClientType The client type
  • uri string The base uri
uri
Properties
type
Properties
  • type Security.ClientType The client type

OAUTH2Client

Extends AbstractSecurityClient

The OAUTH2 Client

authorize

Access Token

Parameters
  • name
authorize

Authorization Token

Parameters
  • name
authorize

Authorize the application/service/module via OAUTH

Parameters
  • name string The name of the application/service/module
access

access the application/service/module via OAUTH

Parameters
  • principal string The principal TODO: Refresh the token and store it

ACLClient

Extends AbstractSecurityClient

Role/Privilege (ACL) Security

authenticate

authenticate the user

Parameters
  • username string The name of the user (login)

  • password string The password for the user (not stored)

  • Throws any Error Failed to authenticate

Returns Security.Context Returns a security context or null is case of failure

ClientType

Augmented.Security.ClientType - Security client type

Type: Symbol

Properties

AuthenticationFactory

AuthenticationFactory Class - Returns a client of given type for use with security

getSecurityClient

Get an instance of a security client

Parameters
  • clientType Security.ClientType The Client Type to return

Returns Security.Client Returns a security client instance

Principal

Pricipal object for use in security as part of the abstract implimentation

Parameters
  • options
Properties
  • fullName string The full name of the principal
  • id number The id of the principal
  • login string The login of the principal
  • email string The email of the principal

Entry

Used to secure a resource via permissions

Parameters
  • p
  • neg
  • permissions array Permissions to add to the entry (optional)
  • negaive boolean Sets negative permissions (optional)
isNegative

Negative flag

Properties
permissions

Gets the permissions

Returns array Permissions

permissions

Sets the permissions

Parameters
  • p
  • permissions array Permissions Array to set
addPermission

Add a permission

Parameters
  • p
  • permission string Permission to add
removePermission

Remove a permission

Parameters
  • p
  • permission string Permission to remove
hasPermission

Returns if this entry has a permission

Parameters
  • p
  • permission string Permission to test for

Returns boolean Returns true if this entry has this permission

setNegative

Sets this entry negaive or positive

Parameters
  • n
  • negative boolean flag True or False

Context

Augmented.Security.Context Used as a security data storage class

Parameters
  • principal Security.Principal The principal for this context
  • permissions array Permissions to add to the context
principal

getPrincipal - get the principal of this context

Returns Security.Principal principal The principal of this context

permissions

getPermissions - Get all the permissions for a principal

Returns array permissions All permissions

permissions

setPermissions - Set all permissions for a principal

Parameters
addPermission

addPermission - Add a new permission for a principal

Parameters
removePermission

removePermission - Remove a permission for a principal

Parameters
hasPermission

hasPermission - checks for a permission for this principal

Parameters

Keywords