Security Door Pattern

A security door is a door to an apartment block which can only be opened by someone inside the apartment block, or someone with a key to it. It ensures that unauthorised people can't enter the apartment block.

In software, the security door pattern is used to check parameters or caller credentials before providing access to potentially dangerous functionality. The code provides two entry points - one public and one private. The public entry point does the checking (potentially using the BouncerPattern), and if its requirements are satisfied, forwards the request to the private entry point. Within the code itself, the private entry point is always used, avoiding the overhead of the checking.

This pattern is often used in the implementation of CORBA interfaces. The CORBA object implementation often has a delegate object which implements the private entry points and the functionality. The code in the CORBA object implementation is only required to check the parameters, perhaps translate from IDL types to local types and catch exceptions, then forwards the request to the private entry point in the delegate. This avoids the delegate having to implement error checking to protect itself from every yahoo on the internet. The CORBA object is the public interface to the private implementation, and hence acts as a security door.

--JohnFarrell

Also known as: CheckAtTheGate?


I believe some Eiffel implementations use a similar technique for checking pre-conditions.

Each function has two entry points, one which checks pre-condtions and another, quicker one which doesn't. The checkless entry point is used (a) by calls from the class to itself (language semantics say that the pre-conditions need not be true for such calls); (b) where the compiler can statically show that the conditions are always true; (c) where checks have been explicitly disabled for some class by the programmer, for speed. -- DaveHarris


CategorySecurity CategorySecurityPatterns

EditText of this page (last edited September 21, 2004) or FindPage with title or text search