Home > Articles > Programming > Windows Programming

Implementing Security in B2B Applications

Lyn Robison details security development in B2B applications, especially how to implement security and content access.
This sample chapter is excerpted from Implementing B2B Commerce with .NET: A Guide for Programmers and Technical Managers, by Lyn Robison.
This chapter is from the book

This chapter gives details of security development in B2B applications, especially how to implement security and content access. Chapter 8 focuses on why security threats exist and where the threats come from. Chapter 8 also gives an introduction to encryption, public and private keys, digital certificates, and SSL. You may want to refer to that chapter for context on the implementation advice presented in this chapter. The key points for this chapter are the following:

  • A B2B Web site aggregates multiple extranets into a single site.

  • A B2B Web site provides the security context in which commerce between companies can be conducted online.

  • Application software used by businesses today is typically not built to run in a B2B environment, so developers must somehow bolt security and content access control onto these applications.

  • Role-based security is not sufficient for typical B2B Web sites.

  • Developers can build a powerful, permission list-based access control system using a SQL database, and they can expose the security settings that are stored in the database to content managers with Web browsers.

2.1 Security, a Primary Role of B2B Web Sites

Every company has information and applications that it uses internally, as well as customers and partner businesses that it works with externally. When a company exposes its internal information to its external customers, it needs to do so in the right context. And when customers obtain information from a company, they need to obtain that information in the right context. A B2B Web site provides that context.

A primary function of a B2B Web site is to secure the flow of information between businesses. A B2B Web site provides the security context in which online commerce can be conducted.

2.1.1 A Real-World Example of a Fundamental B2B Design Pattern

Recently I met some people from a Fortune 500 company who were very interested in implementing B2B Internet commerce. This company is a manufacturer in a particular industry, but their example is broadly applicable, so I'll refer to them with the generic name "Manufacturer A." In fact, their example is so broadly applicable, that it constitutes a fundamental design pattern that builders of B2B applications will encounter again and again.

Manufacturer A maintains numerous lucrative business relationships with several Fortune 500 companies. In some of these relationships, Manufacturer A is the buyer, and in others it is the seller. In all of these relationships, a large quantity of contextual information supplements each transaction. (Here I am not referring to computer science-type ACID transactions, but rather I am using the term transaction merely to mean a purchase or sale of goods or services.) Information in diverse forms is exchanged between Manufacturer A and its business partners. Information is exchanged both in advance of each transaction and after each transaction is completed. Sometimes information is exchanged for the express purpose of keeping the relationship between the companies alive and healthy.

Information is exchanged on products, prices, designs, shipments, estimates, recommendations, proposals, contracts, clarifications, problems, replacements, questions, answers—you name it. And this information is exchanged through several different, and often inefficient, mediums, including fax, e-mail, telephone, voice mail, snail mail, and face-to-face.

It is important to note that information is exchanged in the context of the particular relationship between Manufacturer A and its individual business partners. For example, the information that Manufacturer A provides to Company B is tailored to Company B. Another company, such as Company C, should never see any of Company B's confidential information. Thus every relationship between businesses has its own security context, which defines what information is to be exchanged between the parties. (At this level of discussion, the security context is an abstract idea, and I am not yet referring to any concrete implementation of a security context in software.) A manager I know at Manufacturer A realized that he could use the Internet to enhance greatly his company's relationships with its various business partners. This manager felt that if he could build an extranet site that is secure and tailored to Company B, he could use it efficiently to exchange information and perform transactions with Company B. He realized that a secure extranet site would be a more efficient medium in which to conduct business than the current mishmash of faxes, e-mails, phone calls, voice mails, letters, and meetings.

He decided that, ideally, Manufacturer A's extranet site should look and act like it is part of Company B's intranet. In other words, the site should be unique and tailored for Company B. Such a Web site would make it easier for the people at Company B to conduct business with his company.

He also realized that if he were to set up an extranet site for each of his company's business partners, they could all conduct business more readily with his company. This idea is illustrated in Figure 2-1.

Figure 2-1FIGURE 2-1 Extranets Provide the Security Contexts for B2B Applications

As you can see in Figure 2-1, each extranet site provides a security context in which information is exchanged and transactions are conducted with each individual business partner. It is important to note again that information is exchanged in the context of the particular relationship between Manufacturer A and each individual business partner.

This is a prevalent design pattern in B2B commerce. The relationship between two businesses defines the security context in which information is exchanged.

Unlike the illustration in Figure 2-1, a company will probably not want to implement a separate extranet site for each of its customers and partners. Rather, the company will want a single Web site that can function like a chameleon and change its appearance based on its context. This is what a B2B Web site does, as illustrated in Figure 2-2.

Figure 2-2FIGURE 2-2 A Single B2B Web Site Aggregates Multiple Extranet Sites

