1
我正在使用OWIN OpenID Connect中間件連接到Azure AD。我能夠成功驗證用戶並重定向到回叫端點。我在這裏有點困惑,因爲我只收到id_token
& code
。OpenIDConnect連接到Azure AD
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "Azure AD - TEST",
Caption = "azure AD",
SignInAsAuthenticationType = signInAsType,
ClientId = "some guid",
Authority = "https://sts.windows.net/idp",
ResponseType = OpenIdConnectResponseTypes.CodeIdToken,
RedirectUri = "https://localhost:44392/ExternalLogins/Callback/",
AuthenticationMode = AuthenticationMode.Active,
});
回調方法:
[HttpPost]
[Route("ExternalLogins/Callback")]
[AllowAnonymous]
public async Task<IHttpActionResult> ExternalLoginCallback()
{
var content = await Request.Content.ReadAsStringAsync();
// I could see the content is a string with id_token, code , state etc.
//id_token is a JWT, so i can decode it and see the user claims and use them later
}
我的問題是:
- 僅用於驗證用戶Azure的廣告?關於授權呢?
- 如果我想在認證後撥打其他API,我該怎麼做,因爲我沒有
access_token
? - 我想我可以用
access_token
交換code
,但不知道我需要撥打哪個Azure端點以獲得access_token
? AuthenticationMode.Active
和AuthenticationMode.Passive
有什麼區別?