JBossWS SVN: r19076 - in container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices: metadata and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-11-07 03:12:33 -0500 (Fri, 07 Nov 2014)
New Revision: 19076
Modified:
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_EJB.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/EJBEndpoint.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java
Log:
[JBWS-2680]:Fix authentication realm name hard-coded as "EJBServiceEndpointServlet Realm"
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_EJB.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_EJB.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSIntegrationProcessorJAXWS_EJB.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -94,12 +94,12 @@
final boolean isSecureWsdlAccess = webCtx.isSecureWsdlAccess();
final String transportGuarantee = webCtx.getTransportGuarantee();
-
+ final String realmName = webCtx.getRealmName();
for (final SessionBeanComponentDescription sessionBean : sessionBeans) {
if (sessionBean.isStateless() || sessionBean.isSingleton()) {
final EJBViewDescription ejbViewDescription = sessionBean.addWebserviceEndpointView();
final ServiceName ejbViewName = ejbViewDescription.getServiceName();
- jaxwsDeployment.addEndpoint(new EJBEndpoint(sessionBean, ejbViewName, securityRoles, authMethod, isSecureWsdlAccess, transportGuarantee));
+ jaxwsDeployment.addEndpoint(new EJBEndpoint(sessionBean, ejbViewName, securityRoles, authMethod, realmName, isSecureWsdlAccess, transportGuarantee));
}
}
}
@@ -181,10 +181,11 @@
private final String authMethod;
private final String transportGuarantee;
private final boolean secureWsdlAccess;
-
+ private final String realmName;
WebContextAnnotationWrapper(final AnnotationInstance annotation) {
authMethod = stringValueOrNull(annotation, "authMethod");
transportGuarantee = stringValueOrNull(annotation, "transportGuarantee");
+ realmName = stringValueOrNull(annotation, "realmName");
secureWsdlAccess = booleanValue(annotation, "secureWSDLAccess");
}
@@ -200,6 +201,10 @@
return secureWsdlAccess;
}
+ String getRealmName() {
+ return realmName;
+ }
+
private String stringValueOrNull(final AnnotationInstance annotation, final String attribute) {
if (annotation == null) return null;
final AnnotationValue value = annotation.value(attribute);
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/AbstractMetaDataBuilderEJB.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -144,8 +144,9 @@
final String transportGuarantee = getTransportGuarantee(ejbEndpoint, portComponentMD);
// secure wsdl access
final boolean secureWsdlAccess = isSecureWsdlAccess(ejbEndpoint, portComponentMD);
+ final String realmName = getRealmName(ejbEndpoint, portComponentMD);
// propagate
- wsEjbMDBuilder.setSecurityMetaData(new EJBSecurityMetaData(authMethod, transportGuarantee, secureWsdlAccess));
+ wsEjbMDBuilder.setSecurityMetaData(new EJBSecurityMetaData(authMethod, realmName, transportGuarantee, secureWsdlAccess));
wsEjbsMD.add(wsEjbMDBuilder.build());
}
@@ -165,4 +166,9 @@
return (portComponentMD != null && portComponentMD.getSecureWSDLAccess() != null) ? portComponentMD.getSecureWSDLAccess() : false;
}
+ private static String getRealmName(final EJBEndpoint ejbEndpoint, final JBossPortComponentMetaData portComponentMD) {
+ if (ejbEndpoint.getRealmName() != null) return ejbEndpoint.getRealmName();
+ return portComponentMD != null ? portComponentMD.getRealmName() : null;
+ }
+
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/EJBEndpoint.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/EJBEndpoint.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/metadata/model/EJBEndpoint.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -38,12 +38,14 @@
private final String authMethod;
private final boolean secureWsdlAccess;
private final String transportGuarantee;
-
- public EJBEndpoint(final SessionBeanComponentDescription ejbMD, final ServiceName viewName, final Set<String> declaredSecurityRoles, final String authMethod, final boolean secureWsdlAccess, final String transportGuarantee) {
+ private final String realmName;
+
+ public EJBEndpoint(final SessionBeanComponentDescription ejbMD, final ServiceName viewName, final Set<String> declaredSecurityRoles, final String authMethod, final String realmName, final boolean secureWsdlAccess, final String transportGuarantee) {
super(ejbMD.getComponentName(), ejbMD.getComponentClassName(), viewName);
this.ejbMD = ejbMD;
this.declaredSecurityRoles = declaredSecurityRoles;
this.authMethod = authMethod;
+ this.realmName = realmName;
this.secureWsdlAccess = secureWsdlAccess;
this.transportGuarantee = transportGuarantee;
}
@@ -76,6 +78,9 @@
return transportGuarantee;
}
+ public String getRealmName() {
+ return realmName;
+ }
public ServiceName getEJBViewMethodSecurityAttributesService() {
return EJBViewMethodSecurityAttributesService.getServiceName(ejbMD.getApplicationName(), ejbMD.getModuleName(), ejbMD.getEJBName(), getClassName());
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/AbstractSecurityMetaDataAccessorEJB.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -140,6 +140,11 @@
return hasEjbSecurityMD ? ejbSecurityMD.getTransportGuarantee() : null;
}
+ public String getRealmName(final Endpoint endpoint) {
+ final EJBSecurityMetaData ejbSecurityMD = this.getEjbSecurityMetaData(endpoint);
+ final boolean hasEjbSecurityMD = ejbSecurityMD != null;
+ return hasEjbSecurityMD ? ejbSecurityMD.getRealmName() : null;
+ }
/**
* Gets EJB security meta data if associated with EJB endpoint.
*
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/SecurityMetaDataAccessorEJB.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -71,4 +71,11 @@
* @return transport guarantee or null if not specified
*/
String getTransportGuarantee(Endpoint endpoint);
+ /**
+ * Gets realm name for protect resource
+ *
+ * @param endpoint webservice EJB endpoint
+ * @return realm name or null if not specified
+ */
+ String getRealmName(Endpoint endpoint);
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java 2014-11-06 17:03:21 UTC (rev 19075)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java 2014-11-07 08:12:33 UTC (rev 19076)
@@ -267,11 +267,15 @@
private void createLoginConfig(final Deployment dep, final JBossWebMetaData jbossWebMD) {
final String authMethod = getAuthMethod(dep);
final boolean hasAuthMethod = authMethod != null;
-
+ final String realmName = getRealmName(dep);
if (hasAuthMethod) {
ROOT_LOGGER.creatingLoginConfig(EJB_WEBSERVICE_REALM, authMethod);
final LoginConfigMetaData loginConfig = WebMetaDataHelper.getLoginConfig(jbossWebMD);
- loginConfig.setRealmName(WebMetaDataCreator.EJB_WEBSERVICE_REALM);
+ if (realmName != null) {
+ loginConfig.setRealmName(realmName);
+ } else {
+ loginConfig.setRealmName(WebMetaDataCreator.EJB_WEBSERVICE_REALM);
+ }
loginConfig.setAuthMethod(authMethod);
}
}
@@ -344,4 +348,14 @@
return null;
}
+ private String getRealmName(final Deployment dep) {
+ for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
+ final String realmName = ejb3SecurityAccessor.getRealmName(ejbEndpoint);
+ final boolean hasRealmName = realmName != null;
+ if (hasRealmName) {
+ return realmName;
+ }
+ }
+ return null;
+ }
}