Debugging SAML setups in HCL Domino

If SAML doesn’t work you will probably get Bad SAML Request [/names.nsf?SAMLLogin] in the Domino server console. The first thing you need to do is to add some debug parameters to Domino, the easiest way is to write them on the domino console but you can add the directly into notes.ini or using the configuration document in the Name & adressbook.

set configuration DEBUG_SAML=31

set config WEBAUTH_VERBOSE_TRACE=1

When settings have been enabled you will see a lot more information on the domino console and with in this you will find clues what could be wrong with you SAML setup.

The first thing I check is what is written in the Service provider ID field against what is written on the provider side in ADFS, Okta, Azure or some other SSO provider. This information must be 100% the same so http vs https will brake it or a trailing slash.

Another thing to check if you get strange problems with creating the SP certificate, is to always set your self as full administrator before creating the certificate. Why you might ask, well this is because the action will run code on the server to add the new certificate into the server id and without maximum rights you might run into problems when creating the certificate.

Connecting to Office 365 / Azure, If you have a Domino server prior to version 10 and want to connect this to Azure Enterprise applications using SAML that will not work, trust me I have tried.
You need at least Domino 10 and the new design of the IDP database with the option AuthnRequest SAML 2.0 compatible.

Another interesting findings of mine when implementing SSO Login for customers applications was that one of the sides in Azure or Domino doesn’t keep track of multiple SAML Logins, this show it self as when multiple logins is started only one login response will be returned. I.e if you have embedded multiple Domino iframes on a single webpage they might break due to this, you need to add some thing so only one login request is handled at one time.

As you might understood by now, I can keep going with this due to the amount implementations of SSO I’ve done for clients both in their environment and against our Saas solution QNova Suite or our service eDomino.

Next Implementation is Okta you might run into problems decrypting the SAML data and get one of these errors if you have enabled the extended debug above.

SECCheckAndParseSAMLResponse> VerifyResponseSignature : The encrypted data has been modified or the wrong key was used to decrypt it
SECCheckAndParseSAMLResponse> VerifyAssertionSignature : The encrypted data has been modified or the wrong key was used to decrypt it
SECCheckAndParseSAMLResponse> Signature verification check failed : Could not verify cryptographic signature
SECCheckAndParseSAMLResponse> Exiting : The encrypted data has been modified or the wrong key was used to decrypt it

And you go in to the federation metadata xml file that you have downloaded from Okta. and check the certificate and everything looks ok and you wounder what is wrong isn’t Domino and Okta compatible with each other. Yes, they are well you need to be using HCL Domino 10 and above besides that there is a problem in the xml file, so open up the xml file that Okta has provided check each line in the certificate section and you will see that it’s ended with CRLF so the solution is to remove all CRLF with in the X509Certificate section of the XML file and save it and after that do the setup.

Update from the community, if the metadata xml file contains multiple certificates Domino will use the last one so if the file contains multiple certs make sure that Domino picks up the correct one otherwise you will get “The encrypted data has been modified or the wrong key was used to decrypt it” error.
Thanks for the info Jeffrey Redding

This is some of my SSO SAML findings connected to Domino comment below if you have found some quirky thing when you have done setups.

Create a random letter in Excel

I know that this is quite simple in Lotusscript, but some days I needed to create some kind of random string for a excel import and I thought let’s share this someone else might need this too or I might need this in the future and then I have it stored in my secondary archive my blogg 😉

=IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(65;90));IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(49;57));IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(97;122));CHAR(RANDBETWEEN(35;49)))))

This will create a random character , if you need a 8 letter string copy and paste this string with a and sign & between the formula eight times. I use this for simple password creation, Import keys.

Another of my excel functions I use alot is XLookup to get values from other sheets great to use when you have data from multiple sources. Checkout how to use it here

Hope this will help you, if you have some great Excel formulas post them in the comments.

Disable the first run off Lotusscript And Java agents after save

