0

我正在使用Thinktecture IdentitiyServer V3作爲OpenIdConnect提供商進行身份驗證。我有一個自定義用戶服務,可以根據Active Directory對用戶進行身份驗證。我想發送一些配置文件數據到RP。身份驗證正在成功進行,但我不確定如何配置RP以檢索配置文件數據。來自OpenIdConnect提供商的配置文件數據 - Thinktecture IdentityServer V3

我的用戶服務實現GetProfileDataAsync方法來獲取所需的數據與我目前的配置此方法永遠不會被擊中。

我是OpenIdConnect的新手。請幫忙。從Startup.cs

我的RP配置:

app.UseCookieAuthentication(new CookieAuthenticationOptions() 
     { 
      AuthenticationType = "Cookies" 
     }); 

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions() 
     { 
      Authority = "url", 
      ClientId = "owinmvc", 
      Scope = "openid profile", 
      ResponseType = "id_token token", 
      RedirectUri = "https://localhost:44307/", 
      SignInAsAuthenticationType = "Cookies", 

      Notifications = new OpenIdConnectAuthenticationNotifications() 
      { 
       SecurityTokenValidated = (context) => 
       { 
        var identity = context.AuthenticationTicket.Identity; 
        identity.AddClaim(new Claim("CustomRoleClaim", "This is a role")); 
        return Task.FromResult(0); 
       } 

      } 

     }); 

回答

0

您提供的responseType = 「id_token令牌」 要求雙方身份令牌和訪問令牌。嘗試僅請求id_token來檢查是否將執行GetProfileDataAsync。

另請參閱關於作用域的AlwaysIncludeInIdToken。默認情況下,身份服務器不包括數據,如果身份令牌與訪問令牌一起請求,則假定您將通過UserInfo端點手動請求此信息。

+0

是的..我能解決這個問題,但我沒有更新的問題。我做了兩個改變。我將Addess電子郵件發送到我的範圍並將AlwaysIncludeInToken設置爲True。 – user3731783

相關問題