FusionAuth / fusionauth-issues

FusionAuth issue submission project
https://fusionauth.io
90 stars 12 forks source link

Get a 500 error using sourceApplicationId when application has samlv2Configuration #2118

Closed bhalsey closed 1 year ago

bhalsey commented 1 year ago

Get a 500 error using sourceApplicationId when application has samlv2Configuration

Description

Creating a new application from another application with sourceApplicationId returns a 500 error when the source application has SAML v2 enabled and configured. If you have not configured SAML v2, you will not be affected by this issue.

Affects versions

1.43.0

Steps to reproduce

  1. Create an application
  2. Add samlv2Configuration
  3. Attempt to copy application via api with a command like: curl -i -X POST -H "Content-type: application/json" -d '{"application": {"name": "test copy app"}, "sourceApplicationId": "<insert id here>"}' https://demo.fusionauth.io/api/application
  4. Get 500 status

Expected behavior

Expect a copy of the application to be created

Workaround

Call Create Application API without the sourceApplicationId parameter and supply all the parameters copied from the source application.

Logs

Server log has

2023-02-20 11:12:38.193 PM ERROR io.fusionauth.app.primeframework.error.ExceptionExceptionHandler - An unhandled exception was thrown
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "applications_uk_2"
  Detail: Key (samlv2_issuer, tenants_id)=(https://local.fusionauth.io/samlv2/sp/e356d63f-7106-46b4-a961-c5c1e3604853, 30663132-6464-6665-3032-326466613934) already exists.

Platform

lyleschemmerling commented 1 year ago

Internal: