Table of Contents

Agent AuthBasic

Présentation

L'agent AuthBasic est un agent spécial qui utilise l'authentification web basique pour authentifier dans un hôte virtuel et qui utilise ensuite les règles d'autorisation pour valider les accès à l'hôte virtuel.

The Handler will send a WWW-Authenticate header to the client, to request user and password, and then check the credentials using REST web service (you must enable REST session service in the manager). Lorsque la session est validée, l'agent examine les autorisations comme un agent standard.

Ce peut être pratique pour autoriser une application cliente à accéder à un hôte virtuel avec un authentifiant en envoyant un en-tête basique.

Configuration

Hôte virtuel

You just have to set “Type: AuthBasic” in the virtualHost options in the manager.

If you want to protect only a virtualHost part, keep type on “Main” and set type in your configuration file:

Nginx

Since 1.9.6, LLNG FastCGI server can handle AuthBasic handler. To call it, you just have to add fastcgi_param VHOSTTYPE AuthBasic; in the FastCGI server call and remove error_page 401 directive:

location = /lmauth {
  internal;
  include /etc/nginx/fastcgi_params;
  fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
  fastcgi_param VHOSTTYPE AuthBasic;

  # Ignorer les données postées
  fastcgi_pass_request_body  off;
  fastcgi_param CONTENT_LENGTH "";

  # Conserver le nom d'hôte original
  fastcgi_param HOST $http_host;

  # Conserver la requête originale (le serveur LLNG va recevoir /llauth)
  fastcgi_param X_ORIGINAL_URI  $request_uri;
}
location / {
  ...
  ######################################
  # CALLING AUTHENTICATION         #
  ######################################
  auth_request /lmauth;
  auth_request_set $lmremote_user $upstream_http_lm_remote_user;
  auth_request_set $lmlocation $upstream_http_location;
  # Remove this for AuthBasic handler
  #error_page 401 $lmlocation;
  ...
}

Paramètres de l'agent

Aucun paramètres n'est requis. But you have to allow sessions web services, see REST sessions backend.