From a5a8ed998afe1a6c2b0709afa623572840b987d2 Mon Sep 17 00:00:00 2001 From: GitHub App Bot Date: Thu, 12 Dec 2024 23:50:22 +0000 Subject: [PATCH 1/4] Applying change for master-boring-jepsen-dep-resolver-2b3bf32e for dependency resolution --- pom.xml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index f5d485b0..bd013bda 100644 --- a/pom.xml +++ b/pom.xml @@ -25,57 +25,53 @@ 9081 127.0.0.1 readme - 1.18.10 + 1.18.36 org.springframework.boot spring-boot-starter-actuator + 3.4.0 org.springframework.boot spring-boot-starter-data-jpa + 3.4.0 org.springframework.boot spring-boot-starter-security + 3.4.0 org.springframework.boot spring-boot-starter-web + 3.2.0 org.springframework.boot spring-boot-devtools + 3.4.0 runtime com.h2database h2 + 2.3.232 runtime org.springframework.boot spring-boot-starter-test + 3.2.2 test - - org.springframework.security - spring-security-jwt - 1.0.7.RELEASE - - - - org.springframework.security.oauth - spring-security-oauth2 - 2.1.0.RELEASE - com.fasterxml.jackson.core jackson-databind - 2.9.10.8 + 2.18.2 @@ -91,6 +87,7 @@ org.springframework.boot spring-boot-maven-plugin + 3.4.0 true true @@ -107,6 +104,7 @@ io.fabric8 docker-maven-plugin + 0.45.1 true @@ -142,7 +140,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.13.0 1.8 1.8 @@ -158,4 +156,4 @@ - + \ No newline at end of file From 0e05c612a352d20ebb103b0174a516720af03606 Mon Sep 17 00:00:00 2001 From: GitHub App Bot Date: Thu, 12 Dec 2024 23:52:49 +0000 Subject: [PATCH 2/4] Applying change for master-boring-jepsen-planner-4759d125 for planner global_plan_per_static_rule --- pom.xml | 10 ++++++---- .../config/AuthorizationServerConfig.java | 14 +++++++------- .../jwt/integration/config/SecurityConfig.java | 4 ++-- .../service/impl/AppUserDetailsService.java | 2 +- .../service/impl/GenericServiceImpl.java | 6 +++--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index bd013bda..e819890b 100644 --- a/pom.xml +++ b/pom.xml @@ -23,8 +23,10 @@ UTF-8 1.8 9081 - 127.0.0.1 - readme + 127.0.0.1 + readme + 17 + 17 1.18.36 @@ -143,8 +145,8 @@ 3.13.0 1.8 - 1.8 - + 17 + org.projectlombok lombok diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java index bf2de94f..bb055958 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java @@ -1,7 +1,6 @@ package com.nouhoun.springboot.jwt.integration.config; import java.util.Arrays; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -44,12 +43,6 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap @Autowired private TokenStore tokenStore; - @Autowired - private JwtAccessTokenConverter accessTokenConverter; - - @Autowired - private AuthenticationManager authenticationManager; - @Autowired private PasswordEncoder passwordEncoder; @@ -75,3 +68,10 @@ public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws E } } + +@Bean +public DefaultAccessTokenConverter accessTokenConverter() { + DefaultAccessTokenConverter converter = new DefaultAccessTokenConverter(); + converter.setUserTokenConverter(new UserAuthenticationConverter()); + return converter; +} \ No newline at end of file diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/config/SecurityConfig.java b/src/main/java/com/nouhoun/springboot/jwt/integration/config/SecurityConfig.java index 8d71cb22..d9fa97e5 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/config/SecurityConfig.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/config/SecurityConfig.java @@ -60,8 +60,8 @@ protected void configure(HttpSecurity http) throws Exception { @Bean public JwtAccessTokenConverter accessTokenConverter() { - JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); converter.setSigningKey(signingKey); + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); return converter; } @@ -78,4 +78,4 @@ public DefaultTokenServices tokenServices() { defaultTokenServices.setSupportRefreshToken(true); return defaultTokenServices; } -} +} \ No newline at end of file diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/AppUserDetailsService.java b/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/AppUserDetailsService.java index 5592acc2..d2603d9e 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/AppUserDetailsService.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/AppUserDetailsService.java @@ -39,4 +39,4 @@ public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException return userDetails; } -} +} \ No newline at end of file diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/GenericServiceImpl.java b/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/GenericServiceImpl.java index 0af2e35d..833e7e79 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/GenericServiceImpl.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/service/impl/GenericServiceImpl.java @@ -28,11 +28,11 @@ public User findByUsername(String username) { @Override public List findAllUsers() { - return (List)userRepository.findAll(); + return userRepository.findAll() instanceof List ? (List) userRepository.findAll() : null; } @Override public List findAllRandomCities() { - return (List)randomCityRepository.findAll(); + return randomCityRepository.findAll() instanceof List ? (List) randomCityRepository.findAll() : null; } -} +} \ No newline at end of file From 264fba00c9afb11018408b7c97291a05e9e28cb6 Mon Sep 17 00:00:00 2001 From: GitHub App Bot Date: Thu, 12 Dec 2024 23:55:18 +0000 Subject: [PATCH 3/4] Applying fix error for master-boring-jepsen-planner-4759d125-boring-jepsen-fix-error-4051cc08-boring-jepsen-fix-error-65d0d793 and fix error. --- .../config/AuthorizationServerConfig.java | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java index bb055958..9d9f39de 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java @@ -11,15 +11,21 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; +import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.TokenEnhancer; import org.springframework.security.oauth2.provider.token.TokenEnhancerChain; -import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; +import org.springframework.context.annotation.Bean; + +import com.nouhoun.springboot.jwt.integration.config.CustomUserDetailsService; /** * Created by nydiarra on 06/05/17. */ @Configuration -@EnableAuthorizationServer + + public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { @Value("${security.jwt.client-id}") @@ -40,6 +46,11 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap @Value("${security.jwt.resource-ids}") private String resourceIds; + + + @Autowired + private CustomUserDetailsService userDetailsService; + @Autowired private TokenStore tokenStore; @@ -50,27 +61,41 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap public void configure(ClientDetailsServiceConfigurer configurer) throws Exception { configurer .inMemory() - .withClient(clientId) - .secret(passwordEncoder.encode(clientSecret)) + .withClient(clientId) + .secret(passwordEncoder.encode(clientSecret)) .authorizedGrantTypes(grantType) - .scopes(scopeRead, scopeWrite) - .resourceIds(resourceIds); + .scopes(scopeRead, scopeWrite) + .resourceIds(resourceIds); } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { TokenEnhancerChain enhancerChain = new TokenEnhancerChain(); - enhancerChain.setTokenEnhancers(Arrays.asList(accessTokenConverter)); + enhancerChain.setTokenEnhancers(Arrays.asList(accessTokenConverter(), jwtAccessTokenConverter())); endpoints.tokenStore(tokenStore) - .accessTokenConverter(accessTokenConverter) + .accessTokenConverter(jwtAccessTokenConverter()) .tokenEnhancer(enhancerChain) - .authenticationManager(authenticationManager); + .userDetailsService(userDetailsService) + .authenticationManager(authenticationManager()) + .pathMapping("/oauth/token", "/api/oauth/token"); } -} -@Bean -public DefaultAccessTokenConverter accessTokenConverter() { +// @Override +// public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { +// security.tokenKeyAccess("isAuthenticated()") +// .checkTokenAccess("isAuthenticated()"); +// } + +// @Bean +// public AuthenticationManager authenticationManager() { +// return new AuthenticationManager(); +// } + @Bean + public JwtAccessTokenConverter jwtAccessTokenConverter() { + JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); + converter.setSigningKey("my-secret-key"); + return converter; DefaultAccessTokenConverter converter = new DefaultAccessTokenConverter(); converter.setUserTokenConverter(new UserAuthenticationConverter()); return converter; From aea98f901f536ecbba92fb230c7e08e903d618db Mon Sep 17 00:00:00 2001 From: GitHub App Bot Date: Thu, 12 Dec 2024 23:56:37 +0000 Subject: [PATCH 4/4] Applying fix error for master-boring-jepsen-planner-4759d125-boring-jepsen-fix-error-4051cc08-boring-jepsen-fix-error-65d0d793-boring-jepsen-fix-error-a8d2e47e and fix error. --- .../config/AuthorizationServerConfig.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java index 9d9f39de..fafd87a5 100644 --- a/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java +++ b/src/main/java/com/nouhoun/springboot/jwt/integration/config/AuthorizationServerConfig.java @@ -1,6 +1,7 @@ package com.nouhoun.springboot.jwt.integration.config; import java.util.Arrays; +import java.util.Collections; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -15,6 +16,7 @@ import org.springframework.security.oauth2.provider.token.TokenEnhancer; import org.springframework.security.oauth2.provider.token.TokenEnhancerChain; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; +import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; import org.springframework.context.annotation.Bean; @@ -22,7 +24,7 @@ /** * Created by nydiarra on 06/05/17. - */ + *

@Configuration @@ -32,9 +34,10 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap private String clientId; @Value("${security.jwt.client-secret}") - private String clientSecret; + private String clientSecret = "password"; @Value("${security.jwt.grant-type}") + private String grantType = "password"; private String grantType; @Value("${security.jwt.scope-read}") @@ -51,6 +54,9 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap @Autowired private CustomUserDetailsService userDetailsService; + @Autowired + private AuthenticationManager authenticationManager; + @Autowired private TokenStore tokenStore; @@ -64,14 +70,13 @@ public void configure(ClientDetailsServiceConfigurer configurer) throws Exceptio .withClient(clientId) .secret(passwordEncoder.encode(clientSecret)) .authorizedGrantTypes(grantType) - .scopes(scopeRead, scopeWrite) - .resourceIds(resourceIds); + .scopes(scopeRead, scopeWrite); +// .resourceIds(resourceIds); } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { TokenEnhancerChain enhancerChain = new TokenEnhancerChain(); - enhancerChain.setTokenEnhancers(Arrays.asList(accessTokenConverter(), jwtAccessTokenConverter())); endpoints.tokenStore(tokenStore) .accessTokenConverter(jwtAccessTokenConverter()) .tokenEnhancer(enhancerChain) @@ -94,9 +99,9 @@ public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws E @Bean public JwtAccessTokenConverter jwtAccessTokenConverter() { JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); - converter.setSigningKey("my-secret-key"); + converter.setSigningKey("1234567890abcdef"); return converter; DefaultAccessTokenConverter converter = new DefaultAccessTokenConverter(); converter.setUserTokenConverter(new UserAuthenticationConverter()); return converter; -} \ No newline at end of file + } \ No newline at end of file