Skip to content

Commit 2dd08cc

Browse files
1.0.2: Comment adjustments for JavaDoc
1 parent b58472b commit 2dd08cc

File tree

5 files changed

+39
-64
lines changed

5 files changed

+39
-64
lines changed

spring-lemon-commons-web/src/main/java/com/naturalprogrammer/spring/lemon/commonsweb/LemonCommonsWebAutoConfiguration.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public LemonCommonsWebAutoConfiguration() {
8585
/**
8686
* Prefixes JSON responses for JSON vulnerability. Disabled by default.
8787
* To enable, add this to your application properties:
88-
* lemon.enabled.json-prefix: true
88+
* lemon.enabled.json-prefix: true
89+
*
90+
* @param objectMapper Object Mapper (configured by Spring Boot)
91+
* @return Message converted
8992
*/
9093
@Bean
9194
@ConditionalOnProperty(name="lemon.enabled.json-prefix")
@@ -100,9 +103,12 @@ public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(
100103

101104
return converter;
102105
}
103-
106+
104107
/**
105108
* Configures DefaultExceptionHandlerControllerAdvice if missing
109+
* @param <T> exception
110+
* @param errorResponseComposer the configured errorResponseComposer
111+
* @return configured defaultExceptionHandlerControllerAdvice
106112
*/
107113
@Bean
108114
@ConditionalOnMissingBean(DefaultExceptionHandlerControllerAdvice.class)
@@ -114,9 +120,6 @@ DefaultExceptionHandlerControllerAdvice<T> defaultExceptionHandlerControllerAdvi
114120
return new DefaultExceptionHandlerControllerAdvice<>(errorResponseComposer);
115121
}
116122

117-
/**
118-
* Configures an Error Attributes if missing
119-
*/
120123
@Bean
121124
@ConditionalOnMissingBean(ErrorAttributes.class)
122125
public <T extends Throwable>
@@ -126,9 +129,6 @@ ErrorAttributes errorAttributes(ErrorResponseComposer<T> errorResponseComposer)
126129
return new LemonErrorAttributes<>(errorResponseComposer);
127130
}
128131

