Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CS 3870/CS 5870: Note 14. Prog5 Due 10 PM Wednesday, Oct 21 Authentication and Authorization 2.

Similar presentations


Presentation on theme: "1 CS 3870/CS 5870: Note 14. Prog5 Due 10 PM Wednesday, Oct 21 Authentication and Authorization 2."— Presentation transcript:

1 1 CS 3870/CS 5870: Note 14

2 Prog5 Due 10 PM Wednesday, Oct 21 Authentication and Authorization 2

3 Prog6 Roles Management Sample Web Site 3

4 4 Prog 6 Create Folders Prog6, Admin, Member Copy files from Prog5 Modify Master Page and Content Pages Add Session Variables for Prog6 Make sure Prog6 is working before creating and assigning roles

5 5 Sub-Folders and Pages Member Default Shopping Checkout Admin Updating SetRoles CreateUser

6 Creating Roles Enabling RoleManager Web.config under the root folder Default is False 6

7 Roles Two Roles –Member –Admin 7

8 8 Role Management Users in role Admin can access pages in folder Admin User in role Member can access pages in folder Member One user can be assigned into multiple roles

9 New Users UserName: Windows Role: Member Password: cs3340@CSSEUWP Email: your UWP email Other: your choice 9

10 New Users UserName: WebProtocols Roles: Admin and Member Password: cs3870@CSSEUWP Email: your UWP email Other: your choice 10

11 11 Page SetRoles

12 12 Private Sub ListRolesBind() lstRoles.DataSource = Roles.GetAllRoles() lstRoles.DataBind() End Sub Protected Sub Button1_Click(...) Handles Button1.Click Roles.CreateRole(txtRole.Text) ListRolesBind() End Sub Protected Sub Button2_Click(...) Handles Button2.Click Roles.DeleteRole(txtRole.Text) ListRolesBind() End Sub Protected Sub Button3_Click(...) Handles Button3.Click Roles.AddUserToRole(lstUser.SelectedValue, lstRoles.SelectedValue) ListUsersBind() End Sub

13 13 Private Sub ListUsersBind() lstUsersInRole.DataSource = Roles.GetUsersInRole(lstRoles.SelectedValue) lstUsersInRole.DataBind() End Sub Protected Sub Button4_Click(...) Handles Button4.Click Roles.RemoveUserFromRole(lstUsersInRole.SelectedValue, lstRoles.SelectedValue) ListUsersBind() End Sub Protected Sub lstRoles_SelectedIndexChanged(...) Handles lstRoles.SelectedIndexChanged ListUsersBind() End Sub

14 Class Membership Handling Users lstUsers.DataSource = Membership.GetAllUsers() lstUsers.DataBind() 14

15 15 Web.Config Application Configuration File under the main web site

16 16 Setting Rights on Individual Pages Application Configuration File under the main web site

17 17 Sub-Folders and Pages Member Default Shopping Checkout Admin Updating SetRoles CreateUser

18 18 Authorization Configuration File under the folder Admin

19 19 Authorization Configuration File under the folder Member

20 20 Allow Multiple Roles (I) Configuration File under the folder Member

21 21 Allow Multiple Roles (II) Configuration File under the folder Member

22 Prog6 Each folder allows one role User WebPtotocols is in both roles 22

23 Allow and Deny Allow then Deny Deny then Allow will not work! 23

24 Prog6 24

25 Schedule Thursday: Lab 206 Do Prog5 and Project Lose 10 points if missing class 25

26 Test 2 Prog5 and Prog6 Authentication and Authorization Login Create User and Roles Assign users to roles Accessing Database Date: TBD 26


Download ppt "1 CS 3870/CS 5870: Note 14. Prog5 Due 10 PM Wednesday, Oct 21 Authentication and Authorization 2."

Similar presentations


Ads by Google