-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
41 deletions.
There are no files selected for viewing
40 changes: 0 additions & 40 deletions
40
src/main/java/de/samply/security/AccessDeniedExceptionHandler.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
src/main/java/de/samply/security/LoggedCorsConfiguration.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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package de.samply.security; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.HttpMethod; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
public class LoggedCorsConfiguration extends CorsConfiguration { | ||
|
||
@Override | ||
public String checkOrigin(String origin) { | ||
String result = super.checkOrigin(origin); | ||
log.debug("Checking CORS Origin:"); | ||
log.debug("\t-\tInput: " + origin); | ||
log.debug("\t-\tOutput: " + result); | ||
return result; | ||
} | ||
|
||
@Override | ||
public List<HttpMethod> checkHttpMethod(HttpMethod requestMethod) { | ||
List<HttpMethod> result = super.checkHttpMethod(requestMethod); | ||
log.debug("Checking CORS Method:"); | ||
log.debug("\t-\tInput Method: " + requestMethod); | ||
if (result != null) { | ||
log.debug("\t-\tOutput Methods: "); | ||
for (HttpMethod method : result) { | ||
log.debug("\t\t- " + method.name()); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
@Override | ||
public List<String> checkHeaders(List<String> requestHeaders) { | ||
List<String> result = super.checkHeaders(requestHeaders); | ||
log.debug("Checking CORS Headers:"); | ||
if (requestHeaders != null) { | ||
log.debug("\t-\tInput Headers: "); | ||
for (String header : requestHeaders) { | ||
log.debug("\t\t- " + header); | ||
} | ||
} | ||
if (result != null) { | ||
log.debug("\t-\tOutput Headers: "); | ||
for (String header : result) { | ||
log.debug("\t\t- " + header); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
} |
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