1 / 12

Impersonation, SSO & custom web parts

Impersonation, SSO & custom web parts. Using Impersonation and Single Sign-On to access corporate data from within a custom SharePoint web part Mike FITZSIMON SYSTEMS ARCHITECT F ITZSIMON IT C ONSULTING PTY LTD. Agenda. A Custom Web Part overview Single Sign-On Impersonation

thea
Download Presentation

Impersonation, SSO & custom web parts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Impersonation, SSO & custom web parts Using Impersonation and Single Sign-On to access corporate data from within a custom SharePoint web part MikeFITZSIMONSYSTEMSARCHITECTFITZSIMON IT CONSULTING PTY LTD

  2. Agenda • A Custom Web Part overview • Single Sign-On • Impersonation • Generating graphics on the server • What can go wrong FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  3. FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  4. Custom Web Part • Web part generates this graph (.gif) dynamically from corporate data in a database • The currently-logged-in user does not have permission to access this data FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  5. Single Sign-On Service • To many, a great disappointment • Installed by default with SPS, but set to manual start-up • Must run under an account which • Is a local administrator • Belongs to STS_WPG & SPS_WPG groups • Has db_owner rights for the SharePoint Services configuration database • Belongs to Server Administrators role for the SQL Server holding the SSO database FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  6. SSO Application Definition • Unique name for the application plus definition of logon fields • Username, password, domain, database name, secret Q&A, whatever • SharePoint Portal Server Central Administration -> Component Configuration -> Manage settings for single sign-on ->Manage settings for enterprise application definitions FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  7. Impersonation • Using SSO in a Web PartImports Microsoft.SharePoint.Portal.SingleSignon • RenderWebPartProtected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter) • Use SingleSignOn service to change user identity to impersonate a user with sufficient rights to access the data.'context for new identityDim objContext As WindowsImpersonationContextDim arrCredentials() As StringDim strUID As StringDim strDomain As StringDim strPassword As String FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  8. Impersonation • try to get credentials from SSO serviceCredentials.GetCredentials(Convert.ToUInt32("0"), _ "ApplicationName", arrCredentials)strUID = arrCredentials(0)strDomain = arrCredentials(1)strPassword = arrCredentials(2) • change the contextDim objIdentity As WindowsIdentityobjIdentity = IdentityHelper.CreateIdentity(strUID, strDomain, strPassword)objContext = objIdentity.Impersonate • …draw chart… • undo impersonation, revert to logged-in user's credentials.objContext.Undo() FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  9. IdentityHelper.CreateIdentity • See attached IdentityHelper.vb FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  10. Generating graphics on the server • Office Web Components 2003 installed on ServerImports Microsoft.Office.Interop.Owc11 • create a ChartSpaceClass object | add a chart to itProtected Overrides Sub CreateChildControls() • chSpace = New ChartSpaceClasschart = chSpace.Charts.Add(0) • Allow custom drawing within chart spacechSpace.AllowRenderEvents = True • specify the type of graph to be displayedchart.Type = ChartChartTypeEnum.chChartTypeAreaStacked FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  11. What can go wrong FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

  12. Questions • Mike FitzsimonMike@Fitzsimon.com.au • Mike’s bloghttp://mike.brisgeek.com • Fitzsimon IT Consultingwww.fitzsimon.com.au FitzsimonIT CONSULTING PTY LTD www.fitzsimon.com.au

More Related