Handle redirect to client after shibboleth authentication succeded

This commit is contained in:
Giuseppe Digilio
2019-10-23 10:02:46 +02:00
parent 13482c2eb7
commit abbf3f7361
2 changed files with 64 additions and 12 deletions

View File

@@ -33,6 +33,7 @@ import org.dspace.content.NonUniqueMetadataException;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.MetadataFieldService;
import org.dspace.content.service.MetadataSchemaService;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
@@ -509,18 +510,8 @@ public class ShibAuthentication implements AuthenticationMethod {
int port = request.getServerPort();
String contextPath = request.getContextPath();
String returnURL = request.getHeader("Referer");
if (returnURL == null) {
if (request.isSecure() || forceHTTPS) {
returnURL = "https://";
} else {
returnURL = "http://";
}
returnURL += host;
if (!(port == 443 || port == 80)) {
returnURL += ":" + port;
}
}
String returnURL = ConfigurationManager.getProperty("dspace.baseUrl") + "/api/authn/shibboleth?redirectUrl="
+ request.getHeader("Referer");
try {
shibURL += "?target=" + URLEncoder.encode(returnURL, "UTF-8");