小编Kor*_*nis的帖子

Sharepoint身份验证.如何从ADFS获取SharePoint cookie

我们编写一个Sharepoint应用程序,将其扩展为Provider-hosted,使用证书,并将我们的MVC项目锚定到它.在同一个IIS上展开所有这些,扩展了Sharepoint.

任务1:用户登录Sharepoint,启动我们的应用程序; 应用程序启动时没有任何授权请求,并从登录的Sharepoint获取用户.

任务#2:如果需要Sharepoint服务请求,我们的应用程序使用用户登录Sharepoint的相同用户名登录Sharepoint.

我们尝试了:

1) 构建提供者托管的应用程序,在其中编写MVC,创建自唱歌证书,调整Sharepoint站点和MVC之间的高可信度.

我们得到: 如果我们的MVC使用Windows身份验证,那么在转移到我们的应用程序时,会再次请求用户名和密码; 进入它们时,我们可以ClientContext通过TokenHelper使用该GetS2SClientContextWithWindowsIdentity方法.

如果禁用了Windows身份验证,则用户不会登录请求,并且此方法会响应用户未登录的异常.

2) 我们安装并调整了ADFS,配置了Sharepoint以便与ADFS一起工作,写了Sharepoint的地址和我们在中继方信任中的应用(在Identifiers andWS-Federtation`被动端点中)

我们得到: 用户登录Sharepoint,当转移到我们的应用程序时,后者获取用户数据(声明)

因此,第一项任务已经解除.之后,出现了在授权用户下获得对Sharepoint服务的访问的问题

我们试图AccessToken通过我们收到的声明获取Sharepoint我们试图转移以下声明:

nii":"trusted:adfs
nii":"urn:office:idp:forms:adfs201 //adfs201 - name of our ADFS service
upn:UserLogin
emailaddress:UserEmail@domain.kz
Run Code Online (Sandbox Code Playgroud)

之后,我们AccessToken根据输入的声明调用了一个方法

    string issuer = string.IsNullOrEmpty(sourceRealm) ? issuerApplication : string.Format("{0}@{1}", issuerApplication, sourceRealm);
    string nameid = string.IsNullOrEmpty(sourceRealm) ? sourceApplication : string.Format("{0}@{1}", sourceApplication, sourceRealm);
    string audience = string.Format("{0}/{1}@{2}", targetApplication, targetApplicationHostName, targetRealm);

    List<JsonWebTokenClaim> actorClaims = new List<JsonWebTokenClaim>();
    actorClaims.Add(new JsonWebTokenClaim(JsonWebTokenConstants.ReservedClaims.NameIdentifier, nameid));
    if …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc sharepoint adfs2.0

8
推荐指数
1
解决办法
4473
查看次数

标签 统计

adfs2.0 ×1

asp.net-mvc ×1

c# ×1

sharepoint ×1