A B2B Web site contains and aggregates multiple extranets. The idea is one URL— multiple Web sites. This means that a customer can visit the B2B Web site, and based on who they are, what they do, and what company they work for, the Web site dynamically changes its skin and its content to match that customer's context.

Therefore, when I say, "B2B Web site," think "extranet site that changes its skin and content to match the user who is viewing it."

When it comes to concrete implementations in the B2B world, a company can't deploy applications that don't work within the security context of each partner's relationship. For example, you can't buy an online product catalog system off the shelf and expect it to work in a B2B environment unless that product catalog system knows how to work within the proper security context. You don't want that product catalog application to take the specialized products and prices that you intended for Company B and expose them to Company C also. You want the products and prices for Company B to be accessible only to users from Company B.

If the product catalog is a complex application that was designed without any B2B-type security context in mind and if you don't have access to the source code for that catalog app, it might be difficult for you to bolt on that security context. For many applications, this security context must exist at the schema level, with the app designed and built using the security schema as its foundation. For a catalog application to expose certain products and prices only to certain companies, it needs a schema that enables a particular company or set of companies to be associated with each item in the catalog, or perhaps with each attribute of each item in the catalog.

Traditionally, software applications have been built for use only inside the protected walls of a business, with no thought given to the prospect of these applications being opened up for access by users outside the company. External access, and the requisite security that it demands, is typically not considered when designing the security features of software applications, and information systems in general are not constructed with external security in mind.

For a company to implement Internet commerce between businesses, it has to find a way to bolt access controls onto applications that were designed to work only inside the walls of the company. The company needs to provide secure, Web-based access to its backend applications for each of its relevant customers. Furnishing this security is a primary function of a B2B Web site.

When I talk to developers who are new to B2B development, a question I often hear is "Is all of this security really necessary?" The best answer I can give is to explain that in every one of the dozens of B2B development projects I have been involved with, the business managers, the people driving the design of the application, always pushed the envelope of the app's access control system. When it comes to opening up their sensitive business data to customers and partners outside the company, business managers always want robust and highly granular control of who has access to what.

It turns out that providing a highly granular level of content access control can be tricky to implement. I have noticed a common misconception among developers who assume that role-based security is the answer to virtually any security problem. In my experience, group- or role-based security is inadequate for typical B2B applications.

For example, a company that owns a B2B Web site might have a document that it wants to make available only to executives of their supplier companies. With role-based security, the company's content manager on the B2B site could create a role called Executives and another role called Suppliers. However, the problem is that you typically cannot do a logical AND between the roles with role-based security. Set-based operations between the roles are not available in typical role-based security systems.

The content manager might specify the Executive's role and the Supplier's role as having access to this document, but that would mean that anyone who is an executive, whether he or she works for a supplier or not, and anyone who works for a supplier, whether he or she is an executive or not, would be able to access this document. In other words, granting access to the Executive's role and the Supplier's role creates a logical OR between the roles, which is a union of the sets of Executives and Suppliers.

To create a logical AND between the roles, the content manager would have to hardwire it into another role called SupplierExecutives, which would be the intersection of the Executive's role and the Supplier's role. The problem with this approach is that the number of roles the content manager must create mushrooms as it becomes apparent how many logical ANDs are required between their various roles. As the roles proliferate, they become difficult to manage. In addition, performing the security checks, whether at login time or each time a resource is accessed, can become a significant drag on performance.

There is another limitation with the role-based security found in operating systems and databases that makes it inadequate for B2B applications. Typically there is a requirement that content managers on the B2B Web site must be able to administer the content access settings. The problem is that content managers are generally not system administrators or database administrators or developers; they are nontechnical business users who are responsible for content on the site and who want to specify who can see what.

So B2B application developers cannot expect these nontechnical content managers to run any operating system administration utilities or database administration utilities to administer the content access control on the B2B Web site. I mention this not as a complaint about these utilities but rather to point out that developers of B2B applications cannot assume their users will be able to use them effectively. Therefore developers have to build administration screens for content access settings that are more elegant than those utilities based on the (lack of) technical savvy of the content managers.

The bottom line is that for B2B applications, developers must create application-level security that is more powerful than system-level group or role-based security and at the same time is easier to use than operating system and database administration screens.

Later in this chapter, I describe a permission list–based access control algorithm that enables security to be applied to distinct resources on a Web site. Those resources could be individual documents or pages. The granularity of the algorithm can be extended to apply security to portions of pages and to methods on Web services.

This permission list–based access control algorithm is implemented using a few tables and stored procedures in SQL Server, which could be exposed to nontechnical content managers on a B2B Web site using elegant and simple HTML forms. But before getting into the SQL schema and code, there are a few fundamental concepts on implementing security that must be clarified.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020