[英]Asp.Net Identity authentication with Office365 app
I want to know if there is a way where I can use both Asp.Net Identity
with Owin
and Office 365 Owin
login concurrently? 我想知道是否可以同时使用
Owin
和Office 365 Owin
登录使用Asp.Net Identity
?
Basically I want to create a web hook that hooks onto Users's Exchange Inbox. 基本上,我想创建一个挂钩到用户的Exchange收件箱的Web挂钩。 When these messages arrive I need to do some processing and basically send out a notification.
当这些消息到达时,我需要进行一些处理并基本上发出通知。
I'm able to successfully create an Office 365 app; 我能够成功创建Office 365应用; I have the
clientId
and the clientSecret
both into my Web.Config
file. 我将
clientId
和clientSecret
都放入我的Web.Config
文件中。
I'm using Asp.Net MVC5 and I'm able to have a view that basically has a button and it says "Click to Subscribe"..this would then ideally open the Office 365 login and my user would be presented with a Consent form. 我使用的是Asp.Net MVC5,我可以看到一个基本上带有按钮的视图,并显示“单击订阅”。然后理想情况下将打开Office 365登录名,并向我的用户显示一个同意形成。
Although when users initially login to the website I'm using Owin with Asp.Net Identity. 尽管当用户最初登录网站时,我使用的是带有Asp.Net Identity的Owin。
When I try to faciltate the Office 365 login; 当我尝试简化Office 365登录时; these two lines are returning back
null
. 这两行都返回
null
。 I've followed the tutorial give here on Github. 我已经按照Github上的教程进行操作了 。 So I'm able to hook onto to the Exchange mailbox using the Graph API.
因此,我可以使用Graph API挂接到Exchange邮箱。 But I'm having issues with the consent form?
但是我的同意书有问题吗? Any thoughts?
有什么想法吗?
These are the two lines of suspect code: 以下是两行可疑代码:
var signInUserId = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
var userObjectId = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
The signInUserId
returns me back the Asp.Net UserId field according to the user. signInUserId
根据用户向我返回Asp.Net UserId字段。 I have a feeling I am doing something utterly stupid & incomplete. 我感觉自己在做一些完全愚蠢和不完整的事情。
In this scenario you sort of have two approaches to consider. 在这种情况下,您需要考虑两种方法。
OpenIDConnectAuthentication
and when the user clicks subscribe, you issue a Challenge
from your app. OpenIDConnectAuthentication
并且当用户单击“订阅”时,您将从应用程序中发出Challenge
。 OWIN will redirect the user to login, consent, and then return back to your application. HandleResponse()
from within the notification, which will stop the OpenIDConnect sign-in pipeline and leave the ASP.NET identity in-tact. HandleResponse()
来终止auth管道,这将停止OpenIDConnect登录管道,并保持ASP.NET身份完整。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.