-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from amitrp/aph-15360_java21_sb_3.4
aph-15360 java 21 and SB 3.4
- Loading branch information
Showing
154 changed files
with
964 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
spring-boot-actuator/src/main/java/com/amitph/spring/songs/data/SongRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package com.amitph.spring.songs.data; | ||
|
||
import java.util.List; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface SongRepository extends CrudRepository<Song, Long> { | ||
List<Song> findAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ public Song transform(SongDto dto) { | |
song.setYear(dto.getYear()); | ||
return song; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,4 @@ public Integer getYear() { | |
public void setYear(Integer year) { | ||
this.year = year; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 32 additions & 15 deletions
47
...-boot-admin-server/src/main/java/com/amitph/spring/adminserver/SecurityConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,51 @@ | ||
package com.amitph.spring.adminserver; | ||
|
||
import de.codecentric.boot.admin.server.config.AdminServerProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.Customizer; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.security.web.SecurityFilterChain; | ||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; | ||
import org.springframework.security.web.csrf.CookieCsrfTokenRepository; | ||
|
||
@Configuration | ||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
public class SecurityConfiguration { | ||
private final String adminContextPath; | ||
|
||
public SecurityConfiguration(AdminServerProperties adminServerProperties) { | ||
this.adminContextPath = adminServerProperties.getContextPath(); | ||
} | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); | ||
@Bean | ||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { | ||
SavedRequestAwareAuthenticationSuccessHandler successHandler = | ||
new SavedRequestAwareAuthenticationSuccessHandler(); | ||
successHandler.setTargetUrlParameter("redirectTo"); | ||
successHandler.setDefaultTargetUrl(adminContextPath + "/"); | ||
|
||
http | ||
.authorizeRequests().antMatchers(adminContextPath + "/assets/**").permitAll() | ||
.antMatchers(adminContextPath + "/login").permitAll() | ||
.anyRequest().authenticated() | ||
.and().formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler) | ||
.and().logout().logoutUrl(adminContextPath + "/logout") | ||
.and().httpBasic() | ||
.and().csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) | ||
.ignoringAntMatchers(adminContextPath + "/instances", adminContextPath + "/actuator/**"); | ||
http.authorizeHttpRequests( | ||
req -> | ||
req.requestMatchers(adminContextPath + "/assets/**") | ||
.permitAll() | ||
.requestMatchers(adminContextPath + "/login") | ||
.permitAll() | ||
.anyRequest() | ||
.authenticated()) | ||
.formLogin( | ||
formLogin -> | ||
formLogin | ||
.loginPage(adminContextPath + "/login") | ||
.successHandler(successHandler)) | ||
.logout(logout -> logout.logoutUrl(adminContextPath + "/logout")) | ||
.httpBasic(Customizer.withDefaults()) | ||
.csrf( | ||
csrf -> | ||
csrf.csrfTokenRepository( | ||
CookieCsrfTokenRepository.withHttpOnlyFalse()) | ||
.ignoringRequestMatchers( | ||
adminContextPath + "/instances", | ||
adminContextPath + "/actuator/**")); | ||
return http.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
spring-boot-command-line/src/main/java/com/amitph/spring/nonweb/service/NonWebService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package com.amitph.spring.nonweb.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Arrays; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class NonWebService { | ||
public void printMessage(String[] arguments) { | ||
System.out.println("Inside NonWebService Class. Received below arguments"); | ||
Arrays.stream(arguments).forEach(System.out::println); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.