oauth2

作者: 巨子联盟 | 来源:发表于2018-03-25 22:27 被阅读0次

OAuth
允许用户提供一个令牌,而不是用户名和密码来访问他们存放在特定服务提供者的数据.

资料

(1) Third-party application:第三方应用程序,本文中又称"客户端"(client),即上一节例子中的"云冲印"。
(2)HTTP service:HTTP服务提供商,本文中简称"服务提供商",即上一节例子中的Google。
(3)Resource Owner:资源所有者,本文中又称"用户"(user)。
(4)User Agent:用户代理,本文中就是指浏览器。
(5)Authorization server:认证服务器,即服务提供商专门用来处理认证的服务器。
(6)Resource server:资源服务器,即服务提供商存放用户生成的资源的服务器。它与认证服务器,可以是同一台服务器,也可以是不同的服务器。


OAuth2.png
  • OAuth 2.0定义了四种授权方式

  1. 授权码模式(authorization code)
  2. 简化模式(implicit)
  3. 密码模式(resource owner password credentials)
  4. 客户端模式(client credentials)
  • 授权码模式步骤
image.png
  • A步骤
GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz
        &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1
Host: server.example.com
  • C步骤
HTTP/1.1 302 Found
Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA
          &state=xyz

  • D步骤
POST /token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=SplxlOBeZQQYbYS6WxSbIA
&redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
  • E步骤
     HTTP/1.1 200 OK
     Content-Type: application/json;charset=UTF-8
     Cache-Control: no-store
     Pragma: no-cache

     {
       "access_token":"2YotnFZFEjr1zCsicMWpAA",
       "token_type":"example",
       "expires_in":3600,
       "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
       "example_parameter":"example_value"
     }
image.png

参考文档

相关文章

  • Spring Security Oauth2

    oauth2理解oauth2理解oauth2参考 oauth2流程 基本概念 Resource Owner: 资源...

  • 微服务安全

    OAuth2 白话OAuth2 什么是OAuth Spring Security OAuth2

  • Spring OAuth2(JDBC)

    一、Spring OAuth2 Spring OAuth2是OAuth2协议的完整实现,如果你对OAuth2协议不...

  • OAuth2基本概念

    OAuth2 基础概念 标签(空格分隔): OAuth2 什么是OAuth2 ? OAuth2.0是OAuth协议...

  • oauth2设置token过期时间

    oauth2设置token过期时间,oauth2设置刷新token过期时间 oauth2设置token过期时间,在...

  • oauth2 介绍

    1、什么是oauth2 2、oauth2 架构图 3、oauth2 工作流程 4、优缺点

  • Oauth2授权码模式

    3.3 Oauth2授权码模式 3.3.1 Oauth2授权模式 Oauth2有以下授权模式: 授权码模式(Aut...

  • 27.OAuth2.0-Spring Cloud Securit

    Spring Cloud Security OAuth2 环境介绍 Spring Security OAuth2是...

  • Spring Cloud集成OAuth2

    Spring Cloud集成OAuth2 什么是OAuth2 OAuth2 是一个授权框架,或称授权标准,它可以使...

  • OAuth2理解

    OAuth2简介 什么是OAuth2 OAuth2是一个工业级标准的授权协议。 用于REST/API的代理授权框架...

网友评论

      本文标题:oauth2

      本文链接:https://www.haomeiwen.com/subject/jidhcftx.html