spring-security-oauth2

How to perform actions on successful login via OAuth2 in jhipster

白昼怎懂夜的黑 提交于 2019-12-01 09:24:30
I want to ask how to perform an action after a successful login via OAuth2 and how to veto a login based on some preconditions. I tried to search on Google and found some links but I'm not sure how to do that on this framework. There might be some filter etc I can add but wanted to know the right place to do this. Note: The AuditEvent will not work for me since successful audit is called with every API call. Ref: http://blog.jdriven.com/2015/01/stateless-spring-security-part-3-jwt-social-authentication/ What I need to do is: After successful login, record a few details in a table and send a

Spring OAUTH2 - Access token expiry time

我的未来我决定 提交于 2019-12-01 06:29:37
问题 Is it possible to update/reset the expiry time of an access token programatically? If yes, which class/filter would be the best place to do it so that expiry time can be updated in JDBC token store. 回答1: To update the expiry time of an access token globally you should have to create instance of the DefaultTokenServices & inject into the AuthorizationServerEndpointsConfigurer like this : public AuthorizationServerTokenServices customTokenServices(){ TokenServices tokenServices = new

How to enable /oauth/check_token with Spring Security Oauth2 using XML

こ雲淡風輕ζ 提交于 2019-12-01 04:45:37
问题 I have successfully enabled the '/oauth/check_token' endpoint using spring-security 3.2.* and javaconfig but currently I'm restricted to spring-security 3.1.4 and then i'm stucked to XML config. '/oauth/token' endpoint is working as i wish but I can't get the check_token endpoint to be enabled and I can't find any (non javaconfig) documentation explaining what to do. Vanila Authorization server config: <oauth:authorization-server client-details-service-ref="client-service" token-services-ref=

Handle UserRedirectRequiredException (A redirect is required to get the users approval)

那年仲夏 提交于 2019-12-01 04:02:23
Introduction One week ago, I began the development of an application using the OAuth2 framework (with Spring Boot v1.3.0.M4). A brand new experience for me. So I try to make it as simple as possible to understand it better. I am using Spring Security OAuth2 and I am facing difficulties to use it correctly. What I want to do Authenticate a user when this one authorize my application. Actually, I don't want him to register on my application so he can freely use it without having to fill boring forms to register. Problem encountered I can't find a way to handle UserRedirectRequired Exception.

How to secure a MVC application with OAuth2 using Spring?

余生颓废 提交于 2019-12-01 03:23:37
Sorry, my English. I have an application I can login in the usual way. @Configuration @EnableWebSecurity public class LoginSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { System.out.println("LoginSecurityConfig :: configure"); auth.jdbcAuthentication().dataSource( getDataSource() ) .passwordEncoder( new BCryptPasswordEncoder(16) ) .usersByUsernameQuery( "select user_name as username,password,enabled from users where user_name=?") .authoritiesByUsernameQuery( "select user_name as username, role_name

Handle UserRedirectRequiredException (A redirect is required to get the users approval)

被刻印的时光 ゝ 提交于 2019-12-01 01:54:40
问题 Introduction One week ago, I began the development of an application using the OAuth2 framework (with Spring Boot v1.3.0.M4). A brand new experience for me. So I try to make it as simple as possible to understand it better. I am using Spring Security OAuth2 and I am facing difficulties to use it correctly. What I want to do Authenticate a user when this one authorize my application. Actually, I don't want him to register on my application so he can freely use it without having to fill boring

Configuring resource server with RemoteTokenServices in Spring Security Oauth2

浪尽此生 提交于 2019-12-01 00:13:34
I'm trying to implement a authorization server and a resource server using spring security oauth2. So far i've managed to setup the authorization server and since i dont want to share a jdbc token store i'm trying to use the remoteTokenService to validate my tokens @ resource server. But i'm getting a 401 error every time i try to access a resource REST method. I'm using xml configuration to setup spring security due to the nature of the project. I've tried with a another sample project using Javaconfig and its working fine. Here are my configuration in the resource server. web.xml <?xml

Run a Spring Boot oAuth2 application as resource server AND serving web content

强颜欢笑 提交于 2019-11-30 23:48:30
I'm using Spring Boot 1.5.13 and with that Spring Security 4.2.6 and Spring Security oAuth2 2.0.15. I want to find a best practice setup for our Spring Boot applications that serve a mixed set of content: A REST API, and some web pages that provide a convenience "landing page" for developers with some links on it, plus Swagger based API documentation, which is also web content. I have a configuration that allows me to run the app with proper authorization code flow, hence I can access all web content via Browser and get authenticated by the configured IdP (in my case PingFederate), plus I can

spring-security-oauth2 2.0.7 refresh token UserDetailsService Configuration - UserDetailsService is required

若如初见. 提交于 2019-11-30 19:00:38
I would have one question regarding the configuration of spring-security-oauth2 2.0.7 please. I am doing the Authentication using LDAP via a GlobalAuthenticationConfigurerAdapter: @SpringBootApplication @Controller @SessionAttributes("authorizationRequest") public class AuthorizationServer extends WebMvcConfigurerAdapter { public static void main(String[] args) { SpringApplication.run(AuthorizationServer.class, args); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); registry.addViewController("/oauth

Run a Spring Boot oAuth2 application as resource server AND serving web content

本小妞迷上赌 提交于 2019-11-30 18:17:18
问题 I'm using Spring Boot 1.5.13 and with that Spring Security 4.2.6 and Spring Security oAuth2 2.0.15. I want to find a best practice setup for our Spring Boot applications that serve a mixed set of content: A REST API, and some web pages that provide a convenience "landing page" for developers with some links on it, plus Swagger based API documentation, which is also web content. I have a configuration that allows me to run the app with proper authorization code flow, hence I can access all web