# next-core-security

> The Augmented.js Next - Security.

Latest version **3.0.0** (published 2020-07-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install next-core-security
pnpm add next-core-security
yarn add next-core-security
bun add next-core-security
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-07-09 |
| First published | 2018-08-20 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 93.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bob Warren |
| Maintainers | thedocbwarren |
| Keywords | augmentedjs, presentation |

## Links

- npm: https://www.npmjs.com/package/next-core-security
- Repository: https://github.com/Augmentedjs/next-core-security
- Homepage: http://www.augmentedjs.com
- Issues: https://github.com/Augmentedjs/next-core-security/issues
- npm.io page: https://npm.io/package/next-core-security

## Dependencies (1)

- [next-core-object](https://npm.io/package/next-core-object.md) ^3.0.0

## Recent versions

- 3.0.0 (latest) — 2020-07-09
- 2.5.3 — 2018-08-20

## README

# next-core-security

Augmented.js Next Core - Security

# API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [AbstractSecurityClient](#abstractsecurityclient)
    -   [Parameters](#parameters)
    -   [Properties](#properties)
    -   [uri](#uri)
        -   [Properties](#properties-1)
    -   [type](#type)
        -   [Properties](#properties-2)
-   [OAUTH2Client](#oauth2client)
    -   [authorize](#authorize)
        -   [Parameters](#parameters-1)
    -   [authorize](#authorize-1)
        -   [Parameters](#parameters-2)
    -   [authorize](#authorize-2)
        -   [Parameters](#parameters-3)
    -   [access](#access)
        -   [Parameters](#parameters-4)
-   [ACLClient](#aclclient)
    -   [authenticate](#authenticate)
        -   [Parameters](#parameters-5)
-   [ClientType](#clienttype)
    -   [Properties](#properties-3)
-   [AuthenticationFactory](#authenticationfactory)
    -   [getSecurityClient](#getsecurityclient)
        -   [Parameters](#parameters-6)
-   [Principal](#principal)
    -   [Parameters](#parameters-7)
    -   [Properties](#properties-4)
-   [Entry](#entry)
    -   [Parameters](#parameters-8)
    -   [isNegative](#isnegative)
        -   [Properties](#properties-5)
    -   [permissions](#permissions)
    -   [permissions](#permissions-1)
        -   [Parameters](#parameters-9)
    -   [addPermission](#addpermission)
        -   [Parameters](#parameters-10)
    -   [removePermission](#removepermission)
        -   [Parameters](#parameters-11)
    -   [hasPermission](#haspermission)
        -   [Parameters](#parameters-12)
    -   [setNegative](#setnegative)
        -   [Parameters](#parameters-13)
-   [Context](#context)
    -   [Parameters](#parameters-14)
    -   [principal](#principal-1)
    -   [permissions](#permissions-2)
    -   [permissions](#permissions-3)
        -   [Parameters](#parameters-15)
    -   [addPermission](#addpermission-1)
        -   [Parameters](#parameters-16)
    -   [removePermission](#removepermission-1)
        -   [Parameters](#parameters-17)
    -   [hasPermission](#haspermission-1)
        -   [Parameters](#parameters-18)

## AbstractSecurityClient

**Extends Object**

The abstract Security Client - for use to extend your own

### Parameters

-   `type`  

### Properties

-   `type` **Security.ClientType** The client type
-   `uri` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The base uri

### uri

#### Properties

-   `uri` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The uri

### 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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the application/service/module

### access

access the application/service/module via OAUTH

#### Parameters

-   `principal` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The principal
    TODO: Refresh the token and store it

## ACLClient

**Extends AbstractSecurityClient**

Role/Privilege (ACL) Security

### authenticate

authenticate the user

#### Parameters

-   `username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the user (login)
-   `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)

### Properties

-   `OAuth2` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** The OAuth2 type
-   `ACL` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** The ACL type

## 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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The full name of the principal
-   `id` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The id of the principal
-   `login` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The login of the principal
-   `email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The email of the principal

## Entry

Used to secure a resource via permissions

### Parameters

-   `p`  
-   `neg`  
-   `permissions` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Permissions to add to the entry (optional)
-   `negaive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Sets negative permissions (optional)

### isNegative

Negative flag

#### Properties

-   `isNegative` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### permissions

Gets the permissions

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Permissions

### permissions

Sets the permissions

#### Parameters

-   `p`  
-   `permissions` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Permissions Array to set

### addPermission

Add a permission

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Permission to add

### removePermission

Remove a permission

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Permission to remove

### hasPermission

Returns if this entry has a permission

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Permission to test for

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if this entry has this permission

### setNegative

Sets this entry negaive or positive

#### Parameters

-   `n`  
-   `negative` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** permissions All permissions

### permissions

setPermissions - Set all permissions for a principal

#### Parameters

-   `p`  
-   `permissions` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 

### addPermission

addPermission - Add a new permission for a principal

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

### removePermission

removePermission - Remove a permission for a principal

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

### hasPermission

hasPermission - checks for a permission for this principal

#### Parameters

-   `p`  
-   `permission` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**

---
_Source: https://npm.io/package/next-core-security · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
