Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/upgrade spring to 5 3 #216

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/*.iml
.idea
.springBeans
.DS_Store
overlays
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ is rendered within the portlet window. Web Proxy Portlet is often used to incor
are built and run in non-Java environments allowing a site flexibility for integrating content with many different
technologies.

WebproxyPortlet v2 Gateway SSO is a feature that allows uPortal to sign on to any remote system even if the remote system
WebproxyPortlet v2 Gateway SSO (DEPRECATED) is a feature that allows uPortal to sign on to any remote system even if the remote system
does not share any authentication information with uPortal. Gateway SSO will submit login information to the remote
system and then redirect to that remote system. Other SSO solution assume that uPortal has authenticated to some system,
such as CAS and will then trust CAS to say the user is authenticated. In this system, the authentication information is
Expand All @@ -53,7 +53,7 @@ Web Proxy Portlet
- Clipping to get subsections of the targeted URL
- Uses AJAX to request and replace portlet content from whitelist of proxy URLs

Gateway SSO
Gateway SSO (DEPRECATED)
- Log into remote services for users based on user attributes

XSLT Portlet
Expand Down
1 change: 1 addition & 0 deletions docs/gateway_config.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Gateway SSO Configuration
*THIS PORTLET TYPE IS DEPRECATED*

![Example](Gateway SSO example.png)

Expand Down
90 changes: 33 additions & 57 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@
<commons-lang.version>2.6</commons-lang.version>
<portlet-api.version>2.0</portlet-api.version>
<resource-server.version>1.0.44</resource-server.version>
<servlet-api.version>2.5</servlet-api.version>
<spring.version>4.3.30.RELEASE</spring.version>
<servlet.version>3.1.0</servlet.version>
<spring.version>5.3.28</spring.version>
<portletmvc4spring.version>5.2.0</portletmvc4spring.version>
<logbackVersion>1.3.5</logbackVersion>
<lombok.version>1.18.28</lombok.version>
<slf4jVersion>2.0.6</slf4jVersion>
<mockito.version>4.9.0</mockito.version>
<portlet.mvc.util.version>1.1.3</portlet.mvc.util.version>
Expand All @@ -87,8 +89,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -97,11 +99,6 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.11</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down Expand Up @@ -131,14 +128,12 @@
<groupId>org.jasig.portal</groupId>
<artifactId>uPortal-spring</artifactId>
<version>${uportal-libs.version}</version>
<!--
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
-->
</dependency>
<dependency>
<groupId>org.jasig.resourceserver</groupId>
Expand Down Expand Up @@ -177,9 +172,14 @@
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${spring.version}</version>
<groupId>com.liferay.portletmvc4spring</groupId>
<artifactId>com.liferay.portletmvc4spring.framework</artifactId>
<version>${portletmvc4spring.version}</version>
</dependency>
<dependency>
<groupId>com.liferay.portletmvc4spring</groupId>
<artifactId>com.liferay.portletmvc4spring.security</artifactId>
<version>${portletmvc4spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -198,40 +198,23 @@
</dependency>

<!-- For sl4j/logback logging, see https://wiki.jasig.org/display/PLT/Logging+Best+Practices -->
cbeach47 marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
Comment on lines -201 to -206
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed? When I deploy the portlet to Tomcat, I see both these jars in WEB-INF/lib, but I think we only want the slf4j one:

  • commons-logging-1.2.jar
  • jcl-over-slf4j-1.7.5.jar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For logging, the goal is logback (via the slf4j api). All other logging implementations (even transitive ones) should be removed. I'll look into how commons-logging is still getting deployed.

The JCL bridges (-over-) are now included in spring-jcl, so we don't have to explicitly declare them in the pom, however, I'll need to check if jcl-over-slf4j-1.7.5.jar is from spring-jcl, or a transitive dependency that should be excluded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, lines 201-206 actually prevent any dependency from pulling in commons-logging, which is why I think it should remain. Otherwise, you have to find which dependencies are pulling in commons-logging and add excludes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per our side discussion with @bjagg , I'm going in the direction of using the maven enforcer plugin, and then excluding the commons-logging jars as needed. @groybal - please let me know if you don't feel this is sufficient.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in PR - change the parent pom to have a dependencies section with the excluded deps as 'provided'

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4jVersion}</version>
</dependency>
cbeach47 marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logbackVersion}</version>
<scope>runtime</scope>
</dependency>
<!-- End of logging section -->

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -264,18 +247,14 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down Expand Up @@ -318,8 +297,12 @@
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<groupId>com.liferay.portletmvc4spring</groupId>
<artifactId>com.liferay.portletmvc4spring.framework</artifactId>
</dependency>
<dependency>
<groupId>com.liferay.portletmvc4spring</groupId>
<artifactId>com.liferay.portletmvc4spring.security</artifactId>
</dependency>
<dependency>
<groupId>taglibs</groupId>
Expand Down Expand Up @@ -364,24 +347,17 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
</dependency>
<!-- End of logging section -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;

import org.springframework.web.portlet.handler.HandlerInterceptorAdapter;
import com.liferay.portletmvc4spring.handler.HandlerInterceptorAdapter;

/**
* <p>MinimizedStateHandlerInterceptor class.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@
*/
package org.jasig.portlet.proxy.mvc;

