How to implement SAML 2.0 single sign on in Excel VBA?

Viewed 341

Currently I have a login form which opens upon opening the excel workbook and is using basic authentication to validate login credentials from Oracle Fusion via a simple SOAP request. However, now I'm required to implement Microsoft single sign on. Is it possible to achieve this using SOAP or REST API's? The authentication needs to be done via SAML 2.0 against my organizations Azure AD.

The code I'm currently using:

    Dim vFlag As Integer
    Dim tmpReport As String
    Dim documentID As String
    
    Dim sURL As String
    Dim xmlhtp As New MSXML2.XMLHTTP60
    vFlag = 0
    
    Dim xmldoc As Object
    Dim xmlnode As Object
    Set xmldoc = CreateObject("Microsoft.XMLDOM")
    xmldoc.SetProperty "SelectionLanguage", "XPath"
    xmldoc.async = False
    Dim xml As String
    sURL = Constants.EXT_REPORT_SERVICE_URL
    setStatus ("Calling report ..." & sURL)
    tmpReport = tmpReport & vbCrLf & "<soapenv:Envelope xmlns:soapenv=""http://www.w3.org/2003/05/soap-envelope"" xmlns:pub=""http://xmlns.oracle.com/oxp/service/PublicReportService""> "
    tmpReport = tmpReport & vbCrLf & "   <soapenv:Header/>                                                                                                                               "
    tmpReport = tmpReport & vbCrLf & "   <soapenv:Body>                                                                                                                                  "
    tmpReport = tmpReport & vbCrLf & "      <pub:validateLogin/>                                                                                                                        "
    tmpReport = tmpReport & vbCrLf & "   </soapenv:Body>                                                                                                                                 "
    tmpReport = tmpReport & "</soapenv:Envelope>"
    
    With xmlhtp
        .Open "post", sURL, False
        .SetRequestHeader "Content-Type", "application/soap+xml; charset=UTF-8"
        .SetRequestHeader "soapAction", "validateLogin"
        .SetRequestHeader "Authorization", "Basic " & Base64.EncodeTextBase64(username + ":" + password)
        .Send tmpReport
    xml = .ResponseText
    If InStr(1, xml, "true", vbTextCompare) Then
        vFlag = 1
    End If
    validateLogin = vFlag
    End With
End Function```
0 Answers
Related