草庐IT

java - Spring Security OAuth2授权流程

谁能告诉我应该依次调用哪些httpGET或POST方法来授权我的apachecxfweb服务并访问资源?我试着调用:http://localhost:8080/oauth/token?client_id=client1&client_secret=client1&grant_type=password&username=client1&password=client1我所能得到的只是token响应:{"access_token":"7186f8b2-9bae-48b6-90c2-033a4476c0fc","token_type":"bearer","refresh_token":"d

java - 带有 jdbc token 存储的 spring boot oauth2 给出 oauth_access_token 关系不存在

我正在尝试将springboot与OAuth2集成。通过遵循此https://github.com/royclarkson/spring-rest-service-oauth,我能够使它与InMemoryStore一起用于token。但是当我尝试使用JdbcTokenStore和postgres数据库实现它时,我得到了错误Handlingerror:BadSqlGrammarException,PreparedStatementCallback;badSQLgrammar[selecttoken_id,tokenfromoauth_access_tokenwhereauthentica

java - 在本地主机上使用 openid4java 开发和测试混合谷歌 openid + oauth

我正在尝试实现混合GoogleOpenID+OAuth协议(protocol)以识别我的用户并访问他们的Google日历数据。请求示例如下:https://www.google.com/accounts/o8/id?openid.ns=http://specs.openid.net/auth/2.0&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.re

java - 从 Oauth2 Google Contacts API 获取用户信息

我得到的错误:com.google.api.client.googleapis.json.GoogleJsonResponseException:401Unauthorized{"code":401,"errors":[{"domain":"global","location":"Authorization","locationType":"header","message":"InvalidCredentials","reason":"authError"}],"message":"InvalidCredentials"}下面的代码,我正在使用:GoogleCredentialcre

java - 使用 Google OAuth2 授权服务器保护 Spring RESTful API

我计划在AngularJS上使用SpringRESTfulAPI后端和客户端创建应用程序。我想使用GoogleOAuth2授权服务器保护我的SpringRESTfulAPI。我有一个架构问题:在Google中成功授权后,我将从GoogleOAuth2授权服务器接收accessToken。我是否需要将此accessToken传输到我的客户端应用程序(AngularJS),或者我需要在我的后端应用程序中引入一些自己的安全层(例如使用JWT)并基于GoogleaccessToken发布自己的jwtToken并且只将此token传输到我的客户端应用程序?换句话说,从Google向我的客户端An

java - 无法使用 access_token : spring boot Oauth2 访问资源

我正在尝试在我现有的应用程序中实现Oauth2。最初我添加了springsecurity然后尝试添加oauth2,添加配置后我能够生成access_token但是通过使用access_token我无法访问资源。这是我的代码:SecurityConfiguration.java@Configuration@EnableWebSecuritypublicclassSecurityConfigurationextendsWebSecurityConfigurerAdapter{@AutowiredprivateDataSourcedataSource;@AutowiredprivateCli

java - 使用@EnableOAuth2Client 的 OAuth2 客户端手动配置不起作用

我正在关注this官方spring文档中使用@EnableOAuth2Client手动配置OAuth2客户端的教程。由于某种原因,它不起作用。当我运行应用程序并访问http://localhost:8080/login时,我看到的是基本表单登录,而不是Google登录选项。(由于我的用例,我需要使这个手动配置工作。)但是,在我不使用OAuth2AuthenticationProcessingFilters进行任何手动配置的情况下,@EnableOauth2Sso代码工作正常。在这种情况下,我在访问我的登录页面时获得了谷歌登录选项。有人可以帮帮我吗。我添加了以下代码:这是与@Enable

java - 使用 OAuth2 从 Spring Security 自定义身份验证错误

我想知道我是否可以自定义以下授权错误:{"error":"unauthorized","error_description":"Fullauthenticationisrequiredtoaccessthisresource"}当用户请求没有权限时,我得到它。我想将其自定义为与SpringBoot错误非常相似:{"timestamp":1445441285803,"status":401,"error":"Unauthorized","message":"Badcredentials","path":"/oauth/token"}这可能吗?非常感谢。 最佳答

java - 使用 Apache CXF 和 OAuth 2.0 保护 JAX-RS

我想在我的JAX-RSRESTful服务上实现OAuth2.0授权。经过一些研究,我发现ApacheCXF可以做到这一点。但是,我还没有找到任何关于它的例子,我也不清楚。在哪里可以找到一些JAX-RS与OAuth2.0的示例? 最佳答案 免责声明:此答案并未真正提供使用OAuth2.0保护JAX-RS的解决方案。但它旨在为MohasinAli提供一些见解,MohasinAli开始悬赏我的问题。也许,我使用的解决方案对他有用。关于赏金:Thequestioniswidelyapplicabletoalargeaudience.Adet

java - Spring Security OAuth2 简单配置

我有一个简单的项目,需要简单的以下配置:我有一个“密码”grant_type,这意味着我可以提交用户名/密码(用户在我的登录表单中输入),并在成功时获得access_token。使用该access_token,我可以请求API并获取用户信息。我知道API的URI,我不想要任何巨大的东西(我在https://github.com/spring-projects/spring-security-oauth/tree/master/samples上看到了配置)而且它看起来很大。我可以这样想:执行一个简单的HTTP请求,提供*client_id*、*client_secret*、*grant_