Tag: spring oauth2

使用LDAPvalidationSpring oauth / token请求上的客户端ID和客户端密钥

我正在调查客户端ID和客户端密码如何通过LDAP进行身份validation。 注意:这个Kotlin代码… @Configuration @EnableAuthorizationServer class OAuth2AuthorizationServerConfig() : AuthorizationServerConfigurerAdapter() { 我对Spring比较陌生,看来这不是我应该尝试的吗? 但是,这似乎是一个有用的选择。 为什么? 因为它允许我将客户端秘密管理委托给LDAP目录,并且有效地允许我的操作团队改变秘密(以某种管理的方式)。 有了这个我的应用程序不需要知道这个秘密。 这似乎很整齐? oauth的终点是基本认证 – 这似乎是Spring给我的@EnableAuthorizationServer注释。 请求http://somehost/oauth/token指定grant_type : client_credentials 。 我创建的代码来获取任意的令牌(沙箱)…我想只是指定适用于该客户端的客户端和范围,而不是指定秘密… @Throws(Exception::class) override fun configure( clients: ClientDetailsServiceConfigurer ) { // Inlining will create a store per credential entry val serviceBuilder = clients.inMemory() serviceBuilder.withClient(“user”).secret(“test”).scopes(“XXX”) } 我尝试了很多不同的想法,以便在LDAP Authentication Provider向管理的提供者集合中添加一个LDAP Authentication Provider ProviderManager ,从而失败了。 如果我在运行时调试到authenticate方法,我总是只有AnonymousAuthenticationProvider和DaoAuthenticationProvider 下面可能显示我的经验不足,但这里有一个例子,请阅读可能的疯狂 […]

BadCredentialsException:GAE上的Spring引导安全性Oauth2无法获取访问令牌

我目前正在开发一个弹簧引导的小型Web应用程序。 我想使用谷歌oauth2登录我的用户。 所有的工作就像在我的电脑本地主机的魅力,但是当我在GAE部署我的应用程序,我得到一个错误。 这是我从GAE上的开发服务器得到的错误堆栈。 我猜这个错误在生产模式下是一样的。 [INFO] 2017-08-27 17:02:31.290 DEBUG 630 — [tp1134612201-18] gcAuthorizationCodeAccessTokenProvider : Retrieving token from https://www.googleapis.com/oauth2/v4/token [INFO] 2017-08-27 17:02:31.565 DEBUG 630 — [tp1134612201-18] osweb.client.RestTemplate : Created POST request for "https://www.googleapis.com/oauth2/v4/token" [INFO] 2017-08-27 17:02:31.566 DEBUG 630 — [tp1134612201-18] gcAuthorizationCodeAccessTokenProvider : Encoding and sending form: {grant_type=[authorization_code], code=[4/PmvPPmFGQF0PamafaItFDiqKT_RwZN4RkdoydpxOTD4], redirect_uri=[https://127.0.0.1:8080/login], client_id=[XXX], client_secret=[YYY]} [INFO] 2017-08-27 17:02:32.905 DEBUG 630 […]