Hi, does anyone have any suggestions or a workarou...
# cfml-general
s
Hi, does anyone have any suggestions or a workaround for the cfexchange basic authentication issue? Adobe released a fix but it’s not working for us. cfexchange is login into the user’s mailbox account that is logged into the website. It’s not logging into the account being passed in the cfexchange username attribute. In addition, when the user is not logged into the site, cfauth will display a prompt for the user to log into the account. This solution doesn’t work if it’s being used in a scheduled task. The task should be able to log into the account specified with no user intervention. There’s currently a lot of manual work being involved to make this to work. I have a case open with CF support and an incident. I was told this was going to take time. Any help is greatly appreciated!
b
I've been beating my head against a wall on this since the beginning of the year. Maybe we can make a space somewhere for all of us to pull our hair out together?
👍 1
s
It’s a good idea Brian. I was hoping someone in this group would have figured out something by now 😢
t
I've been working on this problem in a non-cf context for a while, and Microsoft has really made things stupidly difficult. They've only enabled the OAuth workflows that require some kind of user interaction. The supported way of doing this via a machine account appears to involve creating an application in the Azure Cloud that has access to all accounts with no authentication, and then limiting which accounts it can really access via an ADS group... It's like automated tasks weren't a consideration they had when designing this, or they were explicitly aiming to make them impossible...
b
So far I believe I've been able to successfully get the authorization code and the token, but am failing when I try to open the IMAP connection. Should we create a new Slack channel for this? Adobe's ticketing system being down certainly isn't helping any.
s
@Tim does your non cf context work?
@Brian what’s the error message. I get no error but it connects to the logged in user’s account…
t
no, i haven't managed a working example yet.
😢 1
b
It depends which server I specify in the imap connection. Either "Connection reset" or "Couldn't connect to host".
I'm generally following the directions for IMAP at https://helpx.adobe.com/coldfusion/kb/authenticate-imap-pop-smtp-connection-oauth.html#imap. I've dumped various variables and everything looks good until that IMAP open attempt. How far along is everyone else getting?
e
Check your logs, more than likely your box has OLD ssl root certs, and needs updated. Update your java version to the absolute latest supported version of your CF ENGINE Instance. If you can not update something as its "Out of date" or "END OF LIFE", yo need to upgrade your platform anyways. the command usually is something like keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -list to SHOW WHICH ONES YOU HAVE. More than likely you have one or more outdated certs, which breaks crap. Now using firefox, or lynx or get, go download the new certs and add them to the keystore. Afterwards, you can restart your application engine and you should correct the CFEXCHANGE isnt talking nicely with "MyCrappyExchangeBox"
m
I think I was able to get this working. Are you connecting to an account that is hosted at Azure?
b
I am, yes. What magic did you use?
m
https://www.codewrecks.com/post/security/accessing-office-365-imap-with-oauth2/ That article along with some others seemed to have what I needed.
👍 1
I ended up doing it by creating java objects in CF, but I'm sure you would have to do that.
👍 1
The part that finally made it work for me was running these powershell commands
Copy code
$MyApp = Get-AzureADServicePrincipal -SearchString YourAppName
New-ServicePrincipal -AppId $MyApp.AppId -ServiceId $MyApp.ObjectId -DisplayName "Service Principal for IMAP APP"
Add-MailboxPermission -Identity "<mailto:alkampfer@gianmariaricci.onmicrosoft.com|alkampfer@gianmariaricci.onmicrosoft.com>" -User $MyApp.ObjectId -AccessRights FullAccess
Actually there are a couple commands before that, but they are all listed in that article
b
Okay, I'll have a look at it and see what happens. Thanks!
m
I can post the code also. It will just take me a few minutes to edit out some security details
👍 1
That code gets a token
and that code uses that token to get messages
I think it mostly does the same things as the adobe example, just using java
b
Thank you!