If you ever created some Notes/Domino agents and seen that everytime you save them a first run is scheduled outside or ordinary schedule. This can easily be avoided. Just add this code to the top of your agent

Dim s As New NotesSession
Dim a As notesagent
Set a=s.Currentagent
If a.Hasrunsincemodified=False Then Exit sub

This will make the agent to skip it’s first run, easy way stop the Lotusscript agent of running at odd hours and perhaps sending extra emails that confuses your users. You can ofcourse implement the same functionality in an Java agent.

If you want to run the same code inside a java agent then the code looks like this

try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
         if(agentContext.getCurrentAgent().getLastRun()==null){
        	 System.out.println("Not runned before");
         }else{
        	 System.out.println("Has runned");
         }

          // (Your code goes here)

      } catch(Exception e) {
          e.printStackTrace();
       }

Domino cookies needs to be secure and have samesite

The first thing is that Domino authentication cookies needs to be secured so you can’t hijack the content. This can be performed using the httponly and secure attributes.

Secondly we might need a way to add the samesite attribute to the cookies if we get problems with the new settings in Chrome. The same site settings is to block third party cookies that is used for advertising but in Domino this could give you problems if your applications is bouncing between domains. How to achieve this.

Server setting, no the Domino server doesn’t have this setting.
Vote for the Same site ideas on Domino ideas

Javascript, no that isn’t an option because the settings added removes control from javascript.

But using XPages we have no problem reading and set the cookies again with the correct attributes.

I’ve added this to the after page load event, you need to add this code for all Domino Related cookies that your setup use. Like LTPAToken, SessionID or DomAuthSessId

var c:javax.servlet.http.Cookie = cookie.get("DomAuthSessId")
var response=facesContext.getExternalContext().getResponse();
if(c){
if(c.getSecure()==false){

response.addHeader("Set-Cookie","DomAuthSessId="+c.getValue()+"; Path=/; Secure; HttpOnly; SameSite=None");
}
}

This changes the cookies after you have done a login but it will not help if the cookies is removed when you do a login.

Update to infinite scrolling snippet

Ferry did write a great snippet to get infinite scrolling in views posted on openntf xsnippets but lately I found that this had stopped working on some server versions. So I did some changes to get this to work on all versions

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
 
  <!-- make sure 'add rows' component is hidden -->
  <style>
    .infiniteScroll{display:none;}
  </style>
   
  <!-- add a class for the 'add rows component'  -->
  <xe:pagerAddRows id="pagerAddRows1"
    for="#{javascript:compositeData.repeatId}"
    styleClass="infiniteScroll">
  </xe:pagerAddRows>
 
   
  <!-- small script to check if we need to auto-click the 'add rows' button -->
  <xp:scriptBlock id="scriptBlock1">
    <xp:this.value><![CDATA[$(window).scroll(function(){
    if($(window).scrollTop() == $(document).height() - $(window).height()) {
      if($(".infiniteScroll ul li span").length!=0){
         $(".infiniteScroll ul li span")[0].click();
      }
      if($(".infiniteScroll ul li a").length!=0){
       $(".infiniteScroll ul li a")[0].click();
     }
   }
});]]></xp:this.value>
  </xp:scriptBlock>
</xp:view>

The changes is in the script block where I added a check if we find the span or the a tagg and if that we do a click on the first element found. This is because I didn’t get it to work using JQuerys ordinary click function.

Domino Data transfer between servers a different way

Domino has several ways of sending data or documents between servers the most common ways are as you all know replication. In another environments you might want to use an webservice.

But in domino there is several more ways to send data between servers, yes you can create a webservice but that isn’t that advanced, yes you can create an Rest service lots of work with the over head. You can send an email with an embedded form in it, how should you secure that.

Then you could actually run code on another server in an agent using Java or Lotusscript. By adding the server in to an trusted server list, nice. With compression and encryption added this is quite interesting. But there is a big but, the servers communicating needs to be in the same nab otherwise the communication fails 🙁

