Vault login bypass

Vault login bypass

snappyjazz
Collaborator Collaborator
2,070 Views
28 Replies
Message 1 of 29

Vault login bypass

snappyjazz
Collaborator
Collaborator

I am working on a script that's accessing content center. We are using windows authentication for our vault access, so this makes it easy to fill out the login dialog.

 

I would like the code to check if you're logged into vault; if not login. But I'm not having much luck getting it to work. I'm pretty sure the line under try: "SecureResults = VDF..." isn't working because the try always catches the exception. Any ideas?

 

Imports Connectivity.InventorAddin.EdmAddin
Imports VDF = Autodesk.DataManagement.Client.Framework.Vault

Dim SecureResults As VDF.Results.LogInResult
        Dim Conn As VDF.Currency.Connections.Connection = Nothing
        Try
            SecureResults = VDF.Library.ConnectionManager.LogIn("neb-cdmsp", "Vault", "", "", VDF.Currency.Connections.AuthenticationFlags.WindowsAuthentication, Nothing)
            If SecureResults.Success Then
                Conn = SecureResults.Connection
                MsgBox("Worked")
            End If
        Catch ex As Exception
            MsgBox("Didn't work!")
        End Try
0 Likes
2,071 Views
28 Replies
Replies (28)
Message 21 of 29

snappyjazz
Collaborator
Collaborator
Imports System
Imports System.Type
Imports System.Activator
Imports System.Runtime.InteropServices
Imports Excel = Microsoft.Office.Interop.Excel
Imports Inventor
Imports Connectivity.InventorAddin.EdmAddin
Imports VDF = Autodesk.DataManagement.Client.Framework.Vault
Imports VB = Connectivity.Application.VaultBase
Imports Autodesk.Connectivity.WebServices
Imports Autodesk.Connectivity.WebServices.WCF
Imports Autodesk.DataManagement.Client.Framework

        Dim SecureResults As Vault.Results.LogInResult
        Dim Conn As Vault.Currency.Connections.Connection = Nothing

        Try
            SecureResults = VDF.Library.ConnectionManager.LogIn("neb-cdmsp", "Vault", "", "", VDF.Currency.Connections.AuthenticationFlags.WindowsAuthentication, Nothing)
            If SecureResults.Success Then
                Conn = SecureResults.Connection
                MsgBox("Worked")
            End If
        Catch ex As Exception
            MsgBox("Didn't work!")
        End Try

        End

My code is very similar. I'm even getting the message box saying "Worked". It's just not logging in. I will see if the ADMS console is getting anything.

0 Likes
Message 22 of 29

JamieVJohnson2
Collaborator
Collaborator

ARE WE TALKING APPLES AN ORANGES? 

Apple:

You say its not logging in, but you have a connection class object 'conn' that reports .Success = true.  If that is the case YOU LOGGED IN!

BUT

"conn" only works for the objects that use it.  And those are objects you create in code as a tool.

Orange:

USER CONNECTION is a different access point that follows its own process and has its own 'connection' class object, and won't get initialized when your code logs in. Only when the Add-In logs in.  There are limited methods to effect a Vault add-in's connection, but not hook into it for coding.

 

At this point I am assuming you only wanted to work with Apples, a connection you can use in code for working with vault in the 'background', but if you wanted Oranges, a method that logs the user in, so the user can continue to presume they are in vault, we are barking up the wrong tree, and this large cat is about to jump down an eat us!

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 23 of 29

snappyjazz
Collaborator
Collaborator

Oh shoot, I didn't know there were differences in logging in. I was looking for oranges not apples. You said: "There are limited methods to effect a Vault add-in's connection, but not hook into it for coding." In layman's terms, you can't login via coding?

0 Likes
Message 24 of 29

JamieVJohnson2
Collaborator
Collaborator

Using run command methods, I have seen people log into the Inventor Vault Add-in in the iLogic editor here on the forums.  This is not a process I have ever needed or wanted to perform.  Once your logged in, or out, that's all you can really do with the Add-In's connection.  You can access that connection (hook in) to preform vault tasks not performed by the user.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 25 of 29

snappyjazz
Collaborator
Collaborator

I must have missed those posts before I started this one. My goal is to login to the vault add-in so that my program doesn't get hung up on the login dialog box. Do you know if those run command methods operate as if a user filled out the dialog?

0 Likes
Message 26 of 29

JamieVJohnson2
Collaborator
Collaborator

This post may be of interest to you:

 

https://forums.autodesk.com/t5/inventor-customization/use-inventor-vault-add-in-through-inventor-api...

 

They are actually automating the InventorVault Addin, so it would know the difference (provided password and username are preset and correct).  The InventorVault Addin has not a supported API so you are 'fooling' the system to get what you want.

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 27 of 29

snappyjazz
Collaborator
Collaborator

I feels like we're getting close, but I have just a couple of more questions. Thanks for being patient with me. The following code is provided by @bradeneuropeArthur from your link.

 

Imports Connectivity.InventorAddin.EdmAddin
	 
	 Public Sub SetupUserInterface(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean, ClientID As String)
			
			' rest of the code should be left in here for the setupUserInterface
			'to get connection you should use the edmAddin ServerName Vault Name and username with the password you have logged in with.			
            If firstTime And...................................................................		
			
	    Dim strVaulrServerName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Server
            Dim strVaultName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.VaultName
            Dim strVaultUserName As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.UserName
            Dim strVaultPassword As String = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmLoginPreferences.Password
			
			 Dim results As VDF.Vault.Results.LogInResult

            results = VDF.Vault.Library.ConnectionManager.LogIn(strVaulrServerName, strVaultName, strVaultUserName, strVaultPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.Standard, Nothing)


            Dim conn As VDF.Vault.Currency.Connections.Connection = Nothing

            If results.Success Then

                conn = results.Connection
                

            End If
	end sub		

His code is similar to what I have except, he is using the edm to get login info, and is encased in a subroutine. The subroutine requires: an applicationaddinsite object, boolean value, and client id.

 

  1. What is an applicationaddinsite object? how do i create one to pass to this sub routine?
  2. None of the subroutine parameters (applicationaddinsite) are used in the subroutine; so why is it the key?

 

0 Likes
Message 28 of 29

JamieVJohnson2
Collaborator
Collaborator

Snappy, i was not able to get the easy answer for that one.  See if braden Arthur will respond since he posted it.

I'm getting the idea its using System.Reflection methods to crack into the pointer for the Inventor.Vault Add-in, then run commands that are 'assumed' to be present.  This is hacking level (aka not supported). 

 

I thought you could simply send a command to the command editor to do log in?

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 29 of 29

alexandru.spinu3KN9U
Contributor
Contributor

Jamie,

Thanks for your answers here. It helped me solve my problem 🙂

0 Likes