Class: ApiConsumer

ApiConsumer()

new ApiConsumer()

A ApiConsumer represents an application, device or user using/calling your api
Do not call constructor directly
Bluenimble container creates it internally and makes it available for your services to use

Source:

Members

(readonly) id :string

The id of this consumer
Type:
  • string
Source:

(readonly) type :string

The type of this consumer, resolved by the security method declared in your api
  • ApiConsumer.Type.Token
  • ApiConsumer.Type.Cookie
  • ApiConsumer.Type.Signature
  • ApiConsumer.Type.Basic
  • ApiConsumer.Type.Unknown
Type:
  • string
Source:

Methods

get(key) → {Object}

Get a property of this consumer
Parameters:
Name Type Description
key string the name of the property
Source:
Returns:
the value for the given property
Type
Object

isAnonymous() → {boolean}

Check if this consumer is anonymous
This means, that all security schemes failed to recognize who's making the request
This generally, will happen if there is no Authorization header found in the coming request
Source:
Returns:
Type
boolean

override(reference)

Override this consumer by another one
Parameters:
Name Type Description
reference ApiConsumer consumer
Source:

setAnonymous(keyopt)

Changing the anonymous status of this consumer.
Parameters:
Name Type Attributes Default Description
key string <optional>
true true/false
Source:

toJson() → {JsonObject}

Get a json representation of this consumer
Source:
Returns:
consumer as a json object
Type
JsonObject