Skip to content

Commit f86d314

Browse files
committed
fix formatting
1 parent 042e3d0 commit f86d314

23 files changed

+817
-875
lines changed

src/main/java/com/bfwg/Application.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@SpringBootApplication
77
public class Application {
88

9-
public static void main(String[] args) {
10-
SpringApplication.run(Application.class, args);
11-
}
12-
}
9+
public static void main(String[] args) {
10+
SpringApplication.run(Application.class, args);
11+
}
12+
}

src/main/java/com/bfwg/common/TimeProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
@Component
1212
public class TimeProvider implements Serializable {
1313

14-
private static final long serialVersionUID = -3301695478208950415L;
14+
private static final long serialVersionUID = -3301695478208950415L;
1515

16-
public Date now() {
17-
return new Date();
18-
}
16+
public Date now() {
17+
return new Date();
18+
}
1919
}

src/main/java/com/bfwg/config/CryptoConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
@Configuration
99
public class CryptoConfig {
1010

11-
@Bean
12-
public PasswordEncoder passwordEncoder() {
13-
return new BCryptPasswordEncoder();
14-
}
11+
@Bean
12+
public PasswordEncoder passwordEncoder() {
13+
return new BCryptPasswordEncoder();
14+
}
1515
}

src/main/java/com/bfwg/config/WebSecurityConfig.java

Lines changed: 44 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,71 +32,57 @@
3232
@EnableMethodSecurity(prePostEnabled = true)
3333
public class WebSecurityConfig {
3434

35-
@Autowired
36-
public PasswordEncoder passwordEncoder;
35+
@Autowired
36+
public PasswordEncoder passwordEncoder;
3737

38-
@Autowired
39-
private CustomUserDetailsService jwtUserDetailsService;
38+
@Autowired
39+
private CustomUserDetailsService jwtUserDetailsService;
4040

41-
@Autowired
42-
private RestAuthenticationEntryPoint restAuthenticationEntryPoint;
41+
@Autowired
42+
private RestAuthenticationEntryPoint restAuthenticationEntryPoint;
4343

44-
@Autowired
45-
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
46-
auth.userDetailsService(jwtUserDetailsService)
47-
.passwordEncoder(passwordEncoder);
48-
}
44+
@Autowired
45+
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
46+
auth.userDetailsService(jwtUserDetailsService).passwordEncoder(passwordEncoder);
47+
}
4948

50-
@Autowired
51-
TokenHelper tokenHelper;
49+
@Autowired
50+
TokenHelper tokenHelper;
5251

53-
@Bean
54-
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
55-
throws Exception {
56-
return authenticationConfiguration.getAuthenticationManager();
57-
}
52+
@Bean
53+
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
54+
throws Exception {
55+
return authenticationConfiguration.getAuthenticationManager();
56+
}
5857

59-
@Bean
60-
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
58+
@Bean
59+
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
6160

62-
http
63-
.addFilterBefore(new TokenAuthenticationFilter(tokenHelper, jwtUserDetailsService),
64-
BasicAuthenticationFilter.class)
65-
.authorizeHttpRequests(authorize -> authorize
66-
.requestMatchers(
67-
antMatcher(HttpMethod.GET, "/"),
68-
antMatcher(HttpMethod.GET, "/auth/**"),
69-
antMatcher(HttpMethod.GET, "/webjars/**"),
70-
antMatcher(HttpMethod.GET, "/*.html"),
71-
antMatcher(HttpMethod.GET, "/favicon.ico"),
72-
antMatcher(HttpMethod.GET, "/**/*.html"),
73-
antMatcher(HttpMethod.GET, "/**/*.css"),
74-
antMatcher(HttpMethod.GET, "/**/*.js"))
75-
.permitAll()
76-
.requestMatchers("/auth/**").permitAll()
77-
.anyRequest().authenticated())
78-
.sessionManagement(sec -> sec.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
79-
.exceptionHandling(
80-
exceptionHandler -> exceptionHandler.authenticationEntryPoint(restAuthenticationEntryPoint))
81-
.csrf(csrf -> csrf.disable());
61+
http.addFilterBefore(new TokenAuthenticationFilter(tokenHelper, jwtUserDetailsService),
62+
BasicAuthenticationFilter.class)
63+
.authorizeHttpRequests(authorize -> authorize
64+
.requestMatchers(antMatcher(HttpMethod.GET, "/"), antMatcher(HttpMethod.GET, "/auth/**"),
65+
antMatcher(HttpMethod.GET, "/webjars/**"), antMatcher(HttpMethod.GET, "/*.html"),
66+
antMatcher(HttpMethod.GET, "/favicon.ico"), antMatcher(HttpMethod.GET, "/**/*.html"),
67+
antMatcher(HttpMethod.GET, "/**/*.css"), antMatcher(HttpMethod.GET, "/**/*.js"))
68+
.permitAll().requestMatchers("/auth/**").permitAll().anyRequest().authenticated())
69+
.sessionManagement(sec -> sec.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
70+
.exceptionHandling(
71+
exceptionHandler -> exceptionHandler.authenticationEntryPoint(restAuthenticationEntryPoint))
72+
.csrf(csrf -> csrf.disable());
8273

83-
return http.build();
84-
}
74+
return http.build();
75+
}
8576

