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

Initial update of dependencies to Jakarta EE 10 versions. #23729

Merged
merged 35 commits into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
638c633
Update dependencies to Jakarta EE 10 versions.
arjantijms Dec 1, 2021
7be3ade
Second batch
arjantijms Dec 1, 2021
4628cd0
Third batch
arjantijms Dec 2, 2021
9725827
Updated Servlet, Authorization and more. Added patches for Metro.
arjantijms Dec 10, 2021
62d12d9
Patch Hibernate Validator and integrate Sun EL 5.0.0-M1
arjantijms Dec 12, 2021
1e77b91
Integrate WaSP 3.1.0-M1
arjantijms Dec 12, 2021
a16af04
Faces and Mojarra 4.0.0 + Weld cleanup
arjantijms Dec 13, 2021
91fa8cc
Integrated CDI 4/Weld 5
arjantijms Dec 13, 2021
7ca6328
Integrate Batch 2.1.0-M1
arjantijms Dec 15, 2021
38a6959
Improve logging of OSGi errors
arjantijms Dec 15, 2021
68a7941
Integrate Standard Tags 3.0.0-SNAPSHOT API + Impl
arjantijms Dec 15, 2021
0cbb56f
Integrated WaSP further, disabled Krazo & Soteria
arjantijms Dec 16, 2021
0429998
Integrate Metro 4.0.0-M1 and XNL Bind RC3/M2
arjantijms Dec 16, 2021
0324fa8
Added santuario dependency and added new patch for Metro
arjantijms Dec 17, 2021
7b4ceaf
Updated CDI tests for CDI 4.0
arjantijms Dec 19, 2021
a9cc90c
Integrated EclipseLink 4.0.0-M1 and Angus 1.0.0
arjantijms Dec 19, 2021
0fa12dc
Small amount of cleaning before changes.
arjantijms Dec 21, 2021
3e2df4f
Fix Jakarta Pages tests
arjantijms Dec 21, 2021
248b910
Added more info about what's happening in quicklook tests
arjantijms Dec 21, 2021
9d5d66f
Fixed QuickLook tests
arjantijms Dec 25, 2021
080c9db
Fix typo
arjantijms Dec 25, 2021
647fd6f
Fixed checkstyle warnings
arjantijms Dec 25, 2021
c800b09
Tidying of poms
arjantijms Dec 25, 2021
2fa833a
Added snapshots module to build dependencies as part of the project.
arjantijms Dec 25, 2021
0cdf588
Merge remote-tracking branch 'origin/master' into ee10_dependencies
arjantijms Dec 25, 2021
54953b4
Fix breakage of build
arjantijms Dec 26, 2021
3602616
Add jBatch snapshot
arjantijms Dec 26, 2021
8091455
Fix copy/paste error
arjantijms Dec 26, 2021
cc73ccf
Run quicklook web twice
arjantijms Dec 27, 2021
dcaf2ee
Corrected typo
arjantijms Dec 27, 2021
2e506ac
Test web
arjantijms Dec 27, 2021
0dc6c5b
Add Hibernate Validator patch for Web Profile too.
arjantijms Dec 27, 2021
73270c4
Added other jobs back
arjantijms Dec 27, 2021
ae56043
Update Jakarta Pages URI
arjantijms Dec 28, 2021
a1e0a61
No TCK on profile oss-release
arjantijms Dec 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--

Copyright (c) 2021 Contributors to Eclipse Foundation.
Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -278,7 +279,7 @@

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<servlet-class>org.glassfish.wasp.servlet.JspServlet</servlet-class>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>true</param-value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,39 @@

package org.glassfish.admingui.common.handlers;

import com.sun.enterprise.config.serverbeans.ServerTags;
import com.sun.jsftemplating.annotation.Handler;
import com.sun.jsftemplating.annotation.HandlerInput;
import com.sun.jsftemplating.annotation.HandlerOutput;
import com.sun.jsftemplating.el.PageSessionResolver;
import com.sun.jsftemplating.handlers.NavigationHandlers;
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
import com.sun.jsftemplating.util.Util;

