#include <EnforceAuthRules.h>

This is an AuthRules plugin called by SipRouter to enforce rules based on the target uri and the permissions of the caller.
Public Member Functions | |
| virtual | ~EnforceAuthRules () |
| destructor | |
| virtual AuthResult | authorizeAndModify (const UtlString &id, const Url &requestUri, RouteState &routeState, const UtlString &method, AuthResult priorResult, SipMessage &request, bool bSpiralingRequest, UtlString &reason) |
| Called for any request - enforces the restrictions specified by authrules. | |
| virtual void | readConfig (OsConfigDb &configDb) |
| Read (or re-read) the authorization rules. | |
Protected Member Functions | |
| bool | isAuthorized (const ResultSet &requiredPermissions, const ResultSet &grantedPermissions, UtlString &matchedPermission, UtlString &unmatchedPermissions) |
Private Member Functions | |
| EnforceAuthRules (const UtlString &instanceName) | |
| Constructor - private so that only the factory can call it. | |
Private Attributes | |
| OsRWMutex | mRulesLock |
| AuthRulesUrlMapping * | mpAuthorizationRules |
Friends | |
| class | EnforceAuthRulesTest |
| AuthPlugin * | getAuthPlugin (const UtlString &name) |
| Factory used by PluginHooks to dynamically link the plugin instance. | |
| ~EnforceAuthRules | ( | ) | [virtual] |
destructor
| EnforceAuthRules | ( | const UtlString & | instanceName | ) | [private] |
Constructor - private so that only the factory can call it.
constructor
| instanceName | the configured name for this plugin instance |
| AuthPlugin::AuthResult authorizeAndModify | ( | const UtlString & | id, | |
| const Url & | requestUri, | |||
| RouteState & | routeState, | |||
| const UtlString & | method, | |||
| AuthResult | priorResult, | |||
| SipMessage & | request, | |||
| bool | bSpiralingRequest, | |||
| UtlString & | reason | |||
| ) | [virtual] |
Called for any request - enforces the restrictions specified by authrules.
This plugin uses one state parameter to record that the dialog has already been processed by authrules; it does not have any value. If that parameter is present in a request and routeState::isMutable returns false, then this method does not evaluate the authrules, it just returns ALLOW.
If the state parameter is not found, or routeState::isMutable returns true (indicating that this not an in-dialog request), then the authrules are evaluated.
| id | The authenticated identity of the request originator, if any (the null string if not). This is in the form of a SIP uri identity value as used in the credentials database (user) without the scheme or any parameters. |
| requestUri | parsed target Uri |
| routeState | the state for this request. |
| method | the request method |
| priorResult | results from earlier plugins. |
| request | see AuthPlugin regarding modifying |
| bSpiralingRequest | request spiraling indication |
| reason | rejection reason |
Implements AuthPlugin.
| void readConfig | ( | OsConfigDb & | configDb | ) | [virtual] |
Read (or re-read) the authorization rules.
| configDb | a subhash of the individual configuration parameters for this instance of this plugin. |
Implements AuthPlugin.
| bool isAuthorized | ( | const ResultSet & | requiredPermissions, | |
| const ResultSet & | grantedPermissions, | |||
| UtlString & | matchedPermission, | |||
| UtlString & | unmatchedPermissions | |||
| ) | [protected] |
| matchedPermission | first required permission found |
| unmatchedPermissions | requiredPermissions as a single string |
friend class EnforceAuthRulesTest [friend] |
| AuthPlugin* getAuthPlugin | ( | const UtlString & | name | ) | [friend] |
Factory used by PluginHooks to dynamically link the plugin instance.
OsRWMutex mRulesLock [private] |
AuthRulesUrlMapping* mpAuthorizationRules [private] |