86-
@Bean
87-
public WebSecurityCustomizer webSecurityCustomizer() {
88-
// TokenAuthenticationFilter will ignore the below paths
89-
return (web) -> {
90-
web.ignoring()
91-
.requestMatchers(HttpMethod.POST, "/auth/login")
92-
.requestMatchers(
93-
antMatcher(HttpMethod.GET, "/"),
94-
antMatcher(HttpMethod.GET, "/webjars/**"),
95-
antMatcher(HttpMethod.GET, "/*.html"),
96-
antMatcher(HttpMethod.GET, "/favicon.ico"),
97-
antMatcher(HttpMethod.GET, "/**/*.html"),
98-
antMatcher(HttpMethod.GET, "/**path/*.css"),
99-
antMatcher(HttpMethod.GET, "/**path/*.js"));
100-
};
101-
}
77+
@Bean
78+
public WebSecurityCustomizer webSecurityCustomizer() {
79+
// TokenAuthenticationFilter will ignore the below paths
80+
return (web) -> {
81+
web.ignoring().requestMatchers(HttpMethod.POST, "/auth/login").requestMatchers(
82+
antMatcher(HttpMethod.GET, "/"), antMatcher(HttpMethod.GET, "/webjars/**"),
83+
antMatcher(HttpMethod.GET, "/*.html"), antMatcher(HttpMethod.GET, "/favicon.ico"),
84+
antMatcher(HttpMethod.GET, "/**/*.html"), antMatcher(HttpMethod.GET, "/**path/*.css"),
85+
antMatcher(HttpMethod.GET, "/**path/*.js"));
86+
};
87+
}
10288
}

src/main/java/com/bfwg/model/Authority.java

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,36 @@
2121
@Table(name = "AUTHORITY")
2222
public class Authority implements GrantedAuthority {
2323

24-
@Id
25-
@Column(name = "id")
26-
@GeneratedValue(strategy = GenerationType.IDENTITY)
27-
Long id;
28-
29-
@Enumerated(EnumType.STRING)
30-
@Column(name = "name")
31-
UserRoleName name;
32-
33-
@Override
34-
public String getAuthority() {
35-
return name.name();
36-
}
37-
38-
public void setName(UserRoleName name) {
39-
this.name = name;
40-
}
41-
42-
@JsonIgnore
43-
public UserRoleName getName() {
44-
return name;
45-
}
46-
47-
@JsonIgnore
48-
public Long getId() {
49-
return id;
50-
}
51-
52-
public void setId(Long id) {
53-
this.id = id;
54-
}
24+
@Id
25+
@Column(name = "id")
26+
@GeneratedValue(strategy = GenerationType.IDENTITY)
27+
Long id;
28+
29+
@Enumerated(EnumType.STRING)
30+
@Column(name = "name")
31+
UserRoleName name;
32+
33+
@Override
34+
public String getAuthority() {
35+
return name.name();
36+
}
37+
38+
public void setName(UserRoleName name) {
39+
this.name = name;
40+
}
41+
42+
@JsonIgnore
43+
public UserRoleName getName() {
44+
return name;
45+
}
46+
47+
@JsonIgnore
48+
public Long getId() {
49+
return id;
50+
}
51+
52+
public void setId(Long id) {
53+
this.id = id;
54+
}
5555

5656
}

0 commit comments

Comments
 (0)