Your SlideShare is downloading. ×
0
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Asp.net identity overview
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Asp.net identity overview

938

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
938
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Gordon http://weisnote.blogspot.tw/
  • 2.  只要是網站十之八九都會有一套會員機制 2
  • 3. 先別管這個了 你有聽過 ASP.NET Membership 嗎? 4
  • 4. something like...
  • 5.  http://www.asp.net/identity/overview/gettingstarted/introduction-to-aspnet-identity 9
  • 6.  限定 SQL Server 然後 schema 沒得改  圍繞著關聯式設計 不適用於 NoSQL  不能使用 OWIN 10
  • 7. http://blog.darkthread.net/post-2013-12-01-about-owin.aspx
  • 8.  http://www.asp.net/identity/overview/gettingstarted/introduction-to-aspnet-identity 13
  • 9.     One ASP.NET Identity system ◦ ASP.NET MVC, Web Forms, Web Pages, Web API, SignalR 通吃 Ease of plugging in profile data about the user ◦ 易於擴充 profile data Unit testability ◦ 易於單元測試 Role provider ◦ 支援角色管理 14
  • 10.      Claims Based ◦ 支援 Claims Based Identity Model (宣告式身分識別模型) Social Login Providers ◦ 支援社群登入 Windows Azure Active Directory ◦ 可以用 Windows Azure AD 登入 OWIN Integration ◦ 整合 OWIN 把驗證放在 middleware NuGet package ◦ 無腦安裝 15
  • 11. 16
  • 12.  有沒有一開專案就有會員功能的八卦? 17
  • 13. 18
  • 14. 19
  • 15. 20
  • 16. 21
  • 17. 22
  • 18.  /Models/IdentityModels.cs 25
  • 19.  /Models/RegisterViewModel.cs 26
  • 20.  /Views/Account/Register.cshtml
  • 21.  /Controllers/AccountController 28
  • 22. 29
  • 23. 30
  • 24.    每個網站的角色權限邏輯各異 自由發揮 來看看最常見的 Admin 怎麼玩 32
  • 25.  /App_Start/RoleConfig.cs 33
  • 26.  /Global.asax 34
  • 27. /Controllers/AccountController.cs 35
  • 28. 36
  • 29.    有 Admin 角色的 User 可以連進 /admin/index 沒 Admin 角色的 User 會被導到登入頁 沒啥好看的 完全沒有畫面 37
  • 30. 臉書為例
  • 31.     取得應用程式編號 (appId) 取得應用程式密鑰 (appSecret) 新增平台 選 “網站” 設定 ”網站URL” 39
  • 32.  /App_Start/Startup.Auth.cs 40
  • 33. 41
  • 34. 以 MongoDB 為例
  • 35. 44
  • 36. Controller UserManager<TUser> internal class EntityStore<TEntity> where TEntity: class public void Create(TEntity entity) public void Delete(TEntity entity) UserStore<TUser> public virtual Task<TEntity> GetByIdAsync(object id) public DbContext Context { get; private set; } public DbSet<TEntity> DbEntitySet { get; private set; } EntityStore<TEntity> public IQueryable<TEntity> EntitySet { get; private set; } 45
  • 37. Controller ApplicationUser IdentityUser UserManager<TUser> UserStore<TUser> UserLoginInfo UserClaim UserRepository MongoHelper 46
  • 38.  /Models/IdentityModels.cs 47
  • 39.  /Controllers/AccountController.cs 48
  • 40.  /Models/IdentityUser.cs 49
  • 41. 50
  • 42.  /Models/UserClaim.cs 51
  • 43.  /Models/UserStore.cs ◦ IUserLoginStore<TUser>  對應使用者至登入提供者的介面 ◦ IUserClaimStore<TUser>  儲存使用者指定宣告 ◦ IUserRoleStore<TUser>  對應使用者至登入提供者的介面 ◦ IUserPasswordStore<TUser>  儲存使用者的密碼雜湊 ◦ IUserSecurityStampStore<TUser>  儲存使用者的安全性戳記 ◦ IUserStore<TUser>  公開基本使用者管理的介面 52
  • 44.  https://mongolab.com/ 53
  • 45.  /Models/MongoHelper.cs 54
  • 46. 55
  • 47.  /Models/UserRepository.cs 56
  • 48. 57
  • 49. 59
  • 50. 60
  • 51. 61
  • 52. 62
  • 53. 63
  • 54. 64
  • 55. 65
  • 56. 66
  • 57. 67
  • 58. 68
  • 59. 69
  • 60. 70
  • 61. 71
  • 62. 72
  • 63.  https://github.com/neverlostmine/MongoUs erStore 77
  • 64.  http://www.youtube.com/watch?v=B4gl9KADN ZI&list=PLLQgkMVoGtcvjcDJhMEcQtick0QigZR ag 78
  • 65.  http://brockallen.com/2013/10/20/thegood-the-bad-and-the-ugly-of-asp-netidentity/#ugly 79
  • 66.  優點 ◦ 一秒生出會員登入 ◦ (部分)社群無痛登入 ◦ 一套 Identity通吃 ASP.NET MVC, Web Forms, Web Pages, Web API, SignalR ◦ 不是 SQL Server 也能用 ◦ 比較不會因為”人為因素” 被 我的密碼沒加密 提名  缺點 ◦ 要學新東西 ˊ_>ˋ ◦ 架構不見得人人愛 ◦ UserManager 裡面的方法使 用不當 效能會炸裂 ◦ 部分 error message 是英文 的 而且是 hard code ◦ 控制慾強烈的人無法忍受 ◦ 太新 有機率出現未爆彈 80

×