Community
Vault Forum
Welcome to Autodesk’s Vault Forums. Share your knowledge, ask questions, and explore popular Vault topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SecurityHeader in Inventor

12 REPLIES 12
Reply
Message 1 of 13
psaarloos
2958 Views, 12 Replies

SecurityHeader in Inventor

Is it possible to pass through the securitheader to a command? I like to define a command in an Add-In, but to get access to the vault I need a return from the securityheader. I guess i can use the Header from the 'normal' Data Manager Server login, so i don't have to login for each own command...

Kind regards,
Pim Saarloos
Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
12 REPLIES 12
Message 2 of 13
mattmas
in reply to: psaarloos

Doug, correct me if I'm wrong here 😉

I believe that the Inventor Vault Add-in does not "share" its SecurityHeader - so you have to prompt the user to login separately. I'm sure that you could share your SecurityHeader between multiple Inventor Add-ins - but you're definitely looking at logging in twice (that said, my experience is that most users check the "login automatically" button - so perhaps that doesn't count).

-Matt
Message 3 of 13
Anonymous
in reply to: psaarloos

Actually, we did add something in R5 that lets you get the security header.
What I am about to tell you is not part of the supported API. I'm also not
very familiar with the feature, but this is how I think things work.

In the Inventor "bin" directory is a file called
Connectivity.InventorAddin.EdmAddin.dll. If you have a .NET application,
you should be able to add it as a reference. You will also need to import
Connectivity.Proxies.Security.dll. If you can't find this file in the
Inventor "bin" directory, try looking for it in the directories where Vault
is installed.

Once the files are referenced, you should be ready to go. There is a class
called Connectivity.InventorAddin.EdmAddin.EdmSecurity which contains
several useful features.

Here is some C# code to get you started....

docSvc.SecurityHeaderValue = new
ServiceAttributeTest.Document.SecurityHeader();
EdmSecurity security = EdmSecurity.Instance;
if (security.IsSignedIn())
{
docSvc.SecurityHeaderValue.Ticket = security.SecurityContext.Ticket;
docSvc.SecurityHeaderValue.UserId = security.SecurityContext.UserID;

// TODO: set docSvc.Url to the correct server using the data in
// security.SecurityContext.RemoteHost
}


This is not a supported API feature. Use this information at your own risk.
Autodesk makes no guarantees that this "feature" will be in future releases.


Doug Redmond
Software Engineer, Autodesk Inc.
Message 4 of 13
nathan.anderson
in reply to: psaarloos

Did this work out for you?
Message 5 of 13
Anonymous
in reply to: psaarloos

Yes, people have confirmed that this technique works.
http://discussion.autodesk.com/thread.jspa?threadID=674051


Doug Redmond
Software Engineer, Autodesk Inc.
Message 6 of 13
nathan.anderson
in reply to: psaarloos

Doug-

I am trying to use this technique with Inventor 2009. When I try to fetch a file I get a SOAP 300 error (BadAuthenticationToken). Is there a way around this or is there something I am missing? The code can be seen at http://pastebin.com/f471219da
Message 7 of 13
Anonymous
in reply to: psaarloos


I think the problem is that you are not setting the
URL on the DocumentService object.  If you forget this step, then it uses
the URL that you used when you added the web reference.  You might be able
to get the URL or server name from Inventor, but I'm not sure.

 

 

Doug Redmond

Software Engineer, Autodesk Inc.

 
Message 8 of 13
Rene-J
in reply to: psaarloos

Hi I am using this code in my Inventor Addin

Dim mgr As VaultServiceManager = GetServiceManager()

If (mgr.docSvc Is Nothing) Then

mgr.docSvc = New DocumentServiceWse()

mgr.docSvc.Url = mgr.SetSvcUrl(mgr.docSvc, Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmSecurityContext. RemoteHost)

mgr.docSvc.SecurityHeaderValue = New DocumentSvc.SecurityHeader()

mgr.docSvc.SecurityHeaderValue.Ticket = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmSecurityContext. Ticket

mgr.docSvc.SecurityHeaderValue.UserId = Connectivity.InventorAddin.EdmAddin.EdmSecurity.Instance.GetEdmSecurityContext. UserID
end if

Private Function SetSvcUrl(ByVal svc As System.Web.Services.Protocols.SoapHttpClientProtocol, ByVal HOST As String) As String

Dim url As UriBuilder = New UriBuilder(svc.Url)

url.Host = HOST

svc.Url = url.Uri.ToString()

Return svc.Url

End Function

René J

Message 9 of 13
proton1
in reply to: Rene-J

 

I have a problem with this code line

Dim mgr As VaultServiceManager = GetServiceManager()

What the library is applied here?

Where can I find VaultServiceManager

Would you be so kind to help me? René J

Message 10 of 13
Redmond.D
in reply to: proton1

The ServiceManager is a factory for easily creating web service objects.  It's not part of the API in Vault 2011 and earlier, but it shows up in multiple sample applications.  See VaultFileBrowser in the SDK for an example ServiceManager.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 11 of 13
cadfish1
in reply to: Redmond.D

The code you mention eailer in this thread does not work for 2011 and I can't user the VaultServiceManager to get the SercurityHeader until 2012.  Besides the references you've mentioned in an earlier thread, the Security object also requires Connectivity.Proxies.utils to be referenced which I've done.  I can't find a reference in any of the loading libraries to ServiceAttributeTest (Object Browser) so I'm assuming it used to be in one of the two libraries that you've said requires referencing (just a guess).  In any case, are there any changes I can make to get the SercurityHeader in 2011?

 

!temp1.jpg

 

Message 12 of 13
noontz
in reply to: Anonymous

Just to confirm ( & bump ) : This "hack" still works in IV2013, but it would be a #### of a lot easier if an IWebService was exposed to create a WebServiceCredentials out of the box..

( but then it wouldn´t have the cool notion of a hack now would it 😉 )

 

Message 13 of 13
d_hovda
in reply to: Anonymous

Back in 2011this was the answer to a question about getting security header information - in a inventor plug-in - from the Vault plug-in.

 

 

Reply 09/16/2011 at 04:45 PM

 
Doug Redmond said in reply to Kevin Mette...

Yes, there is a way for your Inventor plug-in to get the security header from the Vault plug-in.

This topic is covered in a discussion group post:
http://forums.autodesk.com/t5/Autodesk-Vault/SecurityHeader-in-Inventor/m-p/1713249/highlight/true#M...

 

 

It appears that this no longer works in Inventor 2015 Professional.  Is there still a way to do this?

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report