Publishing Applications using AD FS Prea·续

To allow Web Application Proxy to perform single sign-on (SSO) and to perform credentials delegation using Kerberos constrained delegation, the Web Application Proxy server must be joined to a domain. See Plan Active Directory.

There are no additional planning steps if the application uses claims-based authentication. If the application used Integrated Windows authentication, see Publish an Integrated Windows authenticated-based Application for Web Browser Clients.

The authentication flow for clients that use the MS-OFBA protocol using claims-based authentication is described below. The authentication for this scenario can either use the application token in the URL, or in the body.

  1. The user is working in an Office program, and from the Recent Documents list, opens a file on a SharePoint site.

  2. The Office program shows a window with a browser control that requires the user to enter credentials.

Note

In some cases, the window may not appear because the client is already authenticated.

  1. Web Application Proxy redirects the request to the AD FS server, which performs the authentication.

  2. The AD FS server redirects the request back to Web Application Proxy. The request now contains the edge token.

  3. The AD FS server adds a single sign-on (SSO) cookie to the request because the user has already performed authentication against the AD FS server.

  4. Web Application Proxy validates the token and forwards the request to the backend server.

  5. The backend server redirects the request to the AD FS server to get the application security token.

  6. The request is redirected to the backend server. The request now contains the application token and the SSO cookie. The user is granted access to the SharePoint site and is not required to enter a user name or password to view the file.

The steps to publish an application that uses MS-OFBA are identical to the steps for a claims-based application or a non-claims-based application. For claims-based applications, see Publish a Claims-based Application for Web Browser Clients, for non-claims-based applications, see Publish an Integrated Windows authenticated-based Application for Web Browser Clients. Web Application Proxy automatically detects the client and will authenticate the user as required.

Publish an Application that uses HTTP Basic

HTTP Basic is the authorization protocol used by many protocols, to connect rich clients, including smartphones, with your Exchange mailbox. For more information on HTTP Basic, see RFC 2617. Web Application Proxy traditionally interacts with AD FS using redirections; most rich clients don't support cookies or state management. In this way Web Application Proxy enables the HTTP app to receive a non-claims relying party trust for the application to the Federation Service. See Plan Active Directory.

The authentication flow for clients that use HTTP Basic is described below and in this diagram:

Authentication diagram for HTTP Basic

  1. The user attempts to access a published web application a telephone client.

  2. The app sends an HTTPS request to the URL published by Web Application Proxy.

  3. If the request does not contain credentials, Web Application Proxy returns an HTTP 401 response to the app containing the URL of the authenticating AD FS server.

  4. The user sends the HTTPS request to the app again with authorization set to Basic and user name and Base 64 encrypted password of the user in the www-authenticate request header.

  5. Because the device cannot be redirected to AD FS, the Web Application Proxy sends an authentication request to AD FS with the credentials that it has including username and password. The token is acquired on behalf of the device.

  6. In order to minimize the number of requests sent to the AD FS, Web Application Proxy, validates subsequent client requests using cached tokens for as long as the token is valid. Web Application Proxy periodically cleans the cache. You can view the size of the cache using the performance counter.

  7. If the token is valid, Web Application Proxy forwards the request to the backend server and the user is granted access to the published web application.

The following procedure explains how to publish HTTP basic applications.

To publish an HTTP Basic application

  1. On the Web Application Proxy server, in the Remote Access Management console, in the Navigation pane, click Web Application Proxy, and then in the Tasks pane, click Publish.

  2. On the Publish New Application Wizard, on the Welcome page, click Next.

  3. On the Preauthentication page, click Active Directory Federation Services (AD FS), and then click Next.

  4. On the Supported Clients page, select HTTP Basic and then click Next.

If you wish to enable access to the Exchange only from workplace joined devices, select the Enable access only for workplace joined devices box. For more information see Join to Workplace from Any Device for SSO and Seamless Second Factor Authentication Across Company Applications.

  1. On the Relying Party page, in the list of relying parties select the relying party for the application that you want to publish, and then click Next. Note that this list contains only on-claims relying parties.

  2. On the Publishing Settings page, do the following, and then click Next:

  3. In the Name box, enter a friendly name for the application.

This name is used only in the list of published applications in the Remote Access Management console.

  • In the External URL box, enter the external URL for this application; for example, mail.contoso.com

  • In the External certificate list, select a certificate whose subject covers the external URL.

  • In the Backend server URL box, enter the URL of the backend server. Note that this value is automatically entered when you enter the external URL and you should change it only if the backend server URL is different; for example, mail.contoso.com.

  • On the Confirmation page, review the settings, and then click Publish. You can copy the PowerShell command to set up additional published applications.

  • On the Results page, make sure that the application published successfully, and then click Close.

Windows PowerShell equivalent commands

The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

This Windows PowerShell script enables preauthentication for all devices, not just workplace joined devices.


Add-WebApplicationProxyApplication

-BackendServerUrl 'https://mail.contoso.com'

-ExternalCertificateThumbprint '697F4FF0B9947BB8203A96ED05A3021830638E50'

-ExternalUrl 'https://mail.contoso.com'

-Name 'Exchange'

-ExternalPreAuthentication ADFSforRichClients

-ADFSRelyingPartyName 'EAS_Relying_Party'

The following preauthenticates only workplace joined devices:


Add-WebApplicationProxyApplication

-BackendServerUrl 'https://mail.contoso.com'

-ExternalCertificateThumbprint '697F4FF0B9947BB8203A96ED05A3021830638E50'

