ARTIFACTORY: Resolving SAML Authentication Errors

Products
Frog_Artifactory
Content Type
User_Guide
AuthorFullName__c
Yoav Harel
articleNumber
000006452
FirstPublishedDate
2025-05-22T06:36:04Z
lastModifiedDate
2025-05-21

ARTIFACTORY: Resolving SAML Authentication Errors

Introduction 

Troubleshooting SAML login issues in Artifactory? This guide addresses several common causes for login failures, including:
 - Discrepancies between the Artifactory base_url and the Identity Provider (IDP) application identifier.
 - Reply_URL inconsistencies between the SAML request and what's configured in the IDP.
 - HTTP 401 Unauthorized errors, often stemming from a mismatch between the IDP identifier and Artifactory's SAML Service Provider Name.
Each section details how to validate the specific problem and offers potential solutions.

BASE_URL does not match the IDP APP Identifier (Entity ID, Client ID, etc):

As outlined in our documentation under the Breaking Change for SAML SSO, starting from Artifactory 7.98.7, the base_url must be configured in Artifactory to prevent a 500 error. The reason for this is that Artifactory is using the base_url as the “Identifier” in the SAML Request.

One of the errors that may happen even if the base_url is configured, is a mismatch between the “Identifier” in the SAML Request to IDP Application identifier. In this scenario, when trying to login via SAML (even if it worked previously) the IDP may fail due to Identifier mismatch. Example of the error on the IDPs side.


User-added image 

 User-added image 

To validate if this is indeed the issue, we can use the SAMLRequest query param as seen in the URLs of the above screenshots, and decrypt it SAMLRequest to XML format. To decrypt it properly, we need to ensure we are copying only the SAMLREQUEST, and NOT including the RelayState

User-added image 

It can be done either by using an online service (e.g. Base64 Decode + Inflate) or using the below command:
echo <SAMLRequest> | base64 -d | xmllint --format -

 

* Requires base64 and xmllint to be installed

In the decrypted SAMLRequest, we can see the Identifier which is the base_url, and compare it to the IDP APP Identifier.

User-added image 

Azure example:

User-added image 

Keycloack example:

User-added image 

To fix the login, we should modify either the Artifactory base_url (Valid only for self-hosted installation) or IDP APP Identifier.

Reply_URL in SAMLRequest does not match the Reply_URL configured in IDP APP:

Although the SAMLRequest issuer is based on the base_url, the ReplyURL can be changed according to the URL reaching to Artifactory with (True for JFrog SaaS, for self-hosted this is depends if using the X-JFrog-Override-Base-Url header). In this scenario, the login will fail on the IDP side. User-added image

 

We can use the same technique shown above to decrypt the SAMLRequest to validate what is the AssertionConsumerServiceURL value and to compare it to the value configured in the IDP side.


User-added image

 

 

Azure example:

 User-added image

 

Keycloack example:

 

 User-added image

To resolve the error, we can add additional ReplyURL on the IDP side (if supported) or change the ReplyURL to match the SAMLRequest.
Azure:

 User-added image

Keycloack:

 User-added image

HTTP 401 Unauthorized Error:

This error mostly occurs due a mismatch between the IDP Identifier to the “SAML Service Provider Name” configured in the SAML setting in Artifactory.
 
 User-added image 
This time, we should examine the SAMLResponse, as the error is on the Artifactory side. To locate the SAMLResponse (without extra debug logger) by opening the browser dev-console, navigate to the Network tab, and re-try the login. Once the login failed, the SAMLResponse can be found by searching for the SAML setting (azure-ad in that case), and copying the SAMLResponse from the Payload of the request.

User-added image 

User-added image 

Decrypt the SAMLReponse using the same technique shown above, to compare between the value of Issuer to the value of “SAML Service Provider Name”, as they should be an exact match. As can be seen below the “SAML Service Provider Name” is missing the slash (/) at the end causing the SAML login to fail.

User-added image 

 User-added image 


Conclusion
  
Troubleshooting common SAML login issues in Artifactory often involves identifying configuration mismatches between Artifactory and the Identity Provider (IDP). 

Key issues include Artifactory's base_url (used as the "Identifier" in the SAML Request) not matching the IDP Application Identifier (Entity ID, Client ID), the Reply URL (AssertionConsumerServiceURL) in the SAML Request not matching the Reply URL(s) configured in the IDP application, and an HTTP 401 Unauthorized Error frequently caused by a mismatch between the IDP's Issuer (found in the SAML Response) and the "SAML Service Provider Name" set in Artifactory's SAML configuration. 

Effective debugging relies heavily on capturing the SAML messages: the SAMLRequest can be found as a query parameter in the browser URL upon IDP-side failure, while the SAMLResponse is captured from the browser's developer console Network tab after the IDP redirect, often within the payload of the request corresponding to your SAML setting name. 
By decrypting these base64-encoded messages to XML format using online tools or commands like echo <SAMLRequest> | base64 -d | xmllint --format -, you can inspect critical elements such as the <saml:Issuer> tag (for the Identifier in the SAML Request and the Issuer in the SAML Response) and the AssertionConsumerServiceURL. Resolution requires ensuring an exact match between the values found in the decrypted SAML messages and the corresponding settings in both the IDP application and Artifactory's SAML configuration.