tracker issue : CF-4198041

select a category, or use search below
(searches all categories and all time range)
Title:

Administrator API setMySQL5() throws error if user is logged into a ColdFusion application

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Mikel Goicoechea / Mikel Goicoechea (Mikel Goicoechea)

Created: 11/23/2016

Components: Administrator

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: CF2016_Update3 / 4199061

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win 2012 Server x64

Vote Count: 1

Problem Description: cfide.adminapi.datasource.setMySQL5() only works if the user is not logged into a ColdFusion application

Steps to Reproduce:
run this script:

<!--- log user into cf application --->
<cfloginuser name="test" password="" roles="">

<!--- log into cf administrator --->
<cfset administrator = CreateObject("component","cfide.adminapi.administrator")>
<cfset loginSuccess = administrator.login("test")><!--- add actual credentials --->

<!--- create datasource parameters --->
<cfset datasourceValues = StructNew()>
<cfset datasourceValues.host = "test">
<cfset datasourceValues.database = "test">
<cfset datasourceValues.name = "test">
<cfset datasourceValues.password = "test">
<cfset datasourceValues.username = "test">
<!--- create datasource --->
<cfset datasource = CreateObject("component","cfide.adminapi.datasource")>
<cfset datasource.setMySQL5(argumentCollection=datasourceValues)>


Actual Result:

ColdFusion error: coldfusion.security.SecurityManager$UnauthenticatedCredentialsException

Expected Result:

datasource created

Any Workarounds:

log the user out with <cflogout> before calling setMySQL5()

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4198041

External Customer Info:
External Company:  
External Customer Name: Mikel Goicoechea
External Customer Email:  
External Test Config: My Hardware and Environment details:



We're running ColdFusion 2016 on Windows Server 2012, but I don't think it matters.

Attachments:

Comments:

This bug existed in a slightly different form in CF10. In CF10, the datasource would be created, but the user would be logged out of the ColdFusion application. The CF2016 version of the bug seems worse, because it's not very intuitive that you have to log out of the ColdFusion application in order to use the Administrator API. If it hadn't been for the CF10 version of the bug, I wouldn't have figured out the workaround.
Comment by External U.
1474 | November 23, 2016 08:33:36 AM GMT
Confirming this is an issue with cfide.adminapi.datasource generally. In my case my code worked correctly when run locally. When I was hitting that same page via ansible uri calls I would get the unauthenticated error. I am not using cfloginuser. In my case it was failing on all calls to cfide.adminapi.datasource including getDatasources(). It seemed that all of the other adminapi calls within the same configuration 'page' (adding mappings using extensions, runtime changes etc) worked but for some reason the datasource calls seemed to run differently and refused to authenticate even when putting another 'login' right before the call to getDatasources(). The workaround above did the trick ( adding <cflogout> before accessing getDatasources() ). I'm also logging back in via adminapi.administrator before getDatasources() call though unsure if needed.
Comment by Amy O.
1475 | February 17, 2017 08:37:13 PM GMT
Hi Amy, I tried your Testcase. There was an issue with authentication before which is now fixed (bug # 4199061). This is now fixed and should be available with next bug-fix update.   {color:#000000}The fix for this  is not to re-authenticate when already authenticated.{color}   {color:#000000}Closing (withdrawing) you bug as it is already fixed.{color}   {color:#000000}Thanks ,{color} {color:#000000}Nitin {color}        
Comment by Nitin K.
1476 | September 25, 2017 08:04:07 AM GMT