129-
/**
130-
* Configures an Error Controller if missing
131-
*/
132132
@Bean
133133
@ConditionalOnMissingBean(ErrorController.class)
134134
public ErrorController errorController(ErrorAttributes errorAttributes,
@@ -139,9 +139,6 @@ public ErrorController errorController(ErrorAttributes errorAttributes,
139139
return new LemonErrorController(errorAttributes, serverProperties, errorViewResolvers);
140140
}
141141

142-
/**
143-
* Configures LemonCorsConfig if missing and lemon.cors.allowed-origins is provided
144-
*/
145142
@Bean
146143
@ConditionalOnProperty(name="lemon.cors.allowed-origins")
147144
@ConditionalOnMissingBean(CorsConfigurationSource.class)
@@ -151,9 +148,6 @@ public LemonCorsConfigurationSource corsConfigurationSource(LemonProperties prop
151148
return new LemonCorsConfigurationSource(properties);
152149
}
153150

154-
/**
155-
* Configures LemonSecurityConfig if missing
156-
*/
157151
@Bean
158152
@ConditionalOnBean(LemonWebSecurityConfig.class)
159153
public SecurityFilterChain lemonSecurityFilterChain(HttpSecurity http, LemonWebSecurityConfig securityConfig) throws Exception {
@@ -162,9 +156,6 @@ public SecurityFilterChain lemonSecurityFilterChain(HttpSecurity http, LemonWebS
162156
return securityConfig.configure(http).build();
163157
}
164158

165-
/**
166-
* Configures an Auditor Aware if missing
167-
*/
168159
@Bean
169160
@ConditionalOnMissingBean(AuditorAware.class)
170161
public <ID extends Serializable>
@@ -174,9 +165,6 @@ AuditorAware<ID> auditorAware() {
174165
return new LemonWebAuditorAware<>();
175166
}
176167

177-
/**
178-
* Configures LemonUtils
179-
*/
180168
@Bean
181169
public LecwUtils lecwUtils(ApplicationContext applicationContext,
182170
ObjectMapper objectMapper) {

spring-lemon-commons-web/src/main/java/com/naturalprogrammer/spring/lemon/commonsweb/exceptions/DefaultExceptionHandlerControllerAdvice.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public DefaultExceptionHandlerControllerAdvice(ErrorResponseComposer<T> errorRes
4646
}
4747

4848

49-
/**
50-
* Handles exceptions
51-
*/
5249
@RequestMapping(produces = "application/json")
5350
@ExceptionHandler(Throwable.class)
5451
public ResponseEntity<?> handleException(T ex) throws T {

spring-lemon-commons-web/src/main/java/com/naturalprogrammer/spring/lemon/commonsweb/exceptions/LemonErrorAttributes.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import com.naturalprogrammer.spring.lemon.exceptions.ErrorResponseComposer;
2020
import com.naturalprogrammer.spring.lemon.exceptions.util.LexUtils;
2121
import lombok.extern.slf4j.Slf4j;
22-
import org.apache.commons.logging.Log;
23-
import org.apache.commons.logging.LogFactory;
2422
import org.springframework.boot.web.error.ErrorAttributeOptions;
2523
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
2624
import org.springframework.web.context.request.WebRequest;
@@ -59,9 +57,6 @@ public Map<String, Object> getErrorAttributes(WebRequest request,
5957
return errorAttributes;
6058
}
6159

62-
/**
63-
* Handles exceptions
64-
*/
6560
@SuppressWarnings("unchecked")
6661
protected void addLemonErrorDetails(
6762
Map<String, Object> errorAttributes, WebRequest request) {

spring-lemon-commons-web/src/main/java/com/naturalprogrammer/spring/lemon/commonsweb/security/LemonCommonsWebTokenAuthenticationFilter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import com.nimbusds.jwt.JWTClaimsSet;
2525
import lombok.AllArgsConstructor;
2626
import lombok.extern.slf4j.Slf4j;
27-
import org.apache.commons.logging.Log;
28-
import org.apache.commons.logging.LogFactory;
2927
import org.springframework.http.HttpHeaders;
3028
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
3129
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -97,7 +95,7 @@ protected Authentication createAuthToken(String token) {
9795
return new UsernamePasswordAuthenticationToken(principal, token, principal.getAuthorities());
9896
}
9997

100-
/**
98+
/*
10199
* Default behaviour is to throw error. To be overridden in auth service.
102100
*/
103101
protected UserDto fetchUserDto(JWTClaimsSet claims) {

spring-lemon-commons-web/src/main/java/com/naturalprogrammer/spring/lemon/commonsweb/security/LemonWebSecurityConfig.java

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void createLemonWebSecurityConfig(BlueTokenService blueTokenService) {
4545
log.info("Created");
4646
}
4747

48-
/**
48+
/*
4949
* Security configuration, calling protected methods
5050
*/
5151
public HttpSecurity configure(HttpSecurity http) throws Exception {
@@ -61,45 +61,45 @@ public HttpSecurity configure(HttpSecurity http) throws Exception {
6161
return http;
6262
}
6363

64-
65-
/**
64+
65+
/*
6666
* Configuring session creation policy
6767
*/
6868
protected void sessionCreationPolicy(HttpSecurity http) throws Exception {
69-
69+
7070
// No session
7171
http.sessionManagement()
72-
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
72+
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
7373
}
7474

75-
76-
/**
75+
76+
/*
7777
* Logout related configuration
7878
*/
7979
protected void logout(HttpSecurity http) throws Exception {
80-
80+
8181
http
82-
.logout().disable(); // we are stateless; so /logout endpoint not needed
82+
.logout().disable(); // we are stateless; so /logout endpoint not needed
8383
}
8484

85-
86-
/**
85+
86+
/*
8787
* Configures exception-handling
8888
*/
8989
protected void exceptionHandling(HttpSecurity http) throws Exception {
90-
90+
9191
http
92-
.exceptionHandling()
93-
94-
/***********************************************
95-
* To prevent redirection to the login page
96-
* when someone tries to access a restricted page
97-
**********************************************/
98-
.authenticationEntryPoint(new Http403ForbiddenEntryPoint());
92+
.exceptionHandling()
93+
94+
/***********************************************
95+
* To prevent redirection to the login page
96+
* when someone tries to access a restricted page
97+
**********************************************/
98+
.authenticationEntryPoint(new Http403ForbiddenEntryPoint());
9999
}
100100

101101

102-
/**
102+
/*
103103
* Configuring token authentication filter
104104
*/
105105
protected void tokenAuthentication(HttpSecurity http) {
@@ -113,37 +113,34 @@ protected void tokenAuthentication(HttpSecurity http) {
113113
* Disables CSRF. We are stateless.
114114
*/
115115
protected void csrf(HttpSecurity http) throws Exception {
116-
116+
117117
http
118-
.csrf().disable();
118+
.csrf().disable();
119119
}
120120

121-
122-
/**
121+
122+
/*
123123
* Configures CORS
124124
*/
125125
protected void cors(HttpSecurity http) throws Exception {
126-
126+
127127
http
128-
.cors();
128+
.cors();
129129
}
130130

131-
132-
/**
131+
132+
/*
133133
* URL based authorization configuration. Override this if needed.
134134
*/
135135
protected void authorizeRequests(HttpSecurity http) throws Exception {
136136
http.authorizeRequests()
137-
.mvcMatchers("/**").permitAll();
137+
.mvcMatchers("/**").permitAll();
138138
}
139139

140140

141-
/**
141+
/*
142142
* Override this to add more http configurations,
143143
* such as more authentication methods.
144-
*
145-
* @param http
146-
* @throws Exception
147144
*/
148145
protected void otherConfigurations(HttpSecurity http) {
149146
// Override this method to provide other configurations

0 commit comments

Comments
 (0)