SharePoint 开发实录:3,SSO不同解决方案

方案:

方案 1,使用AD方式,启动 服务 中SSO服务,使用SSO credential.

方案 2,使用form方式登陆sharepoint,好处是独立于AD之外,可以被互连网的用户访问。该方案可以通过查询数据库获取密码的明码、hashed password、encrypted password,将密码传给第三方的系统,进行集成单点登陆。


已完成:
一、通过在webpart中嵌入JS实现了功能4、5。
功能4, webpart生成超连接,而不是按钮式的点击。
功能5,webpart在新窗口中打开连接。
相关代码:
string script;

            script = @"<script language=javascript>
                        
                        //your javascript here   
                        function openWindowJS(basedUserNameJS,basedUrlJS){
                             
                            var wholeURL = location + '?decryptAction=' + decryptAction
                                + '&j_username=' + basedUserNameJS + '&url=' + basedUrlJS;
                            //open page within new window
                            window.open(wholeURL,'','location=no,resizable=yes'); //'http://www.google.com'
                            //open page within original window
                            //window.location.href=wholeURL;
                        }                    
 
                       </script>";

            output.Write(script + "<a href='javascript:openWindowJS(\"" + basedUserName + "\",\"" + basedUrl + "\");'>Test 01</a>"
                + "<br>";


功能3, webpart获取发出的httpRequest的响应内容
相关代码:
public static String processResponse(String url)
        {
            // Creates an HttpWebRequest with the specified URL. 
            HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
            // Sends the HttpWebRequest and waits for the response.			
            HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
            // Gets the stream associated with the response.
            Stream receiveStream = myHttpWebResponse.GetResponseStream();
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
            // Pipes the stream to a higher level stream reader with the required encoding format. 
            StreamReader readStream = new StreamReader(receiveStream, encode);
            Console.WriteLine("\r\nResponse stream received.");
            Char[] read = new Char[256];
            // Reads 256 characters at a time.    
            int count = readStream.Read(read, 0, 256);
            //Console.WriteLine("HTML...\r\n");

            StringBuilder outStr = new StringBuilder(4000);
            while (count > 0)
            {
                // Dumps the 256 characters on a string and displays the string to the console.
                String str = new String(read, 0, count);
                outStr.Append(str);
                //Console.Write(str);
                count = readStream.Read(read, 0, 256);
            }
            //Console.WriteLine("");
            // Releases the resources of the response.
            myHttpWebResponse.Close();
            // Releases the resources of the Stream.
            readStream.Close();
            return outStr.ToString();

        }


功能6, 取消分给用户的webpart的使用权限后,再验证webpart对用户是否还有使用权限限制。
webpart可以在不分给用户特定的使用权限的情况下,被用户在页面中使用。


需要改进:
webpart中嵌入form以post方式提交http请求,隐藏url中的参数。

需要作测试的内容
1,使用AD方式,启动 服务 中SSO服务,使用SSO credential.
2,webpart连接oracle


你可能感兴趣的:(SSO,SharePoint,webpart)