4 Replies Latest reply on Dec 9, 2009 10:55 PM by charlie@osisoft.com

    Windows Integrated Authentication (SSPI) - Example


      Can someone provide for me an end-to-end example of how to use SSPI with a C# .NET application I'm writing to pull some data from PI Enterprise Server?  By end-to-end, I mean:


      1)  Create this PI user this way...
      2)  Marry PI user to Windows userid this way...
      3)  Configure security on server this way...
      4) Write connection string this way...
      4)  Get sinusoid tag values this way...


      I can't be the first person that needs this.


      Thanks for your help.

        • Re: Windows Integrated Authentication (SSPI) - Example

          A little help with my counting would be appreciated too.





            • Re: Windows Integrated Authentication (SSPI) - Example

              Seems like you already figured out the counting side of things


              First off, you need to make sure you are using PI Server version 3.4.380 and PI SDK version 1.3.6. Second, you don't need to create a new PI User; we actually encourage you to use existing existing Windows users and groups and then make use of PI Identities and PI Mappings. The security model is highly flexible - I encourage you to consult the "Configuring the PI Server Security" manual that's available on the vCampus Library. Most of the work is done as more or less a one time configuration of the server software, not programmatic changes to your applications.


              That said, the PI SDK does not currently provide programmatic access to PI Identities and PI Mappings; configuring the authentication methods is done using the PI SDK Connections dialog (accessible from the AboutPI-SDK.exe utility on your client machine). For your "first" point #4 (programmatically opening a session with the PI Server), you can simply call .Open() on a PISDK.Server object - by default, SSPI is the authentication method tried by the PI SDK and no Connection String is required with this approach.


              For your "second" point #4 (getting access to PI data), you essentially need to create and instanciate a PISDK.PIPoint object off of the PISDK.Server object you opened a session with earlier. Then most data retrieval calls (and there are a good number of those) are accessible from the PIPoint.Data property - of course, this assumes the user you ended up connecting with has appropriate privileges over the PI Point (or other object) you are trying to read from.


              I suggest you take a look at the recording of the"PI Programming 101" webinar and the sample C# project that is provided with it (see the link in the webinar description).


              Then please don't hesitate to come back and ask more questions!