9

ユーザーが自分の組織アカウント (AD、AAD、O365) で Web アプリにログインし、Asp.Net ID を使用して、アプリ固有のプロファイルまたはロール情報をアプリケーションにローカルに保存するようにしたいと考えています。私のディレクトリまたは私のテナントのディレクトリを汚す。

情報がほとんどないため、このシナリオが現実的かどうかはわかりません。MVC 4 では実行可能でした。空の MVC4 Web アプリケーションを作成し、ID とアクセス ツールを使用してフェデレーション認証をセットアップし、SimpleMembership でセットアップしたユーザー テーブルに名前クレームを格納します (このように)。

ただし、新しい開発には、SimpleMembership よりも Asp.Net Identity を優先する方がよいようです。しかし、それははるかに困難に見えます。Visual Studio 2013 RTM の ASP.NET Web テンプレートを見ると、個人アカウント テンプレートのビットと組織アカウント テンプレートのビットを組み合わせる必要があります。Asp.Net ID が外部ログイン情報を AspNetUserLogins テーブルにすぐに保存できることを確認しましたが (これは最初に EF6 コードで変更できます)、ClaimsIdentity からどの情報を保存するかわかりません。ベスト (tenantId と name クレーム?) またはコードのどの時点で。Organizational Accounts テンプレートは Microsoft.Aspnet.Identity を参照していますが、それを呼び出しているようには見えません。

私のシナリオは実行可能ですか? VS2013 の最終リリースで構築できるサンプルはありますか? Asp.Net Identity の代わりに、独自の実装を使用してロールとプロファイル情報を保存する方がよいでしょうか?

4

1 に答える 1

0

This is a valid scenario and I've implemented something similar to this. Let's say you want to store a WAAD user's "metadata" in your local repository. By metadata, I mean basic identifying information that you can use to tie the user in your local repository to the same user's entry in WAAD. Here's what I would store:

IdentityProvider (WAAD, in this case)
TenantId (the format of this field can vary across identity providers but a string should suffice)
UserId (once again, the format of this field can vary across idPs but a string would work... name claim, in this instance - as long as it is unique across users within a tenant)

This is information you should be able to grab out of the ClaimsPrincipal/ClaimsIdentity. I implemented my application before VS 2013 came on the scene so I rolled my own but having read through the new "one" ASP.NET identity document, it looks fairly extensible and it might be a good idea to go with that. It even lets you plug in different storage providers (not just relational databases).

于 2013-12-17T14:53:51.997 に答える