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

Fish 8925 adding epicyro implementation #7068

Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
94296f9
FISH-8925: starting changes to use epicyro
breakponchito Oct 31, 2024
911a08b
Security API downgrade shim
Pandrex247 Nov 13, 2024
b51a9ff
FISH-8925: rebasing last changes from Payara7 branch
breakponchito Oct 31, 2024
21a1a22
Merge remote-tracking branch 'origin/FISH-8925-adding-epicyro-impleme…
breakponchito Nov 14, 2024
5627fea
FISH-8925: introducing epicyro for jakarta authentication in payara 7
breakponchito Nov 15, 2024
70835b7
FISH-9630 Use UserPrincipal instead of PrincipalImpl
kalinchan Nov 15, 2024
78126c4
Correct comment name
Pandrex247 Nov 15, 2024
79f2fd8
Add soteria downgrade shim
Pandrex247 Nov 15, 2024
9afed1f
Bundle name correction and missing ';'
Pandrex247 Nov 15, 2024
345626f
Merge pull request #7069 from kalinchan/FISH-9630
kalinchan Nov 18, 2024
d8175ad
FISH-8925: fixing osgi issues and adding more changes tu run authenti…
breakponchito Nov 19, 2024
cd530f5
FISH-9165 : upgrade jaxb version to 4.0.2
luiseufrasio Nov 20, 2024
89b45e2
Merge pull request #7076 from luiseufrasio/FISH-9165-update-jakarta-x…
luiseufrasio Nov 20, 2024
de796c9
Merge pull request #7066 from Pandrex247/Add-Security-Downgrade-Shim
Pandrex247 Nov 21, 2024
a8ab4fe
FISH-8925: trying to fix error to render pages
breakponchito Nov 26, 2024
81c94f9
FISH-8925: trying to set starting policy factory for exousia
breakponchito Nov 27, 2024
5c0b928
FISH-8925: partially load of resources for admin console page
breakponchito Nov 28, 2024
6cfd0bf
FISH-8925: rebasing last changes from Payara7 branch
breakponchito Oct 31, 2024
45b26bd
FISH-8925: rebasing changes
breakponchito Oct 31, 2024
6f2192b
FISH-8925: introducing epicyro for jakarta authentication in payara 7
breakponchito Nov 15, 2024
9d483a6
FISH-8925: fixing osgi issues and adding more changes tu run authenti…
breakponchito Nov 19, 2024
ff2e31a
FISH-8925: trying to fix error to render pages
breakponchito Nov 26, 2024
97caef7
FISH-8925: trying to set starting policy factory for exousia
breakponchito Nov 27, 2024
5109bce
FISH-8925: partially load of resources for admin console page
breakponchito Nov 28, 2024
920e923
FISH-8925: fixing changes when merging
breakponchito Nov 28, 2024
849ced3
Fix missing imports
Pandrex247 Nov 28, 2024
82d3522
Fix renamed javadoc param
Pandrex247 Nov 28, 2024
a74838b
Fix incorrect record method names
Pandrex247 Nov 28, 2024
398dcbb
Fix incorrect javadoc
Pandrex247 Nov 28, 2024
7c726c4
Remove unused imports
Pandrex247 Nov 28, 2024
58c6d12
Remove usage of security manager
Pandrex247 Nov 28, 2024
4ebe367
Remove unused imports
Pandrex247 Nov 28, 2024
d600f29
FISH-8925: changes to fix callback handler credentials validation and…
breakponchito Nov 28, 2024
cf189d1
Don't exclude from semantic versioning
Pandrex247 Dec 2, 2024
3032e36
FISH-8925: fix for invalid reference for policy and code removals for…
breakponchito Dec 3, 2024
8f2d603
Merge branch 'FISH-8925-adding-epicyro-implementation' of https://git…
breakponchito Dec 3, 2024
ffb2f27
FISH-8925: fixing deployment issue for applications
breakponchito Dec 4, 2024
26b052d
FISH-8925: skipping failing tests from quicklook
breakponchito Dec 4, 2024
092f1b6
Correct property name
Pandrex247 Dec 4, 2024
8aa5e8b
Update embedded domain.xml
Pandrex247 Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate">
<property value="true" name="certificate-validation"/>
</auth-realm>
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -279,6 +279,7 @@
<!-- Hotswap Agent -->
<jvm-options>[Dynamic Code Evolution-11.0.10|]-XX:HotswapAgent=core</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-Xlog:redefine+class*=info</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down Expand Up @@ -377,7 +378,7 @@
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate">
<property name="certificate-validation" value="true" />
</auth-realm>
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -516,6 +517,7 @@
<!-- Hotswap Agent -->
<jvm-options>[Dynamic Code Evolution-11.0.10|]-XX:HotswapAgent=core</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-Xlog:redefine+class*=info</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate">
<property value="true" name="certificate-validation"/>
</auth-realm>
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -274,6 +274,7 @@
<!-- Hotswap Agent -->
<jvm-options>[Dynamic Code Evolution-11.0.10|]-XX:HotswapAgent=core</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-Xlog:redefine+class*=info</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down Expand Up @@ -368,7 +369,7 @@
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate">
<property value="true" name="certificate-validation"/>
</auth-realm>
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -506,6 +507,7 @@
<!-- Hotswap Agent -->
<jvm-options>[Dynamic Code Evolution-11.0.10|]-XX:HotswapAgent=core</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-Xlog:redefine+class*=info</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<property value="fileRealm" name="jaas-context" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -225,6 +225,7 @@
<jvm-options>-Xbootclasspath/a:${com.sun.aas.installRoot}/lib/grizzly-npn-api.jar</jvm-options>
<!-- allow asadmin command enable-monitoring -->
<jvm-options>-Djdk.attach.allowAttachSelf=true</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down Expand Up @@ -328,7 +329,7 @@
<property name="jaas-context" value="fileRealm" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />
<jacc-provider policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default" policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -438,6 +439,7 @@
<jvm-options>-Dorg.jboss.weld.serialization.beanIdentifierIndexOptimization=false</jvm-options>
<!-- Grizzly NPN Bootstrap compatible with used JDK version -->
<jvm-options>-Xbootclasspath/a:${com.sun.aas.installRoot}/lib/grizzly-npn-api.jar</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<property value="fileRealm" name="jaas-context" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />
<jacc-provider policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl" policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -248,6 +248,7 @@
<jvm-options>-Xbootclasspath/a:${com.sun.aas.installRoot}/lib/grizzly-npn-api.jar</jvm-options>
<!-- allow asadmin command enable-monitoring -->
<jvm-options>-Djdk.attach.allowAttachSelf=true</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down Expand Up @@ -346,7 +347,7 @@
<property name="jaas-context" value="fileRealm" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />
<jacc-provider policy-provider="fish.payara.security.jacc.provider.PolicyProviderImpl" name="default" policy-configuration-factory-provider="fish.payara.security.jacc.provider.PolicyConfigurationFactoryImpl"></jacc-provider>
<jacc-provider policy-provider="org.glassfish.exousia.modules.def.DefaultPolicy" name="default" policy-configuration-factory-provider="org.glassfish.exousia.modules.def.DefaultPolicyConfigurationFactory"></jacc-provider>
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
Expand Down Expand Up @@ -455,6 +456,7 @@
<jvm-options>-Dorg.jboss.weld.serialization.beanIdentifierIndexOptimization=false</jvm-options>
<!-- Grizzly NPN Bootstrap compatible with used JDK version -->
<jvm-options>-Xbootclasspath/a:${com.sun.aas.installRoot}/lib/grizzly-npn-api.jar</jvm-options>
<jvm-options>-Djakarta.security.jacc.policy.provider=org.glassfish.exousia.modules.def.DefaultPolicy</jvm-options>
</java-config>
<availability-service>
<web-container-availability />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package org.glassfish.admingui.common.security;

