SlideShare una empresa de Scribd logo
1 de 34
CSE 136 - Lecture 6
   Service Layer
   WCF
   Business Layer
    Security
   Regular Expression
Overview
What is Service Layer
What is Service
Service Layer as services wrapper
Design Patterns in Service Layer
   Remote Façade Pattern
       A set of methods that modify the granularity existing operations
        already implemented elsewhere.
       A service is already a remote façade over the business layer
   Data Transfer Object Pattern
       Object that carries data across an application’s boundaries
       ex: XML file as input format for ChangeGrade()
   Adapter Pattern
       Converts the interface of one class into another interface that a
        client expects
       ex: UCSD GPA system takes in % points also
   Proxy Pattern
       Client will create a proxy, and proxy will communicate with the
        service
WCF - windows communication foundation
                                              A set of .NET libraries

   An SDK for developing and deploying services on
    Windows
   A WCF Service
     is a unit of functionality exposed to the world
     can be local or remote, developed by multiple parties
      using any technology
   A WCF Client
     is merely the party consuming a service's functionality
     can be literally anything:
         ASP.NET (MVC)
         JAVA app
         Mobile apps
WCF - Same vs cross machines
ABC of WCF
   This was an interview question
   A - Address
       Every service is associated with a unique address.
       Where are you?
   B - Binding                             SSL, call-backs, encryption-key

       A binding is a consistent set of choices regarding the transport
        protocol, message encoding, communication pattern, reliability,
        security, transaction propagation, and interoperability
       How should I talk with you?
   C - Contract
       The contract is a platform-neutral and standard way of describing
        what the service does.
       What am I giving/getting from you.
WCF ABC - Address
   Every service is associated with a unique address. The
    address provides two important elements
       (1) the location of the service
           IP address
           URL
       (2) transport protocol or transport schema used to communicate
        with the service
           http
           net.tcp
   Examples
       net.tcp://localhost:8002/MyService
       http://www.wcf.org:8001
       net.pipe://localhost/MyPipe
       net.msmq://localhost/MyService
WCF ABC - Binding
   Basic Binding - expose a WCF service as a legacy
    ASMX web service
   TCP Binding - Offered by the NetTcpBinding class,
    this uses TCP for cross-machine communication on
    the intranet. It supports a variety of features, including
    reliability, transactions, and security, and is optimized
    for WCF-to-WCF communication
   Web Service binding - Offered by the WSHttpBinding
    class, this uses HTTP or HTTPS for transport, and is
    designed to offer a variety of features such as
    reliability, transactions, and security over the Internet
   IPC Binding - Same-machine communication
   Others (skip) : MSMQ, Duplex WS, etc
WCF ABC - Contract
   The contract is a platform-neutral and standard
    way of describing what the service does
   Service contracts (method definition)
       Describe which operations the client can perform on
        the service
   Data contracts (parameter types)
     Define which data types are passed to and from the
      service.
     WCF defines implicit contracts for built-in types such
      as int and string, but you can easily define explicit opt-
      in data contracts for custom types.
WCF ABC quick example
WCF Operation
   Focus on the client side
   (1) Request & Reply (for CSE 136)
       Most common calls - If no response, client gives up
       always put try/catch in the client code
   (2) One-way
       Send and forget
   (3) Call-back (not for CSE 136)
       The service is the client and the client becomes the service
       HTTP cannot be used for callbacks
       TCP and the IPC protocols support duplex communication
       Observer Design Pattern
WCF Instance
   Focus on the server side
   Applications differ in their needs for scalability, performance,
    throughput, transactions, and queued calls
   (1) per-call
       services allocate (and destroy) a new service instance per client request
       This is the default behavior
   (2) session
       allocate a service instance per client connection.
       [ServiceContract(SessionMode = SessionMode.Required)]
   (3) Singleton
       all clients share the same service instance across all connections and
        activations
       [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)
RESTful Services
   CRUD : Create, Read, Update, and Delete
   RESTFul : using http methods
     Get - Read
     Post - Create

     Put - Update

     Delete - Delete

     REST stands for “Representational State
      Transfer”
     Skip for 136
