My goal is to use the Microsoft Rights Management SDK 4.2 on a Linux system to access and manage protected documents.
I am unable to authenticate to the RMS server via a Federation Server (this is the setup that the SDK requires).
I have the following setup:
- A domain controller, dc1.mydomain
- A rights management server, rms1.mydomain, with Active Directory Rights Management Services, SQL Server, and the Mobile Device Extension for AD RMS
- An authentication server, fs1.mydomain, running Federation Services
All hosts in the cluster run Windows Server 2016 and have certificates signed by a Registration Authority. The root CA and intermediate RA certificates are installed on the hosts. The token signing certificate and token decrypting certificates for the Federation Service are also signed by the RA.
Microsoft Office applications (which use an earlier SOAP protocol) are able to talk to the RMS service. The RIghts Management SDK library uses a more lightweight JSON protocol provided by the Mobile Device Extension.
I have configured an SRV DNS record for _rmsdisco._http._tcp.mydomain.
The Mobile Device Extension has been configured to use https://fs1.mydomain for authentication.
On fs1.mydomain, I have configured a "Server application accessing a web API". The server application has client ID <ID> and client secret <SECRET>. The web API has the relying party identifier api.rms.rest.com.
I am unable to get the RMS SDK client to authenticate to the RMS server with the client application credentials. This is the failing oauth2 exchange:
- Attempt to fetch
https://rms1.mydomain:443/my/v2/servicediscovery?email=user1@mydomain
- This returns a 401 response with the expected WWW-Authenticate header:
WWW-Authenticate: Bearer realm="api.rms.rest.com", authorization="https://fs1.mydomain/adfs/oauth2/authorize"
- POST the following body to
https://fs1.mydomain/adfs/oauth2/token
:grant_type=client_credentials&client_id=<ID>&client_secret=<SECRET>&resource=api.rms.rest.com
- Obtain a signed authentication token with a decoded body looking something like this:
{"aud":"microsoft:identityserver:api.rms.rest.com","iss":"http://fs1.mydomain/adfs/services/trust","iat":1553792250,"exp":1553795850,"apptype":"Confidential","appid":"<ID>","authmethod":"http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password","auth_time":"2019-03-28T16:57:30.037Z","ver":"1.0"}
- Attempt to fetch the service discovery URI again, this time adding the following header:
Authorization: Bearer <TOKEN>
- Server returns a 401 response instead of 200.
I'm assuming that there is an error in the server configuration but don't know what. I'm not seeing anything logged in the RMS server but I'd guess that it's failing to verify the oauth token. The token signing certificate is present in the FederationData.xml supplied by the Federation Server. I have also installed it on the RMS server under "Certificates" (the certificate authority certificates are also present).
At this point, I'm stuck, hence reaching out for help.