博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cloud Design Pattern - Federated Identity Pattern(联合身份模式)
阅读量:2235 次
发布时间:2019-05-09

本文共 3257 字,大约阅读时间需要 10 分钟。

1.前言

传统应用通常都是多个模块运行在一个进程中,而随着云计算架构的不断演化,应用程序的各个模块以微服务的架构运行在多个进程中运行.最常见的就是ASP.NET WebApi,以WebApi构建的服务可以支持PC端,手机端,PAD端及其他任意形式的数据访问请求,那么api请求的认证如何来做呢?

ASP.NET 推出了基于OWIN的OAuth2认证与授权中间件,把认证与授权抽象成一个独立的服务,这样的服务可以成为一个独立的认证中心,对于第三方接入有很好的扩展性,非常有利于构建高扩展性的应用.这样的服务其实是可以管理多个应用的用户、角色、授权、认证的,也就是这里讲到的联合身份模式的实践.

关于ASP.NET中如何打造基于OWIN的OWIN OAuth2.0 Authorization Server,请参考:http://www.asp.net/aspnet/overview/owin-and-katana/owin-oauth-20-authorization-server

2.概念

在大中型企业中,通常有多个员工应用系统,如果每个系统都需要用户使用用户名和密码登录,用户很容易由于忘记密码,而无法登录系统,重置密码会造成较多的工作量.当员工离职的时候也需要逐一删除相关信息.每个系统都去维护人员,角色信息既会增加工作量,也会造成管理上的难度.

3.解决方案

正如在前言中所描述的那样,采用独立的用户认证与授权服务.

关于何时使用这种模式,官方说法如下:

This pattern is ideally suited for a range of scenarios, such as:

  • Single sign on in the enterprise. In this scenario you need to authenticate employees for corporate applications that are hosted in the cloud outside the corporate security boundary, without requiring them to sign on every time they visit an application. The user experience is the same as when using on-premises applications where they are initially authenticated when signing on to a corporate network, and from then on have access to all relevant applications without needing to sign on again.
  • Federated identity with multiple partners. In this scenario you need to authenticate both corporate employees and business partners who do not have accounts in the corporate directory. This is common in business-to-business (B2B) applications, applications that integrate with third party services, and where companies with disparate IT systems have merged or share resources.
  • Federated identity in SaaS applications. In this scenario independent software vendors (ISVs) provide a ready to use service for multiple clients or tenants. Each tenant will want to authenticate using a suitable identity provider. For example, business users will want to us their corporate credentials, while consumers and clients of the tenant may want to use their social identity credentials.

This pattern might not be suitable in the following situations:

  • All users of the application can be authenticated by one identity provider, and there is no requirement to authenticate using any other identity provider. This is typical in business applications that use only a corporate directory for authentication, and access to this directory is available in the application directly, by using a VPN, or (in a cloud-hosted scenario) through a virtual network connection between the on-premises directory and the application.
  • The application was originally built using a different authentication mechanism, perhaps with custom user stores, or does not have the capability to handle the negotiation standards used by claims-based technologies. Retrofitting claims-based authentication and access control into existing applications can be complex, and may not be cost effective.
4.示例

运行在云端的多租户应用中,我们就可以采用这种模式去完成租户与云端应用的用户,授权之间的映射.

5.相关阅读

关于这种模式的实现有很多种方式,相面的一些相关阅读可以帮助我们更好地了解这种模式.

For more information on the federated authentication technologies you can use in Azure applications, see the following:

  •  on the Azure website.
  •  on MSDN.
  •  on MSDN.
  •  on MSDN.
  •  on MSDN.

For comprehensive information about claims-based identity and federated authentication see:

  •  on MSDN.
  •  in the Architecture Journal.
你可能感兴趣的文章
HTTP高并发测试
查看>>
数据重生:让神经机器翻译中的不活跃样本“复活”
查看>>
【Java】【28】提高List的removeAll方法的效率
查看>>
【JS】【31】读取json文件
查看>>
OpenSSL源代码学习[转]
查看>>
google app api相关(商用)
查看>>
linux放音乐cd
查看>>
GridView+存储过程实现'真分页'
查看>>
flask_migrate
查看>>
解决activemq多消费者并发处理
查看>>
UDP连接和TCP连接的异同
查看>>
hibernate 时间段查询
查看>>
java操作cookie 实现两周内自动登录
查看>>
Tomcat 7优化前及优化后的性能对比
查看>>
Java Guava中的函数式编程讲解
查看>>
Eclipse Memory Analyzer 使用技巧
查看>>
tomcat连接超时
查看>>
谈谈编程思想
查看>>
iOS MapKit导航及地理转码辅助类
查看>>
检测iOS的网络可用性并打开网络设置
查看>>