IT tutorials
 
Technology
 

Sharepoint 2013 : SharePoint App Security - Establishing app identity by using S2S trusts (part 1) - Architecture of an S2S trust

2/7/2014 8:42:36 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

In this article, you have learned that SharePoint 2013 supports external app authentication by using both OAuth and S2S trusts. Although OAuth is primarily intended for use in the Office 365 environment, the S2S trust infrastructure was specifically designed to work in on-premises farms with provider-hosted apps.

Using an S2S trust for external app authentication is similar to OAuth in the sense that code in the remote web passes an access token when calling to the SharePoint host environment. However, the manner in which the access token is created and the parties involved are very different.

One significant difference from using OAuth is that an S2S trust does not require any communications with Windows Azure ACS or any other authentication server in the cloud. The only servers involved in an S2S trust are the web server that hosts the remote web and the web servers of an on-premises SharePoint 2013 farm. Therefore, all of the servers required with an S2S trust can all run within the same LAN or private network.

A second significant difference involves authenticating the current user. When using OAuth, the SharePoint host environment authenticates the current user and then passes this user’s identity to the remote web by using the context token.

Things work very differently when using an S2S trust. The SharePoint host environment doesn’t pass the identity of the current user to the remote web. In fact, the SharePoint host environment doesn’t pass a context token at all. The context token, which is a central figure in OAuth, doesn’t even exist in the authentication flow of an S2S trust.

When a provider-hosted app is configured to authenticate by using an S2S trust, its remote web takes on the responsibility of authenticating the current user independently of any user authentication that has taken place in the SharePoint host environment. Once the remote web has authenticated the current user, it can then create an access token that contains both the app identity and the identity of the current user.

When using OAuth, the remote web must call to Windows Azure ACS to acquire an access token. However, a provider-hosted app using an S2S trust can create an access code on its own by using the TokenHelper class.

After the remote web for a provider-hosted app has created an S2S access token, it can then pass the access token to the SharePoint host environment when executing CSOM command or REST API calls. The programming aspects of passing the access token string using the Authentication header in a provider-hosted app by using an S2S trust works the same way as it does when using OAuth.

High-trust configurations vs. full-trust configurations

A provider-hosted app using an S2S trust is often referred to as a high-trust configuration. The term “high trust” is used to imply that the provided-hosted app authenticates the current user independently of the SharePoint host environment. When the provider-hosted app makes a CSOM or REST API call, the SharePoint host environment cannot verify identity of the current user. Therefore, the SharePoint host environment must trust that the provider-hosted app has properly authenticated the user and passed the true identity of the current user in the access token.

Do not confuse the term “high trust” with “full trust.” Code that runs with full trust, such as server-side code in a farm solution, runs without security restrictions. Full-trust code can do whatever it wants to do. This is very different from a provider-hosted app running at high trust, which is constrained by whatever set of permissions has been granted to the app.

Architecture of an S2S trust

The architecture of an S2S trust is based on a X.509 certificate which contains a public/private key pair. The public and private keys are used to perform asymmetric encryption. The critical underlying concept is that the provider-hosted app uses the private key to sign the access token. The SharePoint host environment uses the public key to verify that the access token has been created and signed by a party that possesses the private key. This, in turn, makes it possible for the SharePoint host environment to authenticate calls from a provider-hosted app that is configured to use an S2S trust.

Figure 1 shows the high-level architecture of an S2S trust. Unlike a scenario involving OAuth, the remote web does not need to communicate with Windows Azure ACS to acquire access tokens. Instead, it is able to create access tokens on its own which must be signed with the private key. One important observation is that the remote web requires access to the private key at runtime whenever it needs to create an access token.

A server to server trust is based on a public private key pair that allows apps to create access tokens that carry a digital signature.

Figure 1. A server to server trust is based on a public private key pair that allows apps to create access tokens that carry a digital signature.

A second requirement for an S2S trust is that the hosting SharePoint farm must be configured with a special type of secure token service known as a trusted security token issuer. You will learn how to configure a trusted security token issuer by using a public key file and a Windows PowerShell script later in the chapter.

Let’s follow the stages of the S2S authentication flow that are shown in Figure 1. In stage 1, the user navigates to a SharePoint site and is prompted to log on. When the user supplies a valid set of credentials and logs on, the SharePoint host environment creates a SAML token to track the user’s identity. However, the identity of the user is never passed to a provider-hosted app using an S2S trust.

In stage 2, the user navigates to the Site Settings page and sees the tile for a provider-hosted app which has been configured to use an S2S trust. When the user clicks this tile, the SharePoint host environment uses an app launcher to redirect the user to the start page in the remote web.

When the SharePoint host environment redirects the user to the start page of a provider-hosted app with an S2S trust, it passes many of the same query string parameters as in an OAuth scenario such as the SPHostUrl parameter. However, the SharePoint host environment does not pass a context token. This means that the SharePoint host environment passes nothing to indicate who the user is. This puts the responsibility on the remote web to authenticate the user.

Stage 3 occurs after the user has been authenticated and there is a need to create an access token. When code in the remote web creates an access token by using the TokenHelper class, it adds information into the access token about the identity of the app and the identity of the current user. Next, the remote web then must acquire the value of the private key file to sign the access token. After the remote web has created and signed the access token, it can pass the access token by using the Authorization header each time it executes a CSOM command or a REST API call.

In stage 4, the SharePoint host environment uses external authentication to authenticate a call from a provider-hosted app that is using the S2S trust. For this to work, the hosting SharePoint farm must first be configured with a trusted security token issuer that is based on the public key. During the external authentication process, the SharePoint host environment inspects the access token and uses the trusted security token issuer to verify its authenticity.

Configuring S2S trusts for Microsoft products

The infrastructure for configuring S2S trusts within a SharePoint 2013 farm wasn’t just created exclusively for custom app development. When configuring a SharePoint 2013 farm, it is sometimes necessary to create S2S trusts for Microsoft products such as Exchange 2013 and Workflow Manager. Configuring an S2S trust makes it possible for these Microsoft products to call into the SharePoint host environment with a distinct app identity and with a set of preconfigured permissions.
 
Others
 
- Sharepoint 2013 : SharePoint App Security - Establishing app identity by using OAuth (part 3) - Developing with OAuth - Working with access tokens
- Sharepoint 2013 : SharePoint App Security - Establishing app identity by using OAuth (part 2) - Developing with OAuth - Programming with the TokenHelper class
- Sharepoint 2013 : SharePoint App Security - Establishing app identity by using OAuth (part 1) - Understanding app principals
- Sharepoint 2013 : SharePoint App Security - Managing app permissions
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Clear Previous Entries
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Loop Through the Secondary Data Source , Populate the Repeating Table
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Create a Namespace Variable, Access the Secondary Data Source
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Create a Changed Event Method
- InfoPath with SharePoint 2010 : Dynamically Populate a Repeating Table - Set Up the Initial Form
- Windows 7 : Managing Application Compatibility (part 6) - Installing and Configuring the Application Compatibility Toolkit
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us