OpenVeo Core server

API Docs for: 7.0.0
Show:

OauthController

Extends Controller
Module: core-controllers

Summary

Defines a controller to handle requests relative to Web Service authentication.

Constructor

OauthController

Syntax

OauthController

()

Summary

Item Index

Methods

getPermissionIds

Syntax

getPermissionIds

(
  • permissions
)
Array private static

Summary

Retrieves, recursively, the id of all permissions.

Parameters:

  • permissions Array

    The list of permissions to search in

Returns:

Array:

The list of permission ids

Example:

var permissions = [
  {
    label: 'Permissions group',
    permissions: [
      {
        id: 'perm-1',
        name: 'Name of the first permission',
        description: 'Description of the first permission',
        paths: [ 'get /path1' ]
      }
    ]
  },
  {
    id: 'perm-2',
    name: 'Name of the second permission',
    description: 'Description of the second permission',
    paths: [ 'get /path2' ]
  }
];
getPermissionIds(permissions); // ["perm-1", "perm-2"]

getScopeByUrl

Syntax

getScopeByUrl

(
  • url
  • httpMethod
)
String private static

Summary

Retrieves, from list of scopes, the scope corresponding to the couple url / http method.

Parameters:

  • url String

    An url

  • httpMethod String

    The http method (POST, GET, PUT, DELETE)

Returns:

String:

The scope id if found, null otherwise

validateScopesAction

Syntax

validateScopesAction

(
  • request
  • response
  • next
)

Summary

Validates scopes for the given token depending on requested url.

Revoke access to the service if client does not have permission.

Parameters:

  • request Request

    ExpressJS HTTP Request

    • oauth2 Object

      Request's OAuth information

      • accessToken Object
        The connected client's token
    • url String

      The request's url

    • method String

      The request's method

  • response Response

    ExpressJS HTTP Response

  • next Function

    Function to defer execution to the next registered middleware