log4net SDK Reference |

# SecurityContextProvider Class

The SecurityContextProvider providers default SecurityContext instances.

For a list of all members of this type, see SecurityContextProvider Members.

System.Object
log4net.Core.SecurityContextProvider

[Visual Basic]
Public Class SecurityContextProvider
[C#]
public class SecurityContextProvider

#### Thread Safety

This type is not safe for multithreaded operations.

#### Remarks

A configured component that interacts with potentially protected system resources uses a SecurityContext to provide the elevated privileges required. If the SecurityContext object has been not been explicitly provided to the component then the component will request one from this SecurityContextProvider.

By default the DefaultProvider is an instance of SecurityContextProvider which returns only NullSecurityContext objects. This is a reasonable default where the privileges required are not know by the system.

This default behavior can be overridden by subclassing the SecurityContextProvider and overriding the CreateSecurityContext method to return the desired SecurityContext objects. The default provider can be replaced by programmatically setting the value of the DefaultProvider property.

An alternative is to use the `log4net.Config.SecurityContextProviderAttribute` This attribute can be applied to an assembly in the same way as the `log4net.Config.XmlConfiguratorAttribute"`. The attribute takes the type to use as the SecurityContextProvider as an argument.

#### Requirements

Namespace: log4net.Core

Assembly: log4net (in log4net.dll)

#### See Also

SecurityContextProvider Members | log4net.Core Namespace