草庐IT

generic_oauth

全部标签

java - oauth2 spring-security 成功和失败处理程序

我正在将SpringSecurity与OAuth2结合使用。除了登录成功和失败处理程序外,它工作正常。就像在spring中一样,网络安全OAuth2没有明确定义的成功和失败处理程序Hook来更新数据库并相应地设置响应。我需要扩展什么过滤器,它在SpringSecurity过滤器链中的位置应该是什么? 最佳答案 为oauth2login方法指定successHandler和failureHandler:@Configuration@EnableWebSecurityclassSecurityConfigextendsWebSecuri

java - Spring Boot2 Oauth2 隐式流程 - http ://localhost:8080/oauth/authorize getting Access Denied

我创建了一个SpringBoot2应用程序,集成了SpringFoxSwagger2.8.0和用于身份验证和授权的隐式Oauth2授权。代码工作正常,但是当我点击授权按钮时,它会重定向到http://localhost:8080/oauth/authorize?response_type=token&client_id=test-app-client-id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fwebjars%2Fspringfox-swagger-ui%2Foauth2-redirect.html&scope=read&state=

java - Generic ObjectPool - 如何返回一个通用类?

我正在尝试开发一个ObjectPool,它可以与任何对象一起使用,而无需更改池和对象的源-但我找不到任何方法来编写get()-函数(“Maincode”从池中获取一些对象)因为存在类型不匹配(无法从对象转换为TestObject)到目前为止,这是我的代码:对象池:publicObjectget(){intfirst=availableObjects.get(0);availableObjects.remove(0);returnobjects.get(first);}在objects(ArrayList)中有池中的所有对象,availableObjects只包含所有可用对象的列表。我基

java - oAuth2 客户端在 Spring Security 中授予密码

我正在使用一组受oAuth2保护的服务。目前它是这样工作的:客户端使用他们的用户名和密码登录。我用这些交换token。我将token保存在session中,并在每次我想调用服务时提交它。它有效,但问题是我完全手动执行此操作,而没有使用很多SpringSecurityoAuth2支持。这是它的样子:myScope如您所见,我自己创建了身份验证提供程序。它接受标准的UsernamePasswordAuthenticationToken但正在生成我自己的扩展,它也保留实际的OAuth2AccessToken,从而将其保存在安全上下文中。publicclassOauth2Authenticat

Java Generics GetThis Trick 解释

我正在阅读有关Java泛型的文章,我偶然发现了这个主题,我对此感到有些困惑。发件人:http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ205publicabstractclassNode>{privatefinalListchildren=newArrayList();privatefinalNparent;protectedNode(Nparent){this.parent=parent;parent.children.add(this);//error:incompatib

java - 使用 SkyDrive REST API 从 java 桌面客户端检索 OAuth 2.0(隐式授权)的访问 token 。

我正在尝试使用SkyDriveRESTAPI从Java桌面客户端应用程序实现OAuth2.0隐式授权。我使用以下代码:Desktop.getDesktop().browse(newURL(st.toString()).toURI());JOptionPane.showMessageDialog(null,"Pressoktocontinueonceyouhaveauthenticated.");我的代码打开网络浏览器并要求用户登录,然后SkyDrive以下列形式将访问token发送到浏览器url:https://login.live.com/oauth20_desktop.srf?lc

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 泛型 : Question regarding type capture and generated inference using generic methods

这是我上一个问题的后续问题,但由于上一个线程很长,我决定开始另一个与几乎相同主题相关的线程。publicclassGenericMethodInference{staticvoidtest1(Tt1,Tt2){}staticvoidtest3(Tt1,Listt2){}staticvoidtest4(Listt1,Listt2){}publicstaticvoidmain(String[]args){Listc=newLinkedList();Listd=newArrayList();Liste=newArrayList();test1("Hello",newInteger(1));/