Class: AccessContext

AccessContext() → {AccessContext}

new AccessContext() → {AccessContext}

Access context represents the context for a request to access protected resources NOTE While the method expects an array of principals in the AccessContext instance/object, it also accepts a single principal defined with the following properties: ```js { // AccessContext instance/object // .. principalType: 'somePrincipalType', // APP, ROLE, USER, or custom user model name principalId: 'somePrincipalId', } ```
Properties:
Name Type Description
principals Array.<Principal> An array of principals
model function The model class
modelName String The model name
modelId * The model id
property String The model property/method/relation name
method String The model method to be invoked
accessType String The access type: READ, REPLICATE, WRITE, or EXECUTE.
accessToken AccessToken The access token resolved for the request
remotingContext RemotingContext The request's remoting context
registry Registry The application or global registry
Source:
Returns:
Type
AccessContext

Methods

addPrincipal(principalType, principalId, principalNameopt) → {boolean}

Add a principal to the context
Parameters:
Name Type Attributes Description
principalType String The principal type
principalId * The principal id
principalName String <optional>
The principal name
Source:
Returns:
Type
boolean

getAppId() → {*}

Get the application id
Source:
Returns:
Type
*

getScopes()

Get the list of scopes required by the current access context.
Source:

getUser() → {*}

Get the user
Source:
Returns:
Type
*

getUserId() → {*}

Get the user id
Source:
Returns:
Type
*

isAuthenticated() → {boolean}

Check if the access context has authenticated principals
Source:
Returns:
Type
boolean

isScopeAllowed() → {boolean}

Check if the scope required by the remote method is allowed by the scopes granted to the requesting access token.
Source:
Returns:
Type
boolean