API Docs for: 2.6
Show:

plugin_rest_authentication Class

Module: plugins_rest
Parent Module: com_authentication_rest

REST plugin that provides authentication functions through the following REST API:

POST requests

  1. authentication/login
  2. authentication/remotelogin
  3. authentication/logout

authentication/login

Authenticates a local client. If the user is successfully authenticated, he receives an HTTP 401 response with an nonce in the WWW-Authenticate header. The nonce is a string and it is used by the client to construct the token for the next authentications. The request must contains the following parameters:

  • username
  • password

Example JSON request parameters:

{ "username": "alessandro", "password": "somepwd" }

Example of a response of a successful login:

Connection:close
Content-Length:0
Content-Type:text/plain; charset=UTF-8
Date:Wed, 11 Jun 2014 14:14:18 GMT
www-authenticate:Digest a4b888b2d096249ce5b5ad63413842d5df335f17

where the nonce is the string a4b888b2d096249ce5b5ad63413842d5df335f17.


authentication/remotelogin

Authenticates a remote site. If the user is successfully authenticated, he receives an HTTP 401 response with an nonce in the WWW-Authenticate header. The nonce is a string and it is used by the client to construct the token for the next authentications. The request must contains the following parameters:

  • username
  • password

Example JSON request parameters:

{ "username": "alessandro", "password": "somepwd" }

Example of a response of a successful login:

Connection:close
Content-Length:0
Content-Type:text/plain; charset=UTF-8
Date:Wed, 11 Jun 2014 14:14:18 GMT
www-authenticate:Digest a4b888b2d096249ce5b5ad63413842d5df335f17

where the nonce is the string a4b888b2d096249ce5b5ad63413842d5df335f17.


authentication/logout

Logout the user.

Methods

login

(
  • req
  • res
  • next
)

Provides the login function with the following REST API:

login

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

logout

(
  • req
  • res
  • next
)

Provides the logout function with the following REST API:

logout

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

remotelogin

(
  • req
  • res
  • next
)

Provides the remotelogin function with the following REST API:

remotelogin

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompAuthentication

(
  • ca
)

Set the authentication architect component used by authentication.

Parameters:

  • ca Object

    The authentication architect component arch_authentication.

setCompUser

(
  • comp
)

Sets the user architect component.

Parameters:

  • comp Object

    The user architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

compAuthe

Object private

The authentication architect component used for authentication.

compUser

Object private

The user architect component.

compUtil

Object private

The utility architect component.

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/authentication]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • login String

    Authenticate a local client with username and password and if it goes well the client receive an HTTP 401 response with nonce in WWW-Authenticate header. The nonce is used to construct the token used in the next authentications.

  • remotelogin String

    Authenticate a remote site with username and password and if it goes well the client receive an HTTP 401 response with nonce in WWW-Authenticate header. The nonce is used to construct the token used in the next authentications.

  • logout String

    Logout ...