#include <AuthPlugin.h>

Record-Route based actions. An AuthPlugin is an action invoked by the sipXproxy whenever a SIP Message is passing through. See SipRouter for the context of this call.
This class is the abstract base from which all AuthPlugins must inherit.
To configure a AuthPlugin into the sipXproxy, the sipXproxy-config file should have a directive configuring the plugin library:
SIPX_PROXY_HOOK_LIBRARY.[instance] : [path to libexampleauthplugin.so]
In addition to the class derived from this base, a AuthPlugin library must provide a factory routine named getAuthPlugin with extern "C" linkage so that the OsSharedLib mechanism can look it up in the dynamically loaded library (looking up C++ symbols is problematic because of name mangling).
The decision making of the plugin is in the authorizeAndModify method.
Public Types | |
| enum | AuthResult { CONTINUE, DENY, ALLOW } |
| Action to be taken by the proxy. More... | |
Public Member Functions | |
| virtual | ~AuthPlugin () |
| destructor | |
| virtual AuthResult | authorizeAndModify (const UtlString &id, const Url &requestUri, RouteState &routeState, const UtlString &method, AuthResult priorResult, SipMessage &request, bool bSpiralingRequest, UtlString &reason)=0 |
| Called by SipRouter::proxyMessage for each request to authorize and/or modify before sending. | |
| virtual void | readConfig (OsConfigDb &configDb)=0 |
| Read (or re-read) whatever configuration the plugin requires. | |
| virtual void | announceAssociatedSipRouter (SipRouter *sipRouter) |
| Used to announce the SIP Router instance that is logically associated with this Auth Plugin. Plugins that need to interact with their associated SIP Router can override this method and save the passed pointer for later use. | |
Static Public Member Functions | |
| static const char * | AuthResultStr (AuthResult result) |
| Provide a string version of an AuthResult value for logging. | |
Static Public Attributes | |
| static const char * | Prefix = "SIPX_PROXY" |
| the configuration file prefix = "SIPX_PROXY" | |
| static const char * | Factory = "getAuthPlugin" |
| the factory routine name = "getAuthPlugin" | |
Protected Member Functions | |
| AuthPlugin (const UtlString &instanceName) | |
| constructor | |
| enum AuthResult |
| virtual ~AuthPlugin | ( | ) | [inline, virtual] |
destructor
| AuthPlugin | ( | const UtlString & | instanceName | ) | [inline, protected] |
constructor
| instanceName | the configured name for this plugin instance |
| virtual AuthResult authorizeAndModify | ( | const UtlString & | id, | |
| const Url & | requestUri, | |||
| RouteState & | routeState, | |||
| const UtlString & | method, | |||
| AuthResult | priorResult, | |||
| SipMessage & | request, | |||
| bool | bSpiralingRequest, | |||
| UtlString & | reason | |||
| ) | [pure virtual] |
Called by SipRouter::proxyMessage for each request to authorize and/or modify before sending.
This method may do any combination of: - Determine whether or not the request is authorized, using any characteristics of the message. For any identity, it should use the given identity. The result of any plugins that have been called is passed in priorResult - if the priorResult is not CONTINUE, then the authorization returned by this plugin will not be used (because the earlier result takes precedence); the plugin may use this fact to skip any authorization processing it would otherwise perform.
An AuthPlugin MUST NOT call RouteState::update (it is called by the authproxy after all plugins have completed).
The SipRouter pointer provides access to information in the calling sipXproxy; the most useful of these is probably SipRouter::isLocalDomain.
authorizeAndModify should usually record the fact that a dialog forming request is authorized in a RouteState parameter so that any subsequent in-dialog requests can be authorized by just looking at the state.
If the final result of the AuthPlugin chain is DENY for any request, the proxy responds with either:
NOTE about the bSpiralingRequest parameter: This parameter is set to true by the caller if the request is to be sent next to this proxy (spiraled), and false otherwise. Plug-ins that are only concerned with requests that will be sent to a target other than this proxy and are not concerned with intermediate requests that are still spiraling through sipXproxy can use this flag to only process those requests that have finished spiraling.
| 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 below regarding modifying this |
| bSpiralingRequest | true if request is still spiraling through proxy false if request is ready to be sent to target |
| reason | rejection reason |
Implemented in CallDestination, CallerAlias, EmergencyNotify, EnforceAuthRules, MSFT_ExchangeTransferHack, NatTraversalAgent, RequestLinter, SubscriptionAuth, and TransferControl.
| virtual void readConfig | ( | OsConfigDb & | configDb | ) | [pure virtual] |
Read (or re-read) whatever configuration the plugin requires.
| configDb | a subhash of the individual configuration parameters for this instance of this plugin. |
Implements Plugin.
Implemented in CallDestination, CallerAlias, EmergencyNotify, EnforceAuthRules, MSFT_ExchangeTransferHack, NatTraversalAgent, RequestLinter, SubscriptionAuth, and TransferControl.
| virtual void announceAssociatedSipRouter | ( | SipRouter * | sipRouter | ) | [inline, virtual] |
Used to announce the SIP Router instance that is logically associated with this Auth Plugin. Plugins that need to interact with their associated SIP Router can override this method and save the passed pointer for later use.
Reimplemented in CallDestination, CallerAlias, MSFT_ExchangeTransferHack, NatTraversalAgent, RequestLinter, SubscriptionAuth, and TransferControl.
| const char * AuthResultStr | ( | AuthResult | result | ) | [static] |
Provide a string version of an AuthResult value for logging.
const char * Prefix = "SIPX_PROXY" [static] |
the configuration file prefix = "SIPX_PROXY"
const char * Factory = "getAuthPlugin" [static] |