import java.io.IOException;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
import jakarta.servlet.http.HttpServletResponse;
import org.glassfish.admingui.common.tree.FilterTreeEvent;

import org.glassfish.admingui.common.util.GuiUtil;
import org.glassfish.admingui.common.util.MiscUtil;
import org.glassfish.admingui.common.util.RestUtil;
import org.glassfish.admingui.common.util.TargetUtil;

import com.sun.enterprise.config.serverbeans.ServerTags;
import com.sun.jsftemplating.annotation.Handler;
import com.sun.jsftemplating.annotation.HandlerInput;
import com.sun.jsftemplating.annotation.HandlerOutput;
import com.sun.jsftemplating.handlers.NavigationHandlers;
import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
import com.sun.jsftemplating.util.Util;

import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
import jakarta.servlet.http.HttpServletResponse;


public class CommonHandlers {

Expand Down Expand Up @@ -826,10 +825,9 @@ public static List filterAdminObjects(HandlerContext context) {
private static String handleBareAttribute(FacesContext ctx, String url) {
// Get Page Session...
UIViewRoot root = ctx.getViewRoot();
Map<String, Serializable> pageSession =
PageSessionResolver.getPageSession(ctx, root);
Map<String, Serializable> pageSession = null; // PageSessionResolver.getPageSession(ctx, root);
if (pageSession == null) {
pageSession = PageSessionResolver.createPageSession(ctx, root);
pageSession = createPageSession(ctx, root); // PageSessionResolver.createPageSession(ctx, root);
}
String request = ctx.getExternalContext().getRequestParameterMap().get("bare");
if (request != null) {
Expand All @@ -853,6 +851,26 @@ private static String handleBareAttribute(FacesContext ctx, String url) {
return url;
}

/**
* <p>
* This method will create a new "page session" <code>Map</code>. It will overwrite any existing "page session"
* <code>Map</code>, so be careful.
* </p>
*/
public static Map<String, Serializable> createPageSession(FacesContext ctx, UIViewRoot root) {
if (root == null) {
root = ctx.getViewRoot();
}
// Create it...
Map<String, Serializable> map = new HashMap<>(4);

// Store it...
root.getAttributes().put("_ps", map);

// Return it...
return map;
}

/**
* Add the name/value pair to the given url.
* @param url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@
import com.sun.enterprise.security.SecurityServicesUtil;

/**
* This class is responsible for providing the Authentication support
* needed by the admin console to both access the admin console pages
* as well as invoke REST requests.
* This class is responsible for providing the Authentication support needed by the admin console to both access the
* admin console pages as well as invoke REST requests.
*/
public class AdminConsoleAuthModule implements ServerAuthModule {
//public static final String TOKEN_ADMIN_LISTENER_PORT = "${ADMIN_LISTENER_PORT}";
// public static final String TOKEN_ADMIN_LISTENER_PORT = "${ADMIN_LISTENER_PORT}";

private CallbackHandler handler = null;

Expand All @@ -78,7 +77,7 @@ public class AdminConsoleAuthModule implements ServerAuthModule {

private String loginErrorPage = null;

private static final Class[] SUPPORTED_MESSAGE_TYPES = new Class[]{HttpServletRequest.class, HttpServletResponse.class};
private static final Class[] SUPPORTED_MESSAGE_TYPES = new Class[] { HttpServletRequest.class, HttpServletResponse.class };

private static final String SAVED_SUBJECT = "Saved_Subject";

Expand Down Expand Up @@ -106,34 +105,32 @@ public class AdminConsoleAuthModule implements ServerAuthModule {
private static final Logger logger = GuiUtil.getLogger();

/**
* This method configures this AuthModule and makes sure all the
* information needed to continue is present.
* This method configures this AuthModule and makes sure all the information needed to continue is present.
*/
@Override
public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler, Map options) throws AuthException {
this.handler = handler;
if (options != null) {
this.loginPage = (String) options.get("loginPage");
if (loginPage == null) {
throw new AuthException("'loginPage' "
+ "must be supplied as a property in the provider-config "
+ "in the domain.xml file!");
throw new AuthException(
"'loginPage' " + "must be supplied as a property in the provider-config " + "in the domain.xml file!");
}
this.loginErrorPage = (String) options.get("loginErrorPage");
if (loginErrorPage == null) {
throw new AuthException("'loginErrorPage' "
+ "must be supplied as a property in the provider-config "
+ "in the domain.xml file!");
throw new AuthException(
"'loginErrorPage' " + "must be supplied as a property in the provider-config " + "in the domain.xml file!");
}
ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
Domain domain = habitat.getService(Domain.class);
NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");
NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig()
.getNetworkListener("admin-listener");
SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);

final String host = adminListener.getAddress();
// Save the REST URL we need to authenticate the user.
this.restURL = (SecureAdmin.Util.isEnabled(secureAdmin) ? "https://" : "http://") +
(host.equals("0.0.0.0") ? "localhost" : host) + ":" + adminListener.getPort() + "/management/sessions";
this.restURL = (SecureAdmin.Util.isEnabled(secureAdmin) ? "https://" : "http://")
+ (host.equals("0.0.0.0") ? "localhost" : host) + ":" + adminListener.getPort() + "/management/sessions";
}
}

Expand All @@ -145,19 +142,15 @@ public Class[] getSupportedMessageTypes() {
return SUPPORTED_MESSAGE_TYPES;
}


/**
* This is where the validation happens...
*/
@Override
public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException {
// Make sure we need to check...
HttpServletRequest request =
(HttpServletRequest) messageInfo.getRequestMessage();
HttpServletResponse response =
(HttpServletResponse) messageInfo.getResponseMessage();
if (!isMandatory(messageInfo)
&& !request.getRequestURI().endsWith("/j_security_check")) {
HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
if (!isMandatory(messageInfo) && !request.getRequestURI().endsWith("/j_security_check")) {
return AuthStatus.SUCCESS;
}

Expand All @@ -167,7 +160,7 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
return AuthStatus.FAILURE;
}

Subject savedClientSubject = (Subject) session.getValue(SAVED_SUBJECT);
Subject savedClientSubject = (Subject) session.getAttribute(SAVED_SUBJECT);
if (savedClientSubject != null) {
// Copy all principals...
clientSubject.getPrincipals().addAll(savedClientSubject.getPrincipals());
Expand All @@ -177,23 +170,21 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
}

// See if we've already calculated the serverName / serverPort
if (session.getValue(REST_SERVER_NAME) == null) {
if (session.getAttribute(REST_SERVER_NAME) == null) {
// Save this for use later...
URL url = null;
try {
url = new URL(restURL);
} catch (MalformedURLException ex) {
throw new IllegalArgumentException(
"Unable to parse REST URL: (" + restURL + ")", ex);
throw new IllegalArgumentException("Unable to parse REST URL: (" + restURL + ")", ex);
}
session.putValue(REST_SERVER_NAME, url.getHost());
session.putValue(REST_SERVER_PORT, url.getPort());
session.setAttribute(REST_SERVER_NAME, savedClientSubject);
session.setAttribute(REST_SERVER_PORT, url.getPort());
}

// See if the username / password has been passed in...
String username = request.getParameter("j_username");
char[] password = request.getParameter("j_password") != null
? request.getParameter("j_password").toCharArray() : null;
char[] password = request.getParameter("j_password") != null ? request.getParameter("j_password").toCharArray() : null;
if ((username == null) || (password == null) || !request.getMethod().equalsIgnoreCase("post")) {
// Not passed in, show the login page...
String origPath = request.getRequestURI();
Expand All @@ -213,14 +204,6 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
return AuthStatus.SEND_CONTINUE;
}

// Don't use the PasswordValidationCallback... use REST authorization instead.
// char[] pwd = new char[password.length()];
// password.getChars(0, password.length(), pwd, 0);
// PasswordValidationCallback pwdCallback =
// new PasswordValidationCallback(clientSubject, username, pwd);

// Make REST Request

Client client2 = RestUtil.initialize(ClientBuilder.newBuilder()).build();
WebTarget target = client2.target(restURL);
target.register(HttpAuthenticationFeature.basic(username, new String(password)));
Expand All @@ -233,10 +216,9 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
// Check to see if successful..
if (restResp.isSuccess()) {
// Username and Password sent in... validate them!
CallerPrincipalCallback cpCallback =
new CallerPrincipalCallback(clientSubject, username);
CallerPrincipalCallback cpCallback = new CallerPrincipalCallback(clientSubject, username);
try {
handler.handle(new Callback[]{ /*pwdCallback,*/cpCallback});
handler.handle(new Callback[] { /* pwdCallback, */cpCallback });
} catch (Exception ex) {
AuthException ae = new AuthException();
ae.initCause(ex);
Expand All @@ -245,7 +227,7 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject

request.changeSessionId();

// Get the "extraProperties" section of the response...
// Get the "extraProperties" section of the response...
Object obj = restResp.getResponse().get("data");
Map extraProperties = null;
if ((obj != null) && (obj instanceof Map)) {
Expand All @@ -257,29 +239,28 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject

// Save the Rest Token...
if (extraProperties != null) {
session.putValue(REST_TOKEN, extraProperties.get("token"));
session.setAttribute(REST_TOKEN, extraProperties.get("token"));
}

// Save the Subject...
session.putValue(SAVED_SUBJECT, clientSubject);
session.setAttribute(SAVED_SUBJECT, clientSubject);

// Save the userName
session.putValue(USER_NAME, username);
session.setAttribute(USER_NAME, username);

try {
// Redirect...
String origRequest = (String)session.getAttribute(ORIG_REQUEST_PATH);
String origRequest = (String) session.getAttribute(ORIG_REQUEST_PATH);
// Explicitly test for favicon.ico, as Firefox seems to ask for this on
// every page
if ((origRequest == null) || "/favicon.ico".equals(origRequest)) {
origRequest = "/index.jsf";
}
logger.log(Level.INFO, "Redirecting to {0}", neutralizeForLog(origRequest));
if (InputValidationUtil.validateStringforCRLF(origRequest)) {
response.sendError(403,"Forbidden");
response.sendError(403, "Forbidden");
}
response.sendRedirect(
response.encodeRedirectURL(InputValidationUtil.removeLinearWhiteSpaces(origRequest)));
response.sendRedirect(response.encodeRedirectURL(InputValidationUtil.removeLinearWhiteSpaces(origRequest)));
} catch (Exception ex) {
AuthException ae = new AuthException();
ae.initCause(ex);
Expand All @@ -294,6 +275,7 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
request.setAttribute("errorText", GuiUtil.getMessage("alert.ConfigurationError"));
request.setAttribute("messageText", GuiUtil.getMessage("alert.EnableSecureAdmin"));
}

RequestDispatcher rd = request.getRequestDispatcher(this.loginErrorPage);
try {
rd.forward(request, response);
Expand All @@ -302,6 +284,7 @@ public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject
ae.initCause(ex);
throw ae;
}

return AuthStatus.SEND_FAILURE;
}
}
Expand All @@ -317,7 +300,6 @@ public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthEx
}

private boolean isMandatory(MessageInfo messageInfo) {
return Boolean.valueOf((String) messageInfo.getMap().get(
"jakarta.security.auth.message.MessagePolicy.isMandatory"));
return Boolean.valueOf((String) messageInfo.getMap().get("jakarta.security.auth.message.MessagePolicy.isMandatory"));
}
}
6 changes: 6 additions & 0 deletions appserver/appclient/client/acc/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2021 Contributors to Eclipse Foundation.
Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -345,6 +346,11 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>jakarta.authorization</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2021 Contributors to Eclipse Foundation.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -167,7 +168,6 @@ public ACCClassLoader(URL[] urls, ClassLoader parent) {
clientCLDelegate = new ClientClassLoaderDelegate(this);
}


private ACCClassLoader(URL[] urls, ClassLoader parent, boolean shouldTransform) {
this(urls, parent);
this.shouldTransform = shouldTransform;
Expand Down
Loading