sharepoint 2013 域登录 注销用户凭证

1、问题及分析:
虽然我们利用shaerpoint2013的Welcome页面中的ID_LoginAsDifferentUser方法可以实现切换用户的功能,但是我们使用域登录是假单点模式,会导致用户切换用户后,再次访问依然是上一次登录的用户,而不是当前用户,原因就是域的账户密码会保存到windows凭证中,知道原因我们就可以分析怎么处理。
2、处理:
利用cmd中的命令清除windows凭证cmdkey /delete:IP,将该功能在我们的后台去执行就可以了,不管是C#\Jave网上是有后台执行cmd命令的方法,Java的自行搜索,目前我只是贴出C#代码:
[WebMethod]
public static string DeleteCmdKey(string IP)
{

        string strInput = "cmdkey /delete:" + IP;
        Process p = new Process();
        //设置要启动的应用程序
        p.StartInfo.FileName = "cmd.exe";
        //是否使用操作系统shell启动
        p.StartInfo.UseShellExecute = false;
        // 接受来自调用程序的输入信息
        p.StartInfo.RedirectStandardInput = true;
        //输出信息
        p.StartInfo.RedirectStandardOutput = true;
        // 输出错误
        p.StartInfo.RedirectStandardError = true;
        //不显示程序窗口
        p.StartInfo.CreateNoWindow = true;
        //启动程序
        p.Start();
        //向cmd窗口发送输入信息
        p.StandardInput.WriteLine(strInput + "&exit");
        p.StandardInput.AutoFlush = true;
        //获取输出信息
        string strOuput = p.StandardOutput.ReadToEnd();
        //等待程序执行完退出进程
        p.WaitForExit();
        p.Close();
        return strOuput;
    }

3、注销页面处理
shaerpoint注销页(signout)是网站集生成时自动创建的,点击注销跳转的页面可知地址,自行查询本系统的文件夹地址,增加js方法:
<SharePoint:ScriptBlock runat=“server”>
$.ajax({
url: “/_layouts/15/Handler/Threshold.aspx/DeleteCmdKey”,
type: “post”,
data: “{IP:‘xxxxxxxx’}”,
contentType: “application/json;charset=utf-8”,
dataType: ‘json’,
cache: true,
success: function (text) {
var TotalCount = text.d;
},
error: function (jqXHR, errorThrown) {
}
});
function _spBodyOnLoad() {
window.close();
}
</SharePoint:ScriptBlock>

备注:经过多轮测试,该方法在网站中调用后,只能删除掉服务器端的windows凭证,删除不了客户端的windows凭证,新方法后续新文章。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值