You might say what about cross certification, well this only works for replication not server to server code execution. But wait there is a way and this is how you make this work even if the servers are in different nabs and different certificates and it’s quite simple.

  1. Cross certify the server you want to communicate with both ways
  2. Add Server 1 in Server 2:s trusted server list
  3. Create a Person document on server 1 with server 2:s public certificate
  4. Create a Person document on Server 2 with server 1:s public certificate
  5. Add the server to the ACL on server 2

Now communication works in both ways I guess that you can change the server person with a user or perhaps add a user in the same way and run as the user. But the big thing is that you need the server you are callings public cert in the callers nab. If not you will get this on the server console.
server error your public key was not found in the domino directory

Teamviewer meeting integration in HCL Notes

Before the summer a customer approached me and asked if it was possible to integrate Teamviewer:s meeting function into the Notes calendar, so I created this solution for them. Check out the recording below.

Posting to Watson Workspace could have been the next article

But IBM will not continue to develop and announced that they will discontinue this platform, hope you didn’t invest to much in this platform.
IBM announcement
http://www-01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/4/877/ENUSZP19-0044/index.html&lang=en&request_locale=en

Some words from the community

http://oliverbusse.notesx.net/hp.nsf/blogpost.xsp?documentId=2F36

http://domino.elfworld.org/the-rumors-about-the-death-of-ibm-watson-workspace-were-not-exaggerated/

Yes this would have been the next step in my series of system integration with the new lotusscript classes but no worries there is lots of great services that also can be integrated.

What is a service that you would like to be able to integrate again in Domino?

You never know that service might be added to my list.

Posting to Slack using Lotusscript

Integrating Slack into your domino applications is quite straight forward and we can actually reuse the same code as for Microsoft Teams. But first lets see what you need to do in your slack channel.

And select add an app

And Select Build in the top right corner and start building.
Now you can create your application and select the channel for it.

Create a Slack App for IBM Domino

Next step is to active incoming webhooks

Using incoming webhooks to post to Slack

You will now get a unique post URL for this Slack channel when you want to post application messages.

Now over to Domino designer

  1. Create a Lotusscript agent
  2. Add the following code
Dim session As New notessession
Dim SlackURL As String,Body As String,Message as string
message="Domino 10 Talks"
SlackURL="<Paste the Slack URL here>"
Dim http As NotesHTTPRequest
Set http=session.CreateHTTPRequest()
Body=|{"text":"|+Message+|"}|
Call http.SetHeaderField("ContentType","application/json")
Call http.Post(SlackURL,Body)
	

This is how you simply post messages to a slack channel with Domino 10. Check out how to post to Microsoft teams if you haven’t

Posting to Microsoft teams from using Lotusscript

With the new HTTP classes in Domino 10 and lotusscript sending a message to a Microsoft teams group is very simple.

first you need to enable your microsoft teams group to accept posts this is done by adding a incoming webhook to the teams channel

  1. Open the Channel and click the More Options button (which appears as three dots at the top right of the window).
  2. Select Manage teams.
  3. Click on the Apps tab and click on the Go to Store button
  4. Scroll down or search for Incoming Webhook and click the Add button.
  5. Give the connector a name and image of your choosing and finally click Create.
  1. A new unique URI is automatically generated. Copy this URI string to your clipboard.

Now over to domino designer

  1. Create a Lotusscript agent
  2. Add the following code
Dim session As New notessession
Dim teamsURL As String,Body As String,Message as string
message="Domino 10 Talks"
teamsURL="<Paste the teams URI here>"
Dim http As NotesHTTPRequest
Set http=session.CreateHTTPRequest()
Body=|{"text":"|+Message+|"}|
Call http.SetHeaderField("ContentType","application/json")
Call http.Post(teamsURL,Body)
	

Run the code and a message should appear in the channel. There is lots of extensions to the Json Body so you can format the text and add images or links. Happy Coding!! This is the first post of a series how you can extend Domino 10 using the new http and json request classes.
Check out Posting to Slack

Happy Coding.