oauth2

Is it possible to combine the “get token” and “get userinfo” step into one?

对着背影说爱祢 提交于 2019-12-23 20:16:01
问题 In Authorization Code Flow, a client normally gets id token and access token in one step, and then passes the access token to the userinfo endpoint to get the actual data in a second step. In terms of the OpenID Connect, is it possible to combine those steps into one, so one roundtrip from client to OpenID provider suffices? N.B. The actual content of the Access Token is up to the implementor of an OpenID provider, so in theory I could put the data in there - but that does not seem like good

Spring OAuth 2 + Spring Data Neo4j multi-tenancy

不问归期 提交于 2019-12-23 17:51:23
问题 I'm going to implement multi-tenancy support in my Spring OAuth 2 + Spring Data Neo4j project. I have configure my OAuth2 Authorization Server with a few different clients with a different clientId . Also, I have added a base TenantEntity to my Spring Data Neo4j models: @NodeEntity public abstract class TenantEntity extends BaseEntity { private String tenantId; public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } } All of my

Why is redirect_uri required on Access Token request?

☆樱花仙子☆ 提交于 2019-12-23 07:58:22
问题 I'm developing an oauth2 provider based on rfc6749 and I'm wondering, why is redirect_uri required on the Access Token Request? The /token endpoint is not redirecting and the state is assumed to be already validated (i.e. against CSRF) so a copy of the redirectURI doesn't make much sense to me. 回答1: In auth code flow, it's used to validate the redirect_uri in the first auth request. https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uri-validation/ Granting Access Tokens The token

Reddit API returns HTTP 403

人盡茶涼 提交于 2019-12-22 08:36:50
问题 Following the OAuth2 login flow described at https://github.com/reddit/reddit/wiki/OAuth2 I got to the point where POST-ing to https://www.reddit.com/api/v1/access_token returns something like this: {'token_type': 'bearer', 'expires_in': 3600, 'scope': 'identity', 'access_token': '*****'} Then I do GET https://oauth.reddit.com/api/v1/me With this header: Authorization: bearer ***** The response is HTTP 403 Unauthorized. But why? It is clear that the access token has 'identity' scope. It is

Spring Boot集成Spring Security实现OAuth 2.0登录