-EnableHTTPRedirect:$true

-ExternalUrl 'https://mail.contoso.com'

-Name 'Exchange'

-ExternalPreAuthentication ADFSforRichClients

-ADFSRelyingPartyName 'EAS_Relying_Party'

Publish an Application that uses OAuth2 such as a Microsoft Store App

To publish an application for Microsoft Store apps, you must add a relying party trust for the application to the Federation Service.

To allow Web Application Proxy to perform single sign-on (SSO) and to perform credentials delegation using Kerberos constrained delegation, the Web Application Proxy server must be joined to a domain. See Plan Active Directory.

Note

Web Application Proxy supports publishing only for Microsoft Store apps that use the OAuth 2.0 protocol.

In the AD FS Management console, you must make sure that the OAuth endpoint is proxy enabled. To check if the OAuth endpoint is proxy enabled, open the AD FS Management console, expand Service, click Endpoints, in the Endpoints list, locate the OAuth endpoint and make sure that the value in the Proxy Enabled column is Yes.

The authentication flow for clients that use Microsoft Store apps is described below:

Note

The Web Application Proxy redirects to the AD FS server for authentication. Because Microsoft Store apps do not support redirects, if you use Microsoft Store apps, it is necessary to set the URL of the AD FS server using the Set-WebApplicationProxyConfiguration cmdlet and the OAuthAuthenticationURL parameter.

Microsoft Store apps can be published only using Windows PowerShell.

  1. The client attempts to access a published web application using a Microsoft Store app.

  2. The app sends an HTTPS request to the URL published by Web Application Proxy.

  3. Web Application Proxy returns an HTTP 401 response to the app containing the URL of the authenticating AD FS server. This process is known as 'discovery'.

Note

If the app knows the URL of the authenticating AD FS server and already has a combo token containing the OAuth token and the edge token, steps 2 and 3 are skipped in this authentication flow.

  1. The app sends an HTTPS request to the AD FS server.

  2. The app uses the web authentication broker to generate a dialog box in which the user enters credentials to authenticate to the AD FS server. For information about web authentication broker, see Web authentication broker.

  3. After successful authentication, the AD FS server creates a combo token that contains the OAuth token and the edge token and sends the token to the app.

  4. The app sends an HTTPS request containing the combo token to the URL published by Web Application Proxy.

  5. Web Application Proxy splits the combo token into its two parts and validates the edge token.

  6. If the edge token is valid, Web Application Proxy forwards the request to the backend server with only the OAuth token. The user is granted access to the published web application.

This procedure describes how to publish an application for OAuth2. This type of application can be published only using Windows PowerShell. Before you begin, make sure that you have done the following:

  • Created a relying party trust for the application in the AD FS Management console.

  • Made sure that the OAuth endpoint is proxy enabled in the AD FS Management console and make a note of the URL Path.

  • Verified that a certificate on the Web Application Proxy server is suitable for the application you want to publish.

To publish an OAuth2 app

  1. On the Web Application Proxy server, in the Remote Access Management console, in the Navigation pane, click Web Application Proxy, and then in the Tasks pane, click Publish.

  2. On the Publish New Application Wizard, on the Welcome page, click Next.

  3. On the Preauthentication page, click Active Directory Federation Services (AD FS), and then click Next.

  4. On the Supported Clients page, select OAuth2 and then click Next.

  5. On the Relying Party page, in the list of relying parties select the relying party for the application that you want to publish, and then click Next.

  6. On the Publishing Settings page, do the following, and then click Next:

  7. In the Name box, enter a friendly name for the application.

This name is used only in the list of published applications in the Remote Access Management console.

  • In the External URL box, enter the external URL for this application; for example, https://server1.contoso.com/app1/.

  • In the External certificate list, select a certificate whose subject covers the external URL.

In order to make sure your users can access your app, even if they neglect to type HTTPS in the URL, select the Enable HTTP to HTTPS Redirection box.

  • In the Backend server URL box, enter the URL of the backend server. Note that this value is automatically entered when you enter the external URL and you should change it only if the backend server URL is different; for example, https://sp/app1/.

Note

Web Application Proxy can translate host names in URLs, but cannot translate path names. Therefore, you can enter different host names, but you must enter the same path name. For example, you can enter an external URL of https://apps.contoso.com/app1/ and a backend server URL of https://app-server/app1/. However, you cannot enter an external URL of https://apps.contoso.com/app1/ and a backend server URL of https://apps.contoso.com/internal-app1/.

  1. On the Confirmation page, review the settings, and then click Publish. You can copy the PowerShell command to set up additional published applications.

  2. On the Results page, make sure that the application published successfully, and then click Close.

Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.

To set the OAuth authentication URL for a federation server address of fs.contoso.com and a URL path of /adfs/oauth2/:


Set-WebApplicationProxyConfiguration -OAuthAuthenticationURL 'https://fs.contoso.com/adfs/oauth2/'

To publish the application:


Add-WebApplicationProxyApplication

-BackendServerURL 'https://storeapp.contoso.com/'

-ExternalCertificateThumbprint '1a2b3c4d5e6f1a2b3c4d5e6f1a2b3c4d5e6f1a2b'

-ExternalURL 'https://storeapp.contoso.com/'

-Name 'Microsoft Store app Server'

-ExternalPreAuthentication ADFS

-ADFSRelyingPartyName 'Store_app_Relying_Party'

-UseOAuthAuthentication

See also