8000 [anj/tmp-mig] Demo migration PR by anj-s · Pull Request #10 · anj-s/springboot-jwt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[anj/tmp-mig] Demo migration PR #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,62 +21,67 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<tomcat.port>9081</tomcat.port>
<java.version>17</java.version>
<tomcat.port>9081</tomcat.port>\n\t
<tomcat.ip>127.0.0.1</tomcat.ip>
<file>readme</file>
<lombok.version>1.18.10</lombok.version>
<lombok.version>1.18.20</lombok.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.7.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.7.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>2.7.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.13</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.7.14</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<artifactId>h2</artifactId>\n\t\t\t<version>2.1.212</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.7.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.7.RELEASE</version>
<version>1.1.1.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.1.0.RELEASE</version>
<version>2.5.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.8</version>
</dependency>
<artifactId>jackson-databind</artifactId>\n\t\t\t<version>2.13.5</version>
</dependency>\n

<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -90,7 +95,7 @@
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<artifactId>spring-boot-maven-plugin</artifactId>\n <version>2.7.14</version>
<configuration>
<executable>true</executable>
<addResources>true</addResources>
Expand All @@ -107,6 +112,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.45.1</version>
<extensions>true</extensions>

<configuration>
Expand Down Expand Up @@ -142,8 +148,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<version>3.10.1</version>
<version>3.11.0</version>\n\t\t\t\t<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
Expand All @@ -158,4 +164,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,18 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
@Override
public void configure(ClientDetailsServiceConfigurer configurer) throws Exception {
configurer
.inMemory()
.withClient(clientId)
.secret(passwordEncoder.encode(clientSecret))
.authorizedGrantTypes(grantType)
.scopes(scopeRead, scopeWrite)
.resourceIds(resourceIds);
.inMemory().withClient(clientId).secret(passwordEncoder.encode(clientSecret)).authorizedGrantTypes(grantType).scopes(scopeRead, scopeWrite).resourceIds(resourceIds)
.accessTokenValiditySeconds(24*60*60).refreshTokenValiditySeconds(6*24*60*60);
}

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
TokenEnhancerChain enhancerChain = new TokenEnhancerChain();
enhancerChain.setTokenEnhancers(Arrays.asList(accessTokenConverter));
endpoints.tokenStore(tokenStore)
.accessTokenConverter(accessTokenConverter)
.tokenEnhancer(enhancerChain)
.authenticationManager(authenticationManager);
.accessTokenConverter(accessTokenConverter)
.authenticationManager(authenticationManager)
.tokenEnhancer(enhancerChain);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class User {
/**
* Roles are being eagerly loaded here because
* they are a fairly small collection of items for this example.
*/
**/
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "user_role", joinColumns
= @JoinColumn(name = "user_id",
Expand All @@ -46,4 +46,3 @@ public class User {
referencedColumnName = "id"))
private List<Role> roles;
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException
User user = userRepository.findByUsername(s);

if(user == null) {
throw new UsernameNotFoundException(String.format("The username %s doesn't exist", s));
throw new UsernameNotFoundException("The username " + s + " doesn't exist");
}

List<GrantedAuthority> authorities = new ArrayList<>();
Expand All @@ -39,4 +39,4 @@ public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException

return userDetails;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public User findByUsername(String username) {

@Override
public List<User> findAllUsers() {
return (List<User>)userRepository.findAll();
return (List<User>) userRepository.findAll();
}

@Override
public List<RandomCity> findAllRandomCities() {
return (List<RandomCity>)randomCityRepository.findAll();
return (List<RandomCity>) randomCityRepository.findAll();
}
}
}
0