mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
use X-Requested-With header if Referer is empty
This commit is contained in:
@@ -510,8 +510,16 @@ public class ShibAuthentication implements AuthenticationMethod {
|
|||||||
int port = request.getServerPort();
|
int port = request.getServerPort();
|
||||||
String contextPath = request.getContextPath();
|
String contextPath = request.getContextPath();
|
||||||
|
|
||||||
String returnURL = ConfigurationManager.getProperty("dspace.baseUrl") + "/api/authn/shibboleth?redirectUrl="
|
String redirectUrl = null;
|
||||||
+ request.getHeader("Referer");
|
if (request.getHeader("Referer") != null && StringUtils.isNotBlank(request.getHeader("Referer"))) {
|
||||||
|
redirectUrl = request.getHeader("Referer");
|
||||||
|
} else if (request.getHeader("X-Requested-With") != null
|
||||||
|
&& StringUtils.isNotBlank(request.getHeader("X-Requested-With"))) {
|
||||||
|
redirectUrl = request.getHeader("X-Requested-With");
|
||||||
|
}
|
||||||
|
|
||||||
|
String returnURL = ConfigurationManager.getProperty("dspace.baseUrl") + "/api/authn/shibboleth"
|
||||||
|
+ ((redirectUrl != null) ? "?redirectUrl=" + redirectUrl : "");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
shibURL += "?target=" + URLEncoder.encode(returnURL, "UTF-8");
|
shibURL += "?target=" + URLEncoder.encode(returnURL, "UTF-8");
|
||||||
|
Reference in New Issue
Block a user