Download presentation
Presentation is loading. Please wait.
Published byPenelope Cordelia Cannon Modified over 9 years ago
2
Microsoft TechDayshttp://www.techdays.ru Сергей Звездин sergey.zwezdin@gmail.com http://blogs.gotdotnet.ru/personal/sergun/
3
Microsoft TechDayshttp://www.techdays.ru Введение Угрозы Аутентификация Задание видимости контейнеров Перехватчики
4
Microsoft TechDayshttp://www.techdays.ru Web-сервер IIS / other host База данных ADO.NET Data Services ADO.NET REST
5
Microsoft TechDayshttp://www.techdays.ru Доступ к коллекциям объектов (таблицам) Доступ к защищенным объектам Изменение данных Web-сервер IIS / other host База данных ADO.NET Data Services ADO.NET
6
Microsoft TechDayshttp://www.techdays.ru АутентификацияАвторизация Получение доступа
7
Microsoft TechDayshttp://www.techdays.ru
8
Интеграция со средой исполнения Виды аутентификации: Basic Forms Windows (Kerberos/NTLM) Live ID CardSpace Собственная схема аутентификации
9
Microsoft TechDayshttp://www.techdays.ru ASP.NET *.svc DataServiceHostFactory Windows Communication Foundation Host: WebServiceHost Binding: WebHttpBinding Contract: IRequestHandler
10
Microsoft TechDayshttp://www.techdays.ru Аутентификация Выбор среды исполнения
11
Microsoft TechDayshttp://www.techdays.ru
12
NorthwindNorthwind CustomersCustomersOrdersOrders ShippersShippersEmployeesEmployees
13
NorthwindNorthwind CustomersAllReadCustomersAllReadOrdersAllOrdersAll ShippersReadSingleShippersReadSingleEmployeesReadSingleEmployeesReadSingle
14
public class NorthwindService : DataService { public static void InitializeService (IDataServiceConfiguration config) { config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead); config. SetServiceOperationAccessRule(“GetCustomers", ServiceOperationRights.AllRead); } }
15
Microsoft TechDayshttp://www.techdays.ru
16
All0x3f 111111 AllRead0x03 000011 ReadMultiplie0x02 000010 ReadSingle0x01 000001 AllWrite0x3с 111100 WriteAppend0x04 000100 WriteDelete0x10 010000 WriteMerge0x20 100000 WriteReplace0x08 001000 None0x00 000000 ЧтениеМодификация
17
public class NorthwindService : DataService { public static void InitializeService (IDataServiceConfiguration config) { config.SetEntitySetAccessRule("Customers", EntitySetRights.ReadSingle | EntitySetRights.WriteAppend); }
18
public class NorthwindService : DataService { public static void InitializeService (IDataServiceConfiguration config) { config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead); config. SetServiceOperationAccessRule(“GetCustomers", ServiceOperationRights.AllRead); } }
19
Microsoft TechDayshttp://www.techdays.ru
20
All0x03 11 AllRead0x03 11 ReadMultiplie0x02 10 ReadSingle0x01 01 None0x00 00 Чтение
21
public class NorthwindService : DataService { public static void InitializeService (IDataServiceConfiguration config) { config. SetServiceOperationAccessRule(“GetCustomers", ServiceOperationRights.ReadSingle | ServiceOperationRights.ReadMultiplie); }
22
Microsoft TechDayshttp://www.techdays.ru Видимость на уровне контейнеров
23
Microsoft TechDayshttp://www.techdays.ru
24
Выполняются в момент исполнения запроса Позволяют определить механизм валидации Позволяют задавать пользовательские политики безопасности Работают на уровне отдельных строк данных
25
Microsoft TechDayshttp://www.techdays.ru Виды перехватчиков: Query interceptor – для операций чтения Позволяют задать политики, которые определяют отдавать или нет текущему клиенту данную запись Возможен доступ к информации о текущем пользователе Change interceptor – для операций модификации Позволяют задать политики модификации объектов (добавления, изменения, удаления) В момент исполнения также возможно модифицировать объект Возможен доступ к информации о текущем пользователе
26
[QueryInterceptor("Customers")] public Expression > OnCustomers() { return c => c.City == "Berlin"; }
27
[QueryInterceptor("Customers")] public Expression > OnCustomers() { return c => HttpContext.Current.User. Identity.IsAuthenticated; }
28
[ChangeInterceptor("Customers")] public void OnChangeCustomers(Customers c, UpdateOperations mode) { if ((mode == UpdateOperations.Add) || (mode == UpdateOperations.Change)) { if (c.ContactTitle.Contains(" ") == true) { throw new DataServiceException(400, "Contact title consist of a single word."); }
29
[ChangeInterceptor("Customers")] public void OnChangeCustomers(Customers c, UpdateOperations mode) { if (mode == UpdateOperations.Delete) { if (c.ContactName != HttpContext.Current.User.Identity.Name) { throw new DataServiceException(400, "You can't delete it."); }
30
Microsoft TechDayshttp://www.techdays.ru Перехватчики
31
Microsoft TechDayshttp://www.techdays.ru © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.