元气小坏坏 提交于 2019-12-21 23:22:37
Spring Security OAuth项目已弃用,最新的OAuth 2.0支持由Spring Security提供。目前Spring Security尚不支持Authorization Server,仍需使用Spring Security OAuth项目,但最终将被Spring Security完全取代。 本文介绍了Spring Security OAuth2 Client的基础知识,如何利用Spring Security实现微信OAuth 2.0登录。GitHub源码 wechat-api 。 Spring Boot版本:2.2.2.RELEASE 为使用Spring Security OAuth2 Client,仅需在Spring Boot项目中增加以下依赖: dependencies { implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-security' ... testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org

OpenIdConnectAuthenticationHandler: message.State is null or empty

允我心安 提交于 2019-12-21 20:44:15
问题 I am using UseOpenIdConnectAuthentication middleware for ASP.Net Core application to authenticate against Dells Cloud access manager token provider (setup to provide OpenId/OAuth2 authentication). Following is the code: app.UseCookieAuthentication(new CookieAuthenticationOptions { AutomaticAuthenticate = true, AutomaticChallenge = true, AuthenticationScheme = "ClientCookie", CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie", ExpireTimeSpan = TimeSpan.FromMinutes(5),

新浪微博 API 使用入门

こ雲淡風輕ζ 提交于 2019-12-21 11:37:14
1、注册新浪帐号 2、进行开发者认证 需要身份认证,等待了一天时间。提交身份认证后就可以使用了,不必等待认证通过。 3、创建APP 系统会为此应用分配一个APP KEY和APP SECRET,这两个字串非常重要,将会在以后认证或者信息交互时用到。 4、设置app的授权回调页 应用信息 - 高级信息 - OAuth2.0 授权设置,设置授权回调页。 如果没有自己的网站,可以把 redirecturl 设置为 https://api.weibo.com/oauth2/default.html ,程序中的 redirecturl 要与此一致。 如图: 如果没设置授权回调页地址,或者程序中的与此不一样,会出现如下错误: 访问出错了! 你所访问的站点在新浪微博的认证失败,请你联系gnocob或者稍后再试。 (error:redirect_uri_mismatch) 如图: 5、下载需要版本的 sdk http://open.weibo.com/wiki/SDK 6、查看可用 API http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3 我的应用可用的接口: http://open.weibo.com/apps/180341588/privilege 7、测试及其他 Python SDK 调用 API 测试如下: #encoding=utf-8

Is storing an OAuth token in cookies bad practise?

折月煮酒 提交于 2019-12-19 05:46:11
问题 Is storing an OAuth 2 token in cookies bad practise? If so, what are alternatives for a web app? 回答1: I definitely wouldn't do it. When security is involved you should not store stuff, in places where others can access it. So don't store it anywhere, especially client-side. That being said, it's not bad practice, per se if handled properly. See this comprehensive article about it. 回答2: Whether you can store the access_token in cookies depends on following things: Is the access_token stored in

深入理解JWT的使用场景和优劣

这一生的挚爱 提交于 2019-12-18 20:10:34
深入理解JWT的使用场景和优劣 原创: 徐靖峰 Kirito的技术分享 Kirito的技术分享 微信号 cnkirito 功能介绍 「技术分享」某种程度上,是让作者和读者,不那么孤独的东西。「Kirito的技术分享」致力于探讨 Java 生态的知识点,内容覆盖分布式服务治理,微服务,性能调优,各类源码分析。追求有深度并兼具表达力的文字。 2018-04-20 经过前面两篇文章《JSON Web Token - 在Web应用间安全地传递信息》《八幅漫画理解使用JSON Web Token设计单点登录系统》的科普,相信大家应该已经知道了 JWT 协议是什么了。至少看到 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJxaWFubWlJZCI6InFtMTAzNTNzaEQiLCJpc3MiOiJhcHBfcW0xMDM1M3NoRCIsInBsYXRmb3JtIjoiYXBwIn0.cMNwyDTFVYMLL4e7ts50GFHTvlSJLDpePtHXzu7z9j4 这样形如 A.B.C 的字符串时能敏感地认出这是使用了 jwt。发了这两篇文章后,有不少读者在文末留言,表达了对 jwt 使用方式的一些疑惑,以及到底哪些场景适合使用 jwt。我并不是 jwt 方面的专家,和不少读者一样,起初研究时我也存在相同疑惑,甚至在逐渐接触后产生了更大的疑惑

权限验证——OAuth2

谁说我不能喝 提交于 2019-12-15 12:47:14
什么是OAuth2 OAuth2是开放授权的一个标准,旨在让用户允许第三方应用去访问改用户在某服务器中的特定私有资源,而可以不提供其在某服务器的账号密码给到第三方应用。 通俗的话可以这样去理解,假如你们公司正在开发一个 第三方应用XXX,该应用会需要在微信中分享出来一个活动页,该活动需要让微信用户去参与,你们的应用需要收集到用户的姓名,头像,地域等信息,那么问题来了?你的应用如何才能拿到所有参与活动的微信用户的基本信息呢? OAuth2分为四个角色: Resource Owner:资源所有者 Resource Server:资源服务器 Client:第三方应用客户端 Authorication Server:授权服务器 OAuth2 授权流程 角色 功能 备注 认证服务器 提供授权实现 提供类似获取授权许可(code),访问令牌(access_token)等接口 资源服务器 提供第三方应用程序注册接口以及开放相应受保护资源的API 第三方应用注册,是为了保证第三方应用的来源安全性 第三方应用 申请注册成为资源服务器的第三方应用以及消费资源服务器提供的受限资源API 类似微信公众号申请操作,由授权服务器提供标识第三方应用的 app_id & app_secret 用户 不需要做什么额外的改动,只需要点击确认授权即可 OAuth2中的授权许可 授权码 Authorization