SlideShare a Scribd company logo
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

More Related Content

What's hot

Java on Windows Azure
Java on Windows AzureJava on Windows Azure
Java on Windows Azure
David Chou
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
rahmed_sct
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabric
David Chou
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
ukdpe
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
Hossein Zahed
 
NServicebus WCF Integration 101
NServicebus WCF Integration 101NServicebus WCF Integration 101
NServicebus WCF Integration 101
Rich Helton
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
Rajiv Gupta
 
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
 
JDBC Tutorial
JDBC TutorialJDBC Tutorial
JDBC Tutorial
Information Technology
 
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
Jeff Jacobs
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Jdbc
JdbcJdbc
Jdbc
JdbcJdbc
Multi-tenancy in Java
Multi-tenancy in JavaMulti-tenancy in Java
Multi-tenancy in Java
seges
 
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
Jeff Jacobs
 
PAC
PACPAC
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
Naga Muruga
 
JDBC
JDBCJDBC
SQL Server 2008 Positioning
SQL Server 2008 PositioningSQL Server 2008 Positioning
SQL Server 2008 Positioning
ukdpe
 

What's hot (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 to 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
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
Mindfire Solutions
 
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
 
07 advanced topics
07 advanced topics07 advanced topics
07 advanced topics
Bat Programmer
 
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
David Truxall
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
tongdang
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
Abhi Arya
 
Dce rpc
Dce rpcDce rpc
Dce rpc
pratosh123
 
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
 
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...
Abdul Khan
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
Siva Tharun Kola
 
WCF
WCFWCF
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
Jignesh Aakoliya
 
Net Services
Net ServicesNet Services
Net Services
rsnarayanan
 
RAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARYRAZORPOINT SECURITY GLOSSARY
RAZORPOINT SECURITY GLOSSARY
Razorpoint Security
 
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
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
Peter R. Egli
 

Similar to 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)
 

Recently uploaded

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 

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