Expand Down Expand Up @@ -244,9 +244,7 @@ public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthEx

private AuthStatus doNothing(Subject clientSubject) throws AuthException {
try {
// The JASPIC protocol for "do nothing"
handler.handle(new Callback[] { new CallerPrincipalCallback(clientSubject, (Principal) null) });

return SUCCESS;
} catch (IOException | UnsupportedCallbackException e) {
throw (AuthException) new AuthException().initCause(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@
* holder.
*/

// Portions Copyright [2024] [Payara Foundation and/or its affiliates]

package org.glassfish.appclient.client.acc;

import com.sun.enterprise.container.common.spi.util.InjectionException;
import com.sun.enterprise.container.common.spi.util.InjectionManager;
import com.sun.enterprise.deployment.ApplicationClientDescriptor;
import com.sun.enterprise.security.appclient.integration.AppClientSecurityInfo;
import jakarta.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
Expand All @@ -53,17 +56,13 @@
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.inject.Inject;
import javax.security.auth.callback.CallbackHandler;
import org.glassfish.appclient.client.acc.config.ClientCredential;
import org.glassfish.appclient.client.acc.config.MessageSecurityConfig;
import org.glassfish.appclient.client.acc.config.TargetServer;
//import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;

import org.jvnet.hk2.annotations.Service;
import org.glassfish.hk2.api.PerLookup;
import org.jvnet.hk2.annotations.Service;

/**
*
Expand All @@ -83,26 +82,22 @@ public class AppClientContainerSecurityHelper {

private ClassLoader classLoader;

void init(
final TargetServer[] targetServers,
final List<MessageSecurityConfig> msgSecConfigs,
final Properties containerProperties,
final ClientCredential clientCredential,
final CallbackHandler callerSuppliedCallbackHandler,
final ClassLoader classLoader,
final ApplicationClientDescriptor acDesc,
final boolean isTextAuth) throws InstantiationException, IllegalAccessException, InjectionException, ClassNotFoundException, IOException {
void init(final TargetServer[] targetServers, final List<MessageSecurityConfig> msgSecConfigs,
final Properties containerProperties, final ClientCredential clientCredential,
final CallbackHandler callerSuppliedCallbackHandler, final ClassLoader classLoader,
final ApplicationClientDescriptor acDesc, final boolean isTextAuth)
throws InstantiationException, IllegalAccessException, InjectionException, ClassNotFoundException, IOException {

this.classLoader = (classLoader == null) ? Thread.currentThread().getContextClassLoader() : classLoader;

initLoginConfig();
CallbackHandler callbackHandler =
initSecurity(callerSuppliedCallbackHandler, acDesc);

secInfo.initializeSecurity(Arrays.asList(targetServers),
secInfo.initializeSecurity(
Arrays.asList(targetServers),
msgSecConfigs,
callbackHandler,
AppClientSecurityInfo.CredentialType.USERNAME_PASSWORD,
(clientCredential == null ? null : clientCredential.getUserName()),
(clientCredential == null ||
clientCredential.getPassword() == null ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,42 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2021] [Payara Foundation]
// Portions Copyright [2016-2024] [Payara Foundation]

package com.sun.enterprise.container.common.impl.managedbean;

import com.sun.enterprise.container.common.spi.InterceptorInvoker;
import com.sun.enterprise.container.common.spi.JCDIService;
import com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilder;
import com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilderFactory;
import com.sun.enterprise.container.common.spi.ManagedBeanManager;
import com.sun.enterprise.container.common.spi.util.ComponentEnvManager;
import com.sun.enterprise.container.common.spi.util.InjectionManager;
import com.sun.enterprise.container.common.spi.util.InterceptorInfo;
import com.sun.enterprise.deployment.Application;
import com.sun.enterprise.deployment.ApplicationClientDescriptor;
import com.sun.enterprise.deployment.BundleDescriptor;
import com.sun.enterprise.deployment.EjbBundleDescriptor;
import com.sun.enterprise.deployment.EjbDescriptor;
import com.sun.enterprise.deployment.InterceptorDescriptor;
import com.sun.enterprise.deployment.JndiNameEnvironment;
import com.sun.enterprise.deployment.LifecycleCallbackDescriptor;
import com.sun.enterprise.deployment.ManagedBeanDescriptor;
import com.sun.enterprise.deployment.WebBundleDescriptor;
import com.sun.logging.LogDomains;
import jakarta.inject.Inject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import jakarta.inject.Inject;
import javax.naming.InitialContext;

import org.glassfish.api.admin.ProcessEnvironment;
import org.glassfish.api.admin.ProcessEnvironment.ProcessType;
import org.glassfish.api.event.EventListener;
Expand All @@ -72,26 +87,6 @@
import org.glassfish.internal.deployment.Deployment;
import org.jvnet.hk2.annotations.Service;

import com.sun.enterprise.container.common.spi.InterceptorInvoker;
import com.sun.enterprise.container.common.spi.JCDIService;
import com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilder;
import com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilderFactory;
import com.sun.enterprise.container.common.spi.ManagedBeanManager;
import com.sun.enterprise.container.common.spi.util.ComponentEnvManager;
import com.sun.enterprise.container.common.spi.util.InjectionManager;
import com.sun.enterprise.container.common.spi.util.InterceptorInfo;
import com.sun.enterprise.deployment.Application;
import com.sun.enterprise.deployment.ApplicationClientDescriptor;
import com.sun.enterprise.deployment.BundleDescriptor;
import com.sun.enterprise.deployment.EjbBundleDescriptor;
import com.sun.enterprise.deployment.EjbDescriptor;
import com.sun.enterprise.deployment.InterceptorDescriptor;
import com.sun.enterprise.deployment.JndiNameEnvironment;
import com.sun.enterprise.deployment.LifecycleCallbackDescriptor;
import com.sun.enterprise.deployment.ManagedBeanDescriptor;
import com.sun.enterprise.deployment.WebBundleDescriptor;
import com.sun.logging.LogDomains;

/**
*/
@Service(name="ManagedBeanManagerImpl")
Expand Down Expand Up @@ -623,14 +618,9 @@ public void destroyManagedBean(Object managedBean, boolean validate) {

Field proxyField = managedBean.getClass().getDeclaredField("__ejb31_delegate");

final Field finalF = proxyField;
PrivilegedExceptionAction<Void> action = () -> {
if (!finalF.isAccessible()) {
finalF.setAccessible(true);
}
return null;
};
AccessController.doPrivileged(action);
if (!proxyField.isAccessible()) {
proxyField.setAccessible(true);
}

Proxy proxy = (Proxy) proxyField.get(managedBean);

Expand Down
Loading