programming4us
programming4us
SECURITY

Programming COM+ Security (part 1) - Creating the Serviced Component, Specifying the COM+ Application Type

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
In this section, we explain how to configure COM+ security with .NET attributes; we do this by creating and deploying an example serviced component. We demonstrate how to use COM+ RBS and PAS to control access to a simple component that tracks software defects for an imaginary software product called SecurityPro

We begin by defining the IDefectTracker interface, which contains the three methods we use to simulate defect tracking. We briefly describe the purpose of each interface method in the list below. We are developing this component to demonstrate COM+ security, so we do not define types to represent defects, or specify method arguments:


ViewAllDefects

Returns all of the pending defects for the product


CreateNewDefect

Creates a new record representing a pending defect


CloseDefect

Closes a defect and removes it from the pending list

The following statements define our simple IDefectTracker interface:

# C#

using System;

public interface IDefectTracker {

    void ViewAllDefects(  );

    void CreateNewDefect(  );

    void CloseDefect(  );
}

# Visual Basic .NET

Imports System

Public Interface IDefectTracker

    Sub ViewAllDefects(  )

    Sub CreateNewDefect(  )

    Sub CloseDefect(  )

End Interface

In the following sections, we create a serviced component that implements the IDefectTracker interface, and apply .NET attributes to configure COM+ RBS and PAS.

1. Creating the Serviced Component

A serviced component must inherit from the System.EnterpriseServices.ServicedComponent class and must be a member of a strong-named assembly. The following statements list the SecurityProTracker class, which extends ServicedComponent and implements the IDefectTracker interface.

# C#

using System;
using System.EnterpriseServices;

// Specify the file containing the key for assembly signing
						[assembly: System.Reflection.AssemblyKeyFile("mykey.key")]

public class SecurityProTracker: ServicedComponent, IDefectTracker {

    public void ViewAllDefects(  ) {}

    public void CreateNewDefect(  ) {}

    public void CloseDefect(  ) {}
}

# Visual Basic .NET

Imports System
Imports System.EnterpriseServices

' Specify the file containing the key for assembly signing
						<Assembly: System.Reflection.AssemblyKeyFile("mykey.key")>

Public Class SecurityProTracker
    Inherits ServicedComponent
    Implements IDefectTracker

    Public Sub ViewAllDefects(  ) Implements IDefectTracker.ViewAllDefects
    End Sub

    Public Sub CreateNewDefect(  ) Implements IDefectTracker.CreateNewDefect
    End Sub

    Public Sub CloseDefect(  ) Implements IDefectTracker.CloseDefect
    End Sub

End Class		  

2. Specifying the COM+ Application Type

The System.EnterpriseServices.ApplicationActivation class is the first COM+ attribute we apply, allowing us to specify whether we want a COM+ server or library application. This attribute accepts a single parameter, which must be a value from the System.EnterpriseServices.ActivationOption enumeration, the values of which are detailed in Table 1. Application proxies are created with the Component Services tool; consult the Windows documentation for details.

Table 1. The enumeration values
Value Description
Library Specifies that serviced components are activated in the client application process
Server Specifies that serviced components are activated in a process provided by COM+

The emphasized statements in the code fragment below demonstrate the use of the ApplicationActivation attribute to specify a COM+ server application for our example component:

# C#

using System;
using System.EnterpriseServices;

// Specify the file containing the key for assembly signing
[assembly: System.Reflection.AssemblyKeyFile("mykey.key")]
// Specify that we want a COM+ Server application
						[assembly: ApplicationActivation(ActivationOption.Server)]

public class SecurityProTracker: ServicedComponent, IDefectTracker {

# Visual Basic .NET

Imports System
Imports System.EnterpriseServices

' Specify the file containing the key for assembly signing
<Assembly: System.Reflection.AssemblyKeyFile("mykey.key")> 
' Specify that we want a COM+ Server application
						<Assembly: ApplicationActivation(ActivationOption.Server)> 

Public Class SecurityProTracker
    Inherits ServicedComponent
    Implements IDefectTracker
Other  
 
Top 10
Free Mobile And Desktop Apps For Accessing Restricted Websites
MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
TOYOTA CAMRY 2; 2.5 : Camry now more comely
KIA SORENTO 2.2CRDi : Fuel-sipping slugger
How To Setup, Password Protect & Encrypt Wireless Internet Connection
Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
Backup & Restore Game Progress From Any Game With SaveGameProgress
Generate A Facebook Timeline Cover Using A Free App
New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
- Messages forwarded by Outlook rule go nowhere
- Create and Deploy Windows 7 Image
- How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
- Creating and using an unencrypted cookie in ASP.NET
- Directories
- Poor Performance on Sharepoint 2010 Server
- SBS 2008 ~ The e-mail alias already exists...
- Public to Private IP - DNS Changes
- Send Email from Winform application
- How to create a .mdb file from ms sql server database.......
programming4us programming4us
programming4us
 
 
programming4us