Class Gateway

Description

Gateway is a base class for Service authorization gateways.

A security object to create service realms with their own type of authorization and access rules. This task can devided into three subtasks

  • Create service realms and register access rulesets to them
  • Perform the validation of a requesting user
  • Provide a login response to authenticate users to a Service realm
Gateways have a main policy ALLOW or DENY. The DENY policy denies any request that does not match an allowing rule. The ALLOW policy allows any request that does not match a denying rule.

To create a service realm fill an array with the following values and pass it to add_realm():

  1. = any virtual uri subspace relative to the .htaccess file
  2. = the method to validate a requesting user. must exist in your gateways
  3. = the method to return a login response view for the service realm
  4. = the default service name to serve if non given
  5. = an exclusive service for a realm processing every request
use add_realm( $realm ) to register a realm in the gateway.

Located in /gateway.php (line 33)

PHOOL
   |
   --Gateway
Class Constant Summary
 ALLOW = 1
 DENY = 0
Variable Summary
string $policy
mixed $realms
mixed $request
array $rules
Method Summary
Gateway Gateway (Request &$request, [ $policy = self::ALLOW])
void add_realm (string $name, array $data)
bool append_rule (string $realm, string $rule)
boolean|HTTPResponse authorize ()
string get_realm ()
array realm ( $name)
bool resolve (string $realm)
void set_rules (string $realm, [array $rules = array( )], bool 2)
Variables
string $policy (line 58)

Gateway strictness policy

  • access: private
mixed $realms (line 65)

Gateway realms Table

A list of realms and their subspace

  • access: protected
mixed $request (line 52)

Request object

  • access: protected
array $rules (line 77)

Gateway rules table

The keys in this array define the types of requests that are allowed to access. For every type you may register a set of rules to authorize access to service URIs.

  • access: private

Inherited Variables

Inherited from PHOOL

PHOOL::$debug
PHOOL::$errorlabels
PHOOL::$errorlevels
PHOOL::$errors
PHOOL::$exists
PHOOL::$logdir
PHOOL::$loglevel
PHOOL::$objname
Methods
Constructor Gateway (line 82)

Construct an authorization Gateway

Gateway Gateway (Request &$request, [ $policy = self::ALLOW])
add_realm (line 232)

Add a service realm to the gateway

void add_realm (string $name, array $data)
  • string $name: name of the realm (internal)
  • array $data: realm data
append_rule (line 279)

Append one single rule to an existing service realm ruleset

bool append_rule (string $realm, string $rule)
  • string $realm: the realm to append the rule to
  • string $rule: the rule
authorize (line 102)

Main gateway authorization method

boolean|HTTPResponse authorize ()
get_realm (line 140)

Return the requested realm name

string get_realm ()
realm (line 165)

Return a created realm array by its name

array realm ( $name)
  • $name
resolve (line 188)

Resolve a Gateway rule

Gateway rules are bound to realms. They may contain a request method and an url subspace relative to the position of the gateway includer. Wildcards (asterisk) are allowed behind and before all terms. e.g:

  • POST services/user
  • * services/user
  • GET services/*

  • access: private
bool resolve (string $realm)
  • string $realm: the requested realm
set_rules (line 263)

Set all rules for a specific service realm

void set_rules (string $realm, [array $rules = array( )], bool 2)
  • bool 2
  • string $realm: the realm to set the ruleset for
  • array $rules: ruleset (consisting of strings)

Inherited Methods

Inherited From PHOOL

PHOOL::PHOOL()
PHOOL::debug()
PHOOL::error()
PHOOL::get_errors()
PHOOL::handle_error()
PHOOL::has_error()
PHOOL::log_error()
PHOOL::set_debug()
PHOOL::set_logdir()
PHOOL::set_loglevel()
Class Constants
ALLOW = 1 (line 47)

Gateway policy constant ALLOW

If used, all rules you define DENY access

DENY = 0 (line 40)

Gateway policy constant DENY

If used, all rules you define ALLOW access

Inherited Constants

Inherited from PHOOL

PHOOL::ERROR
PHOOL::UNKNOWN
PHOOL::USER
PHOOL::WARNING

Documentation generated on Tue, 12 May 2009 23:09:39 +0200 by phpDocumentor 1.4.1