import javax.portlet.PortletRequest;
import lombok.extern.slf4j.Slf4j;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.portlet.PortletRequest;

/**
* <p>ThemeNameViewSelectorImpl class.</p>
*
* @author bjagg
* @version $Id: $Id
*/
@Slf4j
public class ThemeNameViewSelectorImpl implements IViewSelector {

private static final String THEME_NAME_PROPERTY = "themeName";
private static final String MOBILE_THEMES_KEY = "mobileThemes";
private String[] mobileThemesDefault = new String[]{ "UniversalityMobile" };

protected final Logger logger = LoggerFactory.getLogger(this.getClass());

/** {@inheritDoc} */
public boolean isMobile(PortletRequest request) {

Expand All @@ -46,20 +44,20 @@ public boolean isMobile(PortletRequest request) {
// if no theme name can be found, just assume the request is for a
// desktop client
if (themeName == null) {
logger.debug("No theme name found, assuming desktop environment");
log.debug("No theme name found, assuming desktop environment");
return false;
}

// otherwise, determine if the theme name matches one of the known
// mobile themes
for (String theme : mobileThemes) {
if (themeName.equals(theme)) {
logger.debug("Theme name {} matches configured list of mobile themes", themeName);
log.debug("Theme name {} matches configured list of mobile themes", themeName);
return true;
}
}

logger.debug("No match found for theme name {}, assuming desktop environment", themeName);
log.debug("No match found for theme name {}, assuming desktop environment", themeName);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @author James Wennmacher, [email protected]
* @version $Id: $Id
*/
@Deprecated // No known usage of this portlet type. Remove when we jump to Java 17.
public class BaseGatewayPortletController {
/**
* <p>removeInaccessibleEntries.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @author Jen Bourey, [email protected]
* @version $Id: $Id
*/
@Deprecated // No known usage of this portlet type. Remove when we jump to Java 17.
public class GatewayEntry {

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@
*/
package org.jasig.portlet.proxy.mvc.portlet.gateway;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jasig.portlet.proxy.mvc.IViewSelector;
import org.jasig.portlet.proxy.service.IFormField;
import org.jasig.portlet.proxy.service.web.HttpContentRequestImpl;
import org.jasig.portlet.proxy.service.web.IAuthenticationFormModifier;
import org.jasig.portlet.proxy.service.web.interceptor.IPreInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.InvalidPropertyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.bind.annotation.RenderMapping;
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
import org.springframework.web.servlet.ModelAndView;
import com.liferay.portletmvc4spring.bind.annotation.RenderMapping;
import com.liferay.portletmvc4spring.bind.annotation.ResourceMapping;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
Expand All @@ -56,11 +55,11 @@
*/
@Controller
@RequestMapping("VIEW")
@Slf4j
@Deprecated // No known usage of this portlet type. Remove when we jump to Java 17.
public class GatewayPortletController extends BaseGatewayPortletController {
private static final String HTTPS = "HTTPS";

protected final Logger logger = LoggerFactory.getLogger(this.getClass());

@Resource(name="gatewayEntries")
private List<GatewayEntry> gatewayEntries;

Expand Down Expand Up @@ -88,7 +87,7 @@ private void validateGatewayEntries() {
* <p>getView.</p>
*
* @param request a {@link javax.portlet.RenderRequest} object
* @return a {@link org.springframework.web.portlet.ModelAndView} object
* @return a {@link org.springframework.web.servlet.ModelAndView} object
*/
@RenderMapping
public ModelAndView getView(RenderRequest request){
Expand All @@ -114,7 +113,7 @@ public ModelAndView getView(RenderRequest request){
mv.addObject("openInNewPage", openInNewPage);

final String view = viewSelector.isMobile(request) ? mobileViewName : viewName;
mv.setView(view);
mv.setViewName(view);
return mv;
}

Expand Down Expand Up @@ -199,7 +198,7 @@ private void prepareGatewayResponse(ResourceRequest portletRequest, ResourceResp
if (entry.isRequireSecure() && StringUtils.isNotBlank(contentRequest.getProxiedLocation())
&& contentRequest.getProxiedLocation().length() >= HTTPS.length()) {
if (!HTTPS.equalsIgnoreCase(contentRequest.getProxiedLocation().substring(0, HTTPS.length()))) {
logger.error("Proxied location '" + contentRequest.getProxiedLocation() + "' for gateway entry "
log.error("Proxied location '" + contentRequest.getProxiedLocation() + "' for gateway entry "
+ entry.getName() + " is not secure - discarding entry!!!");
contentRequest.setParameters(new HashMap<String, IFormField>());
contentRequest.setProxiedLocation("/HTTPSUrlRequiredButNotSpecified"); // Force a failure that's clear
Expand Down
Loading