SlideShare uma empresa Scribd logo
1 de 42
基于Silverlight 的RIA架构及百度应用 杨丹 资深.NET架构师 微软(中国) 陈广琛 Web前端工程师 百度
议题 RIA与应用平台趋势 Silverlight 应用架构 界面模型 逻辑分层 网络访问 安全机制 百度Silverlight应用
RIA与应用平台趋势 纯Web 在Web上实现 通过Web部署 界面更美观 像桌面应用 动画 多媒体 开发更高效 面向对象语言 美工技术协同 Richness Web Desktop RIA Win Form HTML DHTML AJAX Silverlight WPF Plug-in Reach
Silverlight 架构 Silverlight Runtime 纯Web 界面更美观 开发更高效 PresentationCore DRM XAML Media Core CLR Small BCL Debugging  Garbage Collector Security Exception Loader
Silverlight应用架构 逻辑分层 安全机制 界面模型 Browser Web Server Silverlight B/L B/L Silverlight B/L 网络访问
界面模型 如何与HTML页面结合? 三种选择 RIA 与 HTML RIA 与 RIA 单体 RIA 模块粒度 松散耦合 本地通讯 MVC/MVP
RIA与RIA- 本地访问 Silverlight与HTML对象:JavaScript接口 Silverlight应用之间:本地消息 Domain 1 Domain 2 本地消息接受者 Local Message Receiver 本地消息发送者 Local Message Sender 本地消息接受者 Local Message Receiver 本地消息发送者 Local Message Sender
单体RIA- 按需加载 Silverlight 应用 应用 Package (.xap) In-Package 文件 应用程序集 (.dll) Library 程序集 Library 程序集 Library 程序集 Entry Point Application Class Application Class Application Class Application Class Application Class Application Class Application Class Application Class 资源文件 资源文件 资源文件 资源文件 ExternalPart程序集 On-Demand 程序集 (缓存) (延后)
界面模型 -控制流转 面向页面 vs. 面向GUI 页面 GUI ,[object Object]
Navigation Framework:Frame, Page<HyperlinkButton TargetName = "MainContent“ NavigateUri = "/Views/List/Products.xaml"> </HyperlinkButton>
逻辑分层 多层架构  VS.  C/S 架构 Silverlight应用定位 逻辑写在何处? 与 ASP.NET MVC的关系?
逻辑分层 – 与ASP.NET MVC结合 SOAP REST ASP.NET MVC 业务逻辑层 仅传递用于显示的对象 以REST调用为主 与ASP.NET MVC 结合  public class CategoryController : Controller{     public ActionResult Products(int id){ return Json(prods); // return View(); }
网络访问 Web Service 访问方式不同 资源/RESTvs. 调用/RPC REST 具象状态传输 URI 资源的状态 Http 标准操作Get/Post RPC 简单对象访问协议 SOAP 方法调用,复杂语义 Http-Based  Web Service SOAP REST
网络访问 - RPC/SOAP 方式 服务端处理 WCF 支持 SOAP 客户端调用 - Proxy 使用Visual Studio菜单工具 AddService Reference 命令行工具 SLsvcutil.exe Silverlight 版本的 svcutil.exe 基于Channel Model开发 最灵活的方式
网络访问 - REST方式 服务端处理 WCF 支持 REST  [OperationContract] [WebGet(UriTemplate ="Northwind/Order/{orderId}")] OrderInfoMsgGetOrderInfo(string orderId); 客户端调用 WebClient 数据处理 XML: XmlReader, Linq  to XML, XmlSerializer JSON:  Linq to JSON, DataContractJsonSerializer RSS/Atom Feeds:  System.ServiceModel.Syndication
网络访问 - REST 与 SOAP 比较
安全机制 认证  ( Authentication ) 授权  ( Authorization ) 身份传递 ( Credential ) 消息加密 ( Encryption )
安全机制 – 身份传递 身份信息如何传递给后台服务? Browser-Based (自动) Windows Authentication ASP.NET Form Authentication/Cookies Message-Based (手工) URL 参数 消息头包含Username/Password 或Token
Browser-Based Authentication     Example with Cookies + Forms Auth E.g.: ASP.NET  loginUser:Password: Credentials YourDomain.com Auth info (cookie) Service calls + Auth info Browser
Browser-Based Authentication 	Login through Silverlight YourDomain.com Call with credentials toASP.NET Auth Service  User:Password: ASP.NET  Auth Service Reply contains cookie Service calls + Auth info Browser
Browser-Based Authentication     Using Windows Authentication Windows loginUser:Password: YourDomain.com Service calls + Creds Browser
Browser-Based Authentication: Cross-Domain Threat MyBank.com LoginUser:Password: Credentials MyBank.com Auth info (e.g. cookie) Could steal orchange dataif protection wasn’t in place 恶意请求 + Auth info 恶意程序 恶意网站
Message-Based Authentication Identity managed by Silverlight, not the Browser YourDomain.com User:Password: Creds are added by Silverlight, not browser No creds 恶意网站 Browser
Message-Based Authentication: 选择 1: 修改接口 [OperationContract] public decimal GetActBal(intactID, string user, string pwd); 选择 2: 通过WCF 的 WS-Security 在SOAP包头中自动插入身份信息 <basicHttpBinding>    <binding name="myBinding"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName"/>       </security> <httpsTransport/>    </binding> </basicHttpBinding>
安全机制  –  认证和授权 服务端如何认证和授权? Message-Based 身份 if(!OperationContext.Current.ServiceSecurityContext. PrimaryIdentity.IsAuthenticated)    throw new SecurityException(); // 标准 WCF方法 Browser-Based 身份 if(!HttpContext.Current.User.Identity.IsAuthenticated)  throw new SecurityException(); // ASP.NET Membership
安全机制 – 消息加密 完整,真实,防篡改 两种选择:传输层加密,消息层加密
Silverlight 应用架构 界面模型 逻辑分层 网络访问 安全机制
百度应用 Silverlight版百度Hi
界面模型 选择单体RIA 源自Web版的风格 Silverlight 3.0暂时缺乏多窗口模型 单体RIA的问题 耦合度高,难以维护——来自Web版的经验 利用MVC分离来解决
Code-Behind ASPX/XAML (View) CS/VB (Code-Behind) 从Win/Web Forms到MVC <Button OnClick=“…”>   … </Button> private void Button_OnClick(…) {   … }
从Win/Web Forms到MVC MVC ASPX (View) CS/VB (Controller) <form action=“…”>   … </form> public ActionResult   Search(…) { ViewData = …;   return View(); } ViewData
Silverlight MVC实践 Binding XAML (View) CS/VB (Controller) <Button Click=“…”>   … </Button> private void Button_Click(…) {   … Counter.Value++; } Binding
Silverlight MVC实践 Builder XAML (View) CS/VB (Controller) <Button Click=“…”>   … </Button> private void Button_Click(…) { Counter.Value++; builder.Update(); } Builder
逻辑分层 统一调用百度IM API 隐藏后端逻辑 百度IM API Silverlight版 百度Hi 网页版百度Hi 第三方客户端 (计划支持)
异步模型 调用单个异步函数 RetrieveUserAsync(username)  .AddCallback(user    => ProcessUser(user)); 多个异步函数组成工作流 Async.Chain()  .Next(context => FirstStep(context))  .Next(context => SecondStep(context))  .Next(context => ThirdStep(context))  .Go(initialContext);
网络访问 JSON-RPC JSON易于被不同的客户端解释 JavaScript Silverlight IM接口更像是调用而非资源
安全机制 百度Passport API式认证与授权 认证令牌 隐藏实现细节 在线会话(Session) 会话令牌
百度应用小结 MVC模型 Binding Builder API划分前后端 异步工作流 JSON-RPC Passport + Session
参考资源 官方站点 http://www.silverlight.net/ 免费空间 http://silverlight.live.com/ 博客 http://wpfe.cnblogs.com/ http://dotnet.catchen.biz/ http://silverlightrocks.com/
疑问和解答
基于Silverlight的RIA架构及百度应用

Mais conteúdo relacionado

Mais procurados

ASP.NET MVC Code Templates實戰開發 -twMVC#4
 ASP.NET MVC Code Templates實戰開發 -twMVC#4 ASP.NET MVC Code Templates實戰開發 -twMVC#4
ASP.NET MVC Code Templates實戰開發 -twMVC#4twMVC
 
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6twMVC
 
領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)Jeff Chu
 
Real World ASP.NET MVC
Real World ASP.NET MVCReal World ASP.NET MVC
Real World ASP.NET MVCjeffz
 
ASP.NET MVC之實戰架構探討 -twMVC#5
ASP.NET MVC之實戰架構探討 -twMVC#5ASP.NET MVC之實戰架構探討 -twMVC#5
ASP.NET MVC之實戰架構探討 -twMVC#5twMVC
 
Developing Serverless application with Microsoft Azure and Cognitive Services
Developing Serverless application with Microsoft Azure and Cognitive ServicesDeveloping Serverless application with Microsoft Azure and Cognitive Services
Developing Serverless application with Microsoft Azure and Cognitive ServicesJeff Chu
 
犀牛书第六版
犀牛书第六版犀牛书第六版
犀牛书第六版jay li
 
AngularJS 開發 ASP.NET MVC -twMVC#9
AngularJS 開發 ASP.NET MVC -twMVC#9AngularJS 開發 ASP.NET MVC -twMVC#9
AngularJS 開發 ASP.NET MVC -twMVC#9twMVC
 
Asp.net mvc 從無到有 -twMVC#2
Asp.net mvc 從無到有 -twMVC#2Asp.net mvc 從無到有 -twMVC#2
Asp.net mvc 從無到有 -twMVC#2twMVC
 
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure PlatformtwMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure PlatformtwMVC
 
架構設計入門 twMVC#11
架構設計入門 twMVC#11架構設計入門 twMVC#11
架構設計入門 twMVC#11twMVC
 
Single-Page Application Design Principles 101
Single-Page Application Design Principles 101Single-Page Application Design Principles 101
Single-Page Application Design Principles 101Jollen Chen
 
Introduction to ASP.NET MVC and MVC 5 Features
Introduction to ASP.NET MVC and MVC 5 FeaturesIntroduction to ASP.NET MVC and MVC 5 Features
Introduction to ASP.NET MVC and MVC 5 FeaturesJeff Chu
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練42016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4Duran Hsieh
 
利用 ASP.NET MVC 提升您的 Web 應用程式
利用 ASP.NET MVC 提升您的 Web 應用程式利用 ASP.NET MVC 提升您的 Web 應用程式
利用 ASP.NET MVC 提升您的 Web 應用程式Chui-Wen Chiu
 
WoT Frotend 的設計與實作
WoT Frotend 的設計與實作WoT Frotend 的設計與實作
WoT Frotend 的設計與實作julie huang
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練22016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2Duran Hsieh
 
Hello reactJS 0~1 Bulid my first web app
Hello reactJS 0~1 Bulid my first web appHello reactJS 0~1 Bulid my first web app
Hello reactJS 0~1 Bulid my first web apphungjie19
 

Mais procurados (20)

ASP.NET MVC Code Templates實戰開發 -twMVC#4
 ASP.NET MVC Code Templates實戰開發 -twMVC#4 ASP.NET MVC Code Templates實戰開發 -twMVC#4
ASP.NET MVC Code Templates實戰開發 -twMVC#4
 
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6
架構行動式網站(使用 ASP.NET MVC 4.0 -twMVC#6
 
領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)領域驅動設計 (Domain Driven Design)
領域驅動設計 (Domain Driven Design)
 
Real World ASP.NET MVC
Real World ASP.NET MVCReal World ASP.NET MVC
Real World ASP.NET MVC
 
ASP.NET MVC之實戰架構探討 -twMVC#5
ASP.NET MVC之實戰架構探討 -twMVC#5ASP.NET MVC之實戰架構探討 -twMVC#5
ASP.NET MVC之實戰架構探討 -twMVC#5
 
Developing Serverless application with Microsoft Azure and Cognitive Services
Developing Serverless application with Microsoft Azure and Cognitive ServicesDeveloping Serverless application with Microsoft Azure and Cognitive Services
Developing Serverless application with Microsoft Azure and Cognitive Services
 
敦群學院-SharePoint精英計畫-系統開發-Day 1
敦群學院-SharePoint精英計畫-系統開發-Day 1敦群學院-SharePoint精英計畫-系統開發-Day 1
敦群學院-SharePoint精英計畫-系統開發-Day 1
 
犀牛书第六版
犀牛书第六版犀牛书第六版
犀牛书第六版
 
AngularJS 開發 ASP.NET MVC -twMVC#9
AngularJS 開發 ASP.NET MVC -twMVC#9AngularJS 開發 ASP.NET MVC -twMVC#9
AngularJS 開發 ASP.NET MVC -twMVC#9
 
敦群學院-SharePoint精英計畫-系統開發-Day 2
敦群學院-SharePoint精英計畫-系統開發-Day 2敦群學院-SharePoint精英計畫-系統開發-Day 2
敦群學院-SharePoint精英計畫-系統開發-Day 2
 
Asp.net mvc 從無到有 -twMVC#2
Asp.net mvc 從無到有 -twMVC#2Asp.net mvc 從無到有 -twMVC#2
Asp.net mvc 從無到有 -twMVC#2
 
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure PlatformtwMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
 
架構設計入門 twMVC#11
架構設計入門 twMVC#11架構設計入門 twMVC#11
架構設計入門 twMVC#11
 
Single-Page Application Design Principles 101
Single-Page Application Design Principles 101Single-Page Application Design Principles 101
Single-Page Application Design Principles 101
 
Introduction to ASP.NET MVC and MVC 5 Features
Introduction to ASP.NET MVC and MVC 5 FeaturesIntroduction to ASP.NET MVC and MVC 5 Features
Introduction to ASP.NET MVC and MVC 5 Features
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練42016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練4
 
利用 ASP.NET MVC 提升您的 Web 應用程式
利用 ASP.NET MVC 提升您的 Web 應用程式利用 ASP.NET MVC 提升您的 Web 應用程式
利用 ASP.NET MVC 提升您的 Web 應用程式
 
WoT Frotend 的設計與實作
WoT Frotend 的設計與實作WoT Frotend 的設計與實作
WoT Frotend 的設計與實作
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練22016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練2
 
Hello reactJS 0~1 Bulid my first web app
Hello reactJS 0~1 Bulid my first web appHello reactJS 0~1 Bulid my first web app
Hello reactJS 0~1 Bulid my first web app
 

Destaque (20)

MartíN DíAz Con Anexos 2010
MartíN DíAz    Con Anexos 2010MartíN DíAz    Con Anexos 2010
MartíN DíAz Con Anexos 2010
 
Como postar set no soubalada.com
Como postar set no soubalada.comComo postar set no soubalada.com
Como postar set no soubalada.com
 
CHECHS Parent Info - Fall
CHECHS Parent Info - FallCHECHS Parent Info - Fall
CHECHS Parent Info - Fall
 
Montagood 2009 line up
Montagood 2009 line upMontagood 2009 line up
Montagood 2009 line up
 
Cidade eficiente
Cidade eficienteCidade eficiente
Cidade eficiente
 
Informe técnico campanha influenza- 2014
Informe técnico campanha influenza- 2014Informe técnico campanha influenza- 2014
Informe técnico campanha influenza- 2014
 
Across the earth spanish
Across the earth spanishAcross the earth spanish
Across the earth spanish
 
MPF
MPFMPF
MPF
 
Presentación de Tania Urquiza
Presentación de Tania UrquizaPresentación de Tania Urquiza
Presentación de Tania Urquiza
 
Wikinomics ok
Wikinomics okWikinomics ok
Wikinomics ok
 
Acesse a ANEEL
Acesse a ANEELAcesse a ANEEL
Acesse a ANEEL
 
Preconceito Na Escola
Preconceito Na EscolaPreconceito Na Escola
Preconceito Na Escola
 
Universidades Públicas de São Paulo
Universidades Públicas de São PauloUniversidades Públicas de São Paulo
Universidades Públicas de São Paulo
 
Edicleia aparecida
Edicleia aparecidaEdicleia aparecida
Edicleia aparecida
 
KYHC-SUZETTE1-HBSPAN2015
KYHC-SUZETTE1-HBSPAN2015KYHC-SUZETTE1-HBSPAN2015
KYHC-SUZETTE1-HBSPAN2015
 
Detran cnh popular
Detran cnh popularDetran cnh popular
Detran cnh popular
 
Ibm
IbmIbm
Ibm
 
Manual de relacionamento_com_a_imprensa
Manual de relacionamento_com_a_imprensaManual de relacionamento_com_a_imprensa
Manual de relacionamento_com_a_imprensa
 
Proyectos arquitectónicos
Proyectos arquitectónicosProyectos arquitectónicos
Proyectos arquitectónicos
 
Homai Vyarawala
Homai VyarawalaHomai Vyarawala
Homai Vyarawala
 

Semelhante a 基于Silverlight的RIA架构及百度应用

Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Tao Wang
 
云起龙骧系列课程(4) - Live Services开发实战_黄继佳
云起龙骧系列课程(4) - Live Services开发实战_黄继佳云起龙骧系列课程(4) - Live Services开发实战_黄继佳
云起龙骧系列课程(4) - Live Services开发实战_黄继佳yalle
 
Cloud ready v mware 云计算解决方案
Cloud ready   v mware 云计算解决方案Cloud ready   v mware 云计算解决方案
Cloud ready v mware 云计算解决方案ITband
 
淘宝开放产品前端实践
淘宝开放产品前端实践淘宝开放产品前端实践
淘宝开放产品前端实践taobao.com
 
Session1(更新20230205).pdf
Session1(更新20230205).pdfSession1(更新20230205).pdf
Session1(更新20230205).pdfssuser9026c8
 
http flood and mobile app
http flood and mobile apphttp flood and mobile app
http flood and mobile appim_yunshu
 
Web development introduced history and future
Web development introduced history and futureWeb development introduced history and future
Web development introduced history and futurejarryli
 
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制Timothy Chen
 
移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发fangdeng
 
今日如何建立一个安全的私有云
今日如何建立一个安全的私有云今日如何建立一个安全的私有云
今日如何建立一个安全的私有云ITband
 
[xKungFoo2012]Web Service Hack
[xKungFoo2012]Web Service Hack[xKungFoo2012]Web Service Hack
[xKungFoo2012]Web Service Hackpnig0s pnig0s
 
0328 Windows Server 2008 應用程式相容性
0328 Windows Server 2008 應用程式相容性0328 Windows Server 2008 應用程式相容性
0328 Windows Server 2008 應用程式相容性Timothy Chen
 
Teched 2012 60分钟构建私有云
Teched 2012 60分钟构建私有云Teched 2012 60分钟构建私有云
Teched 2012 60分钟构建私有云Cheng Zhang
 
虚拟化与云计算
虚拟化与云计算虚拟化与云计算
虚拟化与云计算ITband
 
移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发完颜 小卓
 
Clientside attack using HoneyClient Technology
Clientside attack using HoneyClient TechnologyClientside attack using HoneyClient Technology
Clientside attack using HoneyClient TechnologyJulia Yu-Chin Cheng
 
Cyberoam人員識別管理新世代防毒牆(正式版)
Cyberoam人員識別管理新世代防毒牆(正式版)Cyberoam人員識別管理新世代防毒牆(正式版)
Cyberoam人員識別管理新世代防毒牆(正式版)道成資訊股份有限公司
 
从网格计算到云计算
从网格计算到云计算从网格计算到云计算
从网格计算到云计算Riquelme624
 
Ecomm App Dev Chn
Ecomm App Dev ChnEcomm App Dev Chn
Ecomm App Dev Chnnuo xu
 
Web应用安全:过去,现在,未来(Public Ver)
Web应用安全:过去,现在,未来(Public Ver)Web应用安全:过去,现在,未来(Public Ver)
Web应用安全:过去,现在,未来(Public Ver)ph4nt0m
 

Semelhante a 基于Silverlight的RIA架构及百度应用 (20)

Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔Anytao 让windows phone应用在云端翱翔
Anytao 让windows phone应用在云端翱翔
 
云起龙骧系列课程(4) - Live Services开发实战_黄继佳
云起龙骧系列课程(4) - Live Services开发实战_黄继佳云起龙骧系列课程(4) - Live Services开发实战_黄继佳
云起龙骧系列课程(4) - Live Services开发实战_黄继佳
 
Cloud ready v mware 云计算解决方案
Cloud ready   v mware 云计算解决方案Cloud ready   v mware 云计算解决方案
Cloud ready v mware 云计算解决方案
 
淘宝开放产品前端实践
淘宝开放产品前端实践淘宝开放产品前端实践
淘宝开放产品前端实践
 
Session1(更新20230205).pdf
Session1(更新20230205).pdfSession1(更新20230205).pdf
Session1(更新20230205).pdf
 
http flood and mobile app
http flood and mobile apphttp flood and mobile app
http flood and mobile app
 
Web development introduced history and future
Web development introduced history and futureWeb development introduced history and future
Web development introduced history and future
 
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制0502 Windwos Server 2008 Card Space 新一代身份驗證機制
0502 Windwos Server 2008 Card Space 新一代身份驗證機制
 
移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发
 
今日如何建立一个安全的私有云
今日如何建立一个安全的私有云今日如何建立一个安全的私有云
今日如何建立一个安全的私有云
 
[xKungFoo2012]Web Service Hack
[xKungFoo2012]Web Service Hack[xKungFoo2012]Web Service Hack
[xKungFoo2012]Web Service Hack
 
0328 Windows Server 2008 應用程式相容性
0328 Windows Server 2008 應用程式相容性0328 Windows Server 2008 應用程式相容性
0328 Windows Server 2008 應用程式相容性
 
Teched 2012 60分钟构建私有云
Teched 2012 60分钟构建私有云Teched 2012 60分钟构建私有云
Teched 2012 60分钟构建私有云
 
虚拟化与云计算
虚拟化与云计算虚拟化与云计算
虚拟化与云计算
 
移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发移动互联网时代的Mobile app设计和开发
移动互联网时代的Mobile app设计和开发
 
Clientside attack using HoneyClient Technology
Clientside attack using HoneyClient TechnologyClientside attack using HoneyClient Technology
Clientside attack using HoneyClient Technology
 
Cyberoam人員識別管理新世代防毒牆(正式版)
Cyberoam人員識別管理新世代防毒牆(正式版)Cyberoam人員識別管理新世代防毒牆(正式版)
Cyberoam人員識別管理新世代防毒牆(正式版)
 
从网格计算到云计算
从网格计算到云计算从网格计算到云计算
从网格计算到云计算
 
Ecomm App Dev Chn
Ecomm App Dev ChnEcomm App Dev Chn
Ecomm App Dev Chn
 
Web应用安全:过去,现在,未来(Public Ver)
Web应用安全:过去,现在,未来(Public Ver)Web应用安全:过去,现在,未来(Public Ver)
Web应用安全:过去,现在,未来(Public Ver)
 

Mais de Cat Chen

Baidu Map API Introduction
Baidu Map API IntroductionBaidu Map API Introduction
Baidu Map API IntroductionCat Chen
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript PatternsCat Chen
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewCat Chen
 
Where to meet pretties
Where to meet prettiesWhere to meet pretties
Where to meet prettiesCat Chen
 
如何组织一场Open Party
如何组织一场Open Party如何组织一场Open Party
如何组织一场Open PartyCat Chen
 
知道你为什么找不到好工作吗?
知道你为什么找不到好工作吗?知道你为什么找不到好工作吗?
知道你为什么找不到好工作吗?Cat Chen
 
Xaml Tutorial By Allan
Xaml Tutorial By AllanXaml Tutorial By Allan
Xaml Tutorial By AllanCat Chen
 

Mais de Cat Chen (7)

Baidu Map API Introduction
Baidu Map API IntroductionBaidu Map API Introduction
Baidu Map API Introduction
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 Preview
 
Where to meet pretties
Where to meet prettiesWhere to meet pretties
Where to meet pretties
 
如何组织一场Open Party
如何组织一场Open Party如何组织一场Open Party
如何组织一场Open Party
 
知道你为什么找不到好工作吗?
知道你为什么找不到好工作吗?知道你为什么找不到好工作吗?
知道你为什么找不到好工作吗?
 
Xaml Tutorial By Allan
Xaml Tutorial By AllanXaml Tutorial By Allan
Xaml Tutorial By Allan
 

基于Silverlight的RIA架构及百度应用

  • 1.
  • 2. 基于Silverlight 的RIA架构及百度应用 杨丹 资深.NET架构师 微软(中国) 陈广琛 Web前端工程师 百度
  • 3. 议题 RIA与应用平台趋势 Silverlight 应用架构 界面模型 逻辑分层 网络访问 安全机制 百度Silverlight应用
  • 4. RIA与应用平台趋势 纯Web 在Web上实现 通过Web部署 界面更美观 像桌面应用 动画 多媒体 开发更高效 面向对象语言 美工技术协同 Richness Web Desktop RIA Win Form HTML DHTML AJAX Silverlight WPF Plug-in Reach
  • 5. Silverlight 架构 Silverlight Runtime 纯Web 界面更美观 开发更高效 PresentationCore DRM XAML Media Core CLR Small BCL Debugging Garbage Collector Security Exception Loader
  • 6. Silverlight应用架构 逻辑分层 安全机制 界面模型 Browser Web Server Silverlight B/L B/L Silverlight B/L 网络访问
  • 7. 界面模型 如何与HTML页面结合? 三种选择 RIA 与 HTML RIA 与 RIA 单体 RIA 模块粒度 松散耦合 本地通讯 MVC/MVP
  • 8. RIA与RIA- 本地访问 Silverlight与HTML对象:JavaScript接口 Silverlight应用之间:本地消息 Domain 1 Domain 2 本地消息接受者 Local Message Receiver 本地消息发送者 Local Message Sender 本地消息接受者 Local Message Receiver 本地消息发送者 Local Message Sender
  • 9. 单体RIA- 按需加载 Silverlight 应用 应用 Package (.xap) In-Package 文件 应用程序集 (.dll) Library 程序集 Library 程序集 Library 程序集 Entry Point Application Class Application Class Application Class Application Class Application Class Application Class Application Class Application Class 资源文件 资源文件 资源文件 资源文件 ExternalPart程序集 On-Demand 程序集 (缓存) (延后)
  • 10.
  • 11. Navigation Framework:Frame, Page<HyperlinkButton TargetName = "MainContent“ NavigateUri = "/Views/List/Products.xaml"> </HyperlinkButton>
  • 12. 逻辑分层 多层架构 VS. C/S 架构 Silverlight应用定位 逻辑写在何处? 与 ASP.NET MVC的关系?
  • 13. 逻辑分层 – 与ASP.NET MVC结合 SOAP REST ASP.NET MVC 业务逻辑层 仅传递用于显示的对象 以REST调用为主 与ASP.NET MVC 结合 public class CategoryController : Controller{ public ActionResult Products(int id){ return Json(prods); // return View(); }
  • 14. 网络访问 Web Service 访问方式不同 资源/RESTvs. 调用/RPC REST 具象状态传输 URI 资源的状态 Http 标准操作Get/Post RPC 简单对象访问协议 SOAP 方法调用,复杂语义 Http-Based Web Service SOAP REST
  • 15. 网络访问 - RPC/SOAP 方式 服务端处理 WCF 支持 SOAP 客户端调用 - Proxy 使用Visual Studio菜单工具 AddService Reference 命令行工具 SLsvcutil.exe Silverlight 版本的 svcutil.exe 基于Channel Model开发 最灵活的方式
  • 16. 网络访问 - REST方式 服务端处理 WCF 支持 REST [OperationContract] [WebGet(UriTemplate ="Northwind/Order/{orderId}")] OrderInfoMsgGetOrderInfo(string orderId); 客户端调用 WebClient 数据处理 XML: XmlReader, Linq to XML, XmlSerializer JSON: Linq to JSON, DataContractJsonSerializer RSS/Atom Feeds: System.ServiceModel.Syndication
  • 17. 网络访问 - REST 与 SOAP 比较
  • 18. 安全机制 认证 ( Authentication ) 授权 ( Authorization ) 身份传递 ( Credential ) 消息加密 ( Encryption )
  • 19. 安全机制 – 身份传递 身份信息如何传递给后台服务? Browser-Based (自动) Windows Authentication ASP.NET Form Authentication/Cookies Message-Based (手工) URL 参数 消息头包含Username/Password 或Token
  • 20. Browser-Based Authentication Example with Cookies + Forms Auth E.g.: ASP.NET loginUser:Password: Credentials YourDomain.com Auth info (cookie) Service calls + Auth info Browser
  • 21. Browser-Based Authentication Login through Silverlight YourDomain.com Call with credentials toASP.NET Auth Service User:Password: ASP.NET Auth Service Reply contains cookie Service calls + Auth info Browser
  • 22. Browser-Based Authentication Using Windows Authentication Windows loginUser:Password: YourDomain.com Service calls + Creds Browser
  • 23. Browser-Based Authentication: Cross-Domain Threat MyBank.com LoginUser:Password: Credentials MyBank.com Auth info (e.g. cookie) Could steal orchange dataif protection wasn’t in place 恶意请求 + Auth info 恶意程序 恶意网站
  • 24. Message-Based Authentication Identity managed by Silverlight, not the Browser YourDomain.com User:Password: Creds are added by Silverlight, not browser No creds 恶意网站 Browser
  • 25. Message-Based Authentication: 选择 1: 修改接口 [OperationContract] public decimal GetActBal(intactID, string user, string pwd); 选择 2: 通过WCF 的 WS-Security 在SOAP包头中自动插入身份信息 <basicHttpBinding> <binding name="myBinding"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName"/> </security> <httpsTransport/> </binding> </basicHttpBinding>
  • 26. 安全机制 – 认证和授权 服务端如何认证和授权? Message-Based 身份 if(!OperationContext.Current.ServiceSecurityContext. PrimaryIdentity.IsAuthenticated) throw new SecurityException(); // 标准 WCF方法 Browser-Based 身份 if(!HttpContext.Current.User.Identity.IsAuthenticated) throw new SecurityException(); // ASP.NET Membership
  • 27. 安全机制 – 消息加密 完整,真实,防篡改 两种选择:传输层加密,消息层加密
  • 28. Silverlight 应用架构 界面模型 逻辑分层 网络访问 安全机制
  • 30. 界面模型 选择单体RIA 源自Web版的风格 Silverlight 3.0暂时缺乏多窗口模型 单体RIA的问题 耦合度高,难以维护——来自Web版的经验 利用MVC分离来解决
  • 31. Code-Behind ASPX/XAML (View) CS/VB (Code-Behind) 从Win/Web Forms到MVC <Button OnClick=“…”> … </Button> private void Button_OnClick(…) { … }
  • 32. 从Win/Web Forms到MVC MVC ASPX (View) CS/VB (Controller) <form action=“…”> … </form> public ActionResult Search(…) { ViewData = …; return View(); } ViewData
  • 33. Silverlight MVC实践 Binding XAML (View) CS/VB (Controller) <Button Click=“…”> … </Button> private void Button_Click(…) { … Counter.Value++; } Binding
  • 34. Silverlight MVC实践 Builder XAML (View) CS/VB (Controller) <Button Click=“…”> … </Button> private void Button_Click(…) { Counter.Value++; builder.Update(); } Builder
  • 35. 逻辑分层 统一调用百度IM API 隐藏后端逻辑 百度IM API Silverlight版 百度Hi 网页版百度Hi 第三方客户端 (计划支持)
  • 36. 异步模型 调用单个异步函数 RetrieveUserAsync(username) .AddCallback(user => ProcessUser(user)); 多个异步函数组成工作流 Async.Chain() .Next(context => FirstStep(context)) .Next(context => SecondStep(context)) .Next(context => ThirdStep(context)) .Go(initialContext);
  • 37. 网络访问 JSON-RPC JSON易于被不同的客户端解释 JavaScript Silverlight IM接口更像是调用而非资源
  • 38. 安全机制 百度Passport API式认证与授权 认证令牌 隐藏实现细节 在线会话(Session) 会话令牌
  • 39. 百度应用小结 MVC模型 Binding Builder API划分前后端 异步工作流 JSON-RPC Passport + Session
  • 40. 参考资源 官方站点 http://www.silverlight.net/ 免费空间 http://silverlight.live.com/ 博客 http://wpfe.cnblogs.com/ http://dotnet.catchen.biz/ http://silverlightrocks.com/

Notas do Editor

  1. Browser-Based AuthN 如何在Silverlight中实现,有何缺陷
  2. 跨域访问(Cross-Domain)默认是关闭的可以通过“cross-domain policy file”打开Browser-Based 认证只有以下场景才安全无跨域访问 或只访问有限的几个受信的域其他场景只有Message-Based认证才是安全的
  3. <basicHttpBinding> <binding name="myBinding"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName"/> </security> <httpsTransport/> </binding> </basicHttpBinding>