|
16 | 16 |
|
17 | 17 | package org.springframework.security.oauth2.provider.endpoint; |
18 | 18 |
|
19 | | -import java.security.Principal; |
20 | | -import java.util.Arrays; |
21 | | -import java.util.Collections; |
22 | | -import java.util.HashSet; |
23 | | -import java.util.Map; |
24 | | -import java.util.Set; |
25 | | - |
26 | 19 | import org.springframework.http.HttpHeaders; |
27 | 20 | import org.springframework.http.HttpMethod; |
28 | 21 | import org.springframework.http.HttpStatus; |
|
50 | 43 | import org.springframework.web.bind.annotation.RequestMethod; |
51 | 44 | import org.springframework.web.bind.annotation.RequestParam; |
52 | 45 |
|
| 46 | +import java.security.Principal; |
| 47 | +import java.util.Arrays; |
| 48 | +import java.util.Collections; |
| 49 | +import java.util.HashSet; |
| 50 | +import java.util.Map; |
| 51 | +import java.util.Set; |
| 52 | + |
53 | 53 | /** |
54 | 54 | * <p> |
55 | 55 | * Endpoint for token requests as described in the OAuth2 spec. Clients post requests with a <code>grant_type</code> |
@@ -157,32 +157,32 @@ protected String getClientId(Principal principal) { |
157 | 157 |
|
158 | 158 | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
159 | 159 | public ResponseEntity<OAuth2Exception> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) throws Exception { |
160 | | - if (logger.isErrorEnabled()) { |
161 | | - logger.error("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); |
| 160 | + if (logger.isInfoEnabled()) { |
| 161 | + logger.info("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); |
162 | 162 | } |
163 | 163 | return getExceptionTranslator().translate(e); |
164 | 164 | } |
165 | 165 |
|
166 | 166 | @ExceptionHandler(Exception.class) |
167 | 167 | public ResponseEntity<OAuth2Exception> handleException(Exception e) throws Exception { |
168 | | - if (logger.isErrorEnabled()) { |
169 | | - logger.error("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); |
| 168 | + if (logger.isWarnEnabled()) { |
| 169 | + logger.warn("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); |
170 | 170 | } |
171 | 171 | return getExceptionTranslator().translate(e); |
172 | 172 | } |
173 | 173 |
|
174 | 174 | @ExceptionHandler(ClientRegistrationException.class) |
175 | 175 | public ResponseEntity<OAuth2Exception> handleClientRegistrationException(Exception e) throws Exception { |
176 | | - if (logger.isErrorEnabled()) { |
177 | | - logger.error("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); |
| 176 | + if (logger.isWarnEnabled()) { |
| 177 | + logger.warn("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); |
178 | 178 | } |
179 | 179 | return getExceptionTranslator().translate(new BadClientCredentialsException()); |
180 | 180 | } |
181 | 181 |
|
182 | 182 | @ExceptionHandler(OAuth2Exception.class) |
183 | 183 | public ResponseEntity<OAuth2Exception> handleException(OAuth2Exception e) throws Exception { |
184 | | - if (logger.isErrorEnabled()) { |
185 | | - logger.error("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); |
| 184 | + if (logger.isWarnEnabled()) { |
| 185 | + logger.warn("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); |
186 | 186 | } |
187 | 187 | return getExceptionTranslator().translate(e); |
188 | 188 | } |
|
0 commit comments