WCF Security (authentication)
   Verifying that the caller of a service is indeed
    who the caller claims to be
   Windows authentication
   Username and password
   X509 certificate
   Custom mechanism & other 3rd parties
   No authentication (CSE 136)
Business Logic Layer Security
   User-based Security
     Authorization  deals with what the caller (user) is
      allowed to do.
     Callers are mapped to logical roles. (Role ex:
      Faculty, Staff, or Student)
   Code-based Security
     Authenticate the code source
     Authorize code for access

     Enforce the code access
BLL Security : user-identity 1
BLL Security : user-identity 2
BBL Security : Code-identity-based 1

   Authenticate code identity
       Information about the origin of a piece of code (such as the
        URL where it is run from) are collected and presented to
        the authorization layer
       Ex: Tourist visa from China
   Authorize code, not users, to access resources
       All trust decisions to access protected resources are made
        for particular pieces of code, based on security settings
        evolving around information about the origin of code
       Ex: Tourism visa from China can visit, not work and study
   Enforce the authorization
       The granularity of enforcement functions on the level of
        individual pieces of code (such as individual assemblies)
       .NET CLR enforces the security
       Ex: Employer checking for U.S. Visa
BBL Security : Code-identity-based 2

   Authenticate code identity
     Authenticates assemblies exe & dll
     By collecting evidence about the assembly
     Ex: assembly's URL or strong name     Signed by Microsoft

   Authorize code, not users, to access resources
     Authorizes assemblies
     By granting assemblies a set of permissions to access
      protected resources (such as the file system or
      registry)
   Enforce the authorization
       By checking that all assemblies calling to a protected
        resource have the appropriate permission to access
        that resource (.NET CLR)
.NET code-based Security : Evidence




                        •   Publisher
                        •   Site (url)
                        •   Zone (where on the
                            computer)
                        •   Strong name (signed key)
.NET code-based Security : Policy
       Similar to homeland security policy   Visitors with “Iraq
                                             visa” (membership)
                                             has limited access to
                                             certain “government
                                             buildings"
                                             (permission set)
.NET code-based Security : Code Group
and membership
.NET code-based Security : Permission
set
.NET code-based Security : Example

                           Ex: immigration
                           document type
                           Visa, Diplomatic ID,
                           birth-certificate



                           Ex: Chinese Visa
Regular Expressions 1
   What is regular expression
     pattern describing a certain amount of text
     a series of letters, digits, dots, underscores, signs
      and hyphens
   What are its common usages
     Formatting

     Validating

     Parsing
Regular Expressions 2
Regular Expression 3
Review question
   Difference between macro and micro services?
   What design patterns exist in the services layer?
   What .NET libraries does 136 use to implement the service
    layer?
   What is the ABC of WCF?
   Difference between authenticate and authorize?
   What is security policy? (rules defined)
   What are the four levels of .NET policies?
   What is code group? (groups of code in a policy)
   What is membership? (identify a group of code)
   What is permission set? (set of permissions assigned to a
    group of code)
Your assignment
   Due Next Thursday
   Create a Service Layer project Just a wrapper project
   Continue development of your BLL
   Continue development of unit tests for your
    BLL
Lab
   Due: Grade your DAL with test cases
References
   .NET : Architecting Applications for the
    Enterprise
   Learning WCF

Más contenido relacionado

La actualidad más candente

Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
rahmed_sct
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
Hossein Zahed
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
ukdpe
 

La actualidad más candente (20)

Java on Windows Azure
Java on Windows AzureJava on Windows Azure
Java on Windows Azure
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabric
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
 
NServicebus WCF Integration 101
NServicebus WCF Integration 101NServicebus WCF Integration 101
NServicebus WCF Integration 101
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
 
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
 
JDBC Tutorial
JDBC TutorialJDBC Tutorial
JDBC Tutorial
 
HIgh Performance Messaging App Development with Oracle Advance Queuing
HIgh Performance Messaging App Development with Oracle Advance QueuingHIgh Performance Messaging App Development with Oracle Advance Queuing
HIgh Performance Messaging App Development with Oracle Advance Queuing
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
Multi-tenancy in Java
Multi-tenancy in JavaMulti-tenancy in Java
Multi-tenancy in Java
 
White paper for High Performance Messaging App Dev with Oracle AQ
White paper for High Performance Messaging App Dev with Oracle AQWhite paper for High Performance Messaging App Dev with Oracle AQ
White paper for High Performance Messaging App Dev with Oracle AQ
 
PAC
PACPAC
PAC
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
JDBC
JDBCJDBC
JDBC
 
SQL Server 2008 Positioning
SQL Server 2008 PositioningSQL Server 2008 Positioning
SQL Server 2008 Positioning
 

Similar a Day6

Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Jorgen Thelin
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) Overview
Jorgen Thelin
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
ukdpe
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
Mahmoud Tolba
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
Subodh Pushpak
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App Fabric
Spiffy
 
Early Adopting Java WSIT-Experiences with Windows CardSpace
Early Adopting Java WSIT-Experiences with Windows CardSpaceEarly Adopting Java WSIT-Experiences with Windows CardSpace
Early Adopting Java WSIT-Experiences with Windows CardSpace
Oliver Pfaff
 

Similar a Day6 (20)

Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) Overview
 
07 advanced topics
07 advanced topics07 advanced topics
07 advanced topics
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Dce rpc
Dce rpcDce rpc
Dce rpc
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App Fabric
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
 
WCF
WCFWCF
WCF
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Net Services
Net ServicesNet Services
Net Services
 
RAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARYRAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARY
 
Early Adopting Java WSIT-Experiences with Windows CardSpace
Early Adopting Java WSIT-Experiences with Windows CardSpaceEarly Adopting Java WSIT-Experiences with Windows CardSpace
Early Adopting Java WSIT-Experiences with Windows CardSpace
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Último (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Day6

  • 1. CSE 136 - Lecture 6  Service Layer  WCF  Business Layer Security  Regular Expression
  • 5. Service Layer as services wrapper
  • 6. Design Patterns in Service Layer  Remote Façade Pattern  A set of methods that modify the granularity existing operations already implemented elsewhere.  A service is already a remote façade over the business layer  Data Transfer Object Pattern  Object that carries data across an application’s boundaries  ex: XML file as input format for ChangeGrade()  Adapter Pattern  Converts the interface of one class into another interface that a client expects  ex: UCSD GPA system takes in % points also  Proxy Pattern  Client will create a proxy, and proxy will communicate with the service
  • 7. WCF - windows communication foundation A set of .NET libraries  An SDK for developing and deploying services on Windows  A WCF Service  is a unit of functionality exposed to the world  can be local or remote, developed by multiple parties using any technology  A WCF Client  is merely the party consuming a service's functionality  can be literally anything:  ASP.NET (MVC)  JAVA app  Mobile apps
  • 8. WCF - Same vs cross machines
  • 9. ABC of WCF  This was an interview question  A - Address  Every service is associated with a unique address.  Where are you?  B - Binding SSL, call-backs, encryption-key  A binding is a consistent set of choices regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability  How should I talk with you?  C - Contract  The contract is a platform-neutral and standard way of describing what the service does.  What am I giving/getting from you.
  • 10. WCF ABC - Address  Every service is associated with a unique address. The address provides two important elements  (1) the location of the service  IP address  URL  (2) transport protocol or transport schema used to communicate with the service  http  net.tcp  Examples  net.tcp://localhost:8002/MyService  http://www.wcf.org:8001  net.pipe://localhost/MyPipe  net.msmq://localhost/MyService
  • 11. WCF ABC - Binding  Basic Binding - expose a WCF service as a legacy ASMX web service  TCP Binding - Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication  Web Service binding - Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet  IPC Binding - Same-machine communication  Others (skip) : MSMQ, Duplex WS, etc
  • 12. WCF ABC - Contract  The contract is a platform-neutral and standard way of describing what the service does  Service contracts (method definition)  Describe which operations the client can perform on the service  Data contracts (parameter types)  Define which data types are passed to and from the service.  WCF defines implicit contracts for built-in types such as int and string, but you can easily define explicit opt- in data contracts for custom types.
  • 13. WCF ABC quick example
  • 14. WCF Operation  Focus on the client side  (1) Request & Reply (for CSE 136)  Most common calls - If no response, client gives up  always put try/catch in the client code  (2) One-way  Send and forget  (3) Call-back (not for CSE 136)  The service is the client and the client becomes the service  HTTP cannot be used for callbacks  TCP and the IPC protocols support duplex communication  Observer Design Pattern
  • 15. WCF Instance  Focus on the server side  Applications differ in their needs for scalability, performance, throughput, transactions, and queued calls  (1) per-call  services allocate (and destroy) a new service instance per client request  This is the default behavior  (2) session  allocate a service instance per client connection.  [ServiceContract(SessionMode = SessionMode.Required)]  (3) Singleton  all clients share the same service instance across all connections and activations  [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)
  • 16. RESTful Services  CRUD : Create, Read, Update, and Delete  RESTFul : using http methods  Get - Read  Post - Create  Put - Update  Delete - Delete  REST stands for “Representational State Transfer”  Skip for 136
  • 17. WCF Security (authentication)  Verifying that the caller of a service is indeed who the caller claims to be  Windows authentication  Username and password  X509 certificate  Custom mechanism & other 3rd parties  No authentication (CSE 136)
  • 18. Business Logic Layer Security  User-based Security  Authorization deals with what the caller (user) is allowed to do.  Callers are mapped to logical roles. (Role ex: Faculty, Staff, or Student)  Code-based Security  Authenticate the code source  Authorize code for access  Enforce the code access
  • 19. BLL Security : user-identity 1
  • 20. BLL Security : user-identity 2
  • 21. BBL Security : Code-identity-based 1  Authenticate code identity  Information about the origin of a piece of code (such as the URL where it is run from) are collected and presented to the authorization layer  Ex: Tourist visa from China  Authorize code, not users, to access resources  All trust decisions to access protected resources are made for particular pieces of code, based on security settings evolving around information about the origin of code  Ex: Tourism visa from China can visit, not work and study  Enforce the authorization  The granularity of enforcement functions on the level of individual pieces of code (such as individual assemblies)  .NET CLR enforces the security  Ex: Employer checking for U.S. Visa
  • 22. BBL Security : Code-identity-based 2  Authenticate code identity  Authenticates assemblies exe & dll  By collecting evidence about the assembly  Ex: assembly's URL or strong name Signed by Microsoft  Authorize code, not users, to access resources  Authorizes assemblies  By granting assemblies a set of permissions to access protected resources (such as the file system or registry)  Enforce the authorization  By checking that all assemblies calling to a protected resource have the appropriate permission to access that resource (.NET CLR)
  • 23. .NET code-based Security : Evidence • Publisher • Site (url) • Zone (where on the computer) • Strong name (signed key)
  • 24. .NET code-based Security : Policy Similar to homeland security policy Visitors with “Iraq visa” (membership) has limited access to certain “government buildings" (permission set)
  • 25. .NET code-based Security : Code Group and membership
  • 26. .NET code-based Security : Permission set
  • 27. .NET code-based Security : Example Ex: immigration document type Visa, Diplomatic ID, birth-certificate Ex: Chinese Visa
  • 28. Regular Expressions 1  What is regular expression  pattern describing a certain amount of text  a series of letters, digits, dots, underscores, signs and hyphens  What are its common usages  Formatting  Validating  Parsing
  • 31. Review question  Difference between macro and micro services?  What design patterns exist in the services layer?  What .NET libraries does 136 use to implement the service layer?  What is the ABC of WCF?  Difference between authenticate and authorize?  What is security policy? (rules defined)  What are the four levels of .NET policies?  What is code group? (groups of code in a policy)  What is membership? (identify a group of code)  What is permission set? (set of permissions assigned to a group of code)
  • 32. Your assignment  Due Next Thursday  Create a Service Layer project Just a wrapper project  Continue development of your BLL  Continue development of unit tests for your BLL
  • 33. Lab  Due: Grade your DAL with test cases
  • 34. References  .NET : Architecting Applications for the Enterprise  Learning WCF