use of org.jboss.wsf.spi.deployment.HttpEndpoint in project wildfly by wildfly.
the class WebMetaDataCreator method createSecurityConstraints.
/**
* Creates security constraints part of web.xml descriptor.
* <p/>
* <pre>
* <security-constraint>
* <web-resource-collection>
* <web-resource-name>EJBEndpointShortName</web-resource-name>
* <url-pattern>EJBEndpointURLPattern</url-pattern>
* <http-method>GET</http-method>
* <http-method>POST</http-method>
* </web-resource-collection>
* <auth-constraint>
* <role-name>*</role-name>
* </auth-constraint>
* <user-data-constraint>
* <transport-guarantee>EjbTransportGuarantee</transport-guarantee>
* </user-data-constraint>
* </security-constraint>
* </pre>
*
* @param dep webservice deployment
* @param jbossWebMD jboss web meta data
*/
private void createSecurityConstraints(final Deployment dep, final JBossWebMetaData jbossWebMD) {
WSLogger.ROOT_LOGGER.trace("Creating security constraints");
for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
final boolean secureWsdlAccess = ejb3SecurityAccessor.isSecureWsdlAccess(ejbEndpoint);
final String transportGuarantee = ejb3SecurityAccessor.getTransportGuarantee(ejbEndpoint);
final boolean hasTransportGuarantee = transportGuarantee != null;
final String authMethod = ejb3SecurityAccessor.getAuthMethod(ejbEndpoint);
final boolean hasAuthMethod = authMethod != null;
if (ejbEndpoint instanceof HttpEndpoint && (hasAuthMethod || hasTransportGuarantee)) {
final List<SecurityConstraintMetaData> securityConstraints = WebMetaDataHelper.getSecurityConstraints(jbossWebMD);
// security-constraint
final SecurityConstraintMetaData securityConstraint = WebMetaDataHelper.newSecurityConstraint(securityConstraints);
// web-resource-collection
final WebResourceCollectionsMetaData webResourceCollections = WebMetaDataHelper.getWebResourceCollections(securityConstraint);
final String endpointName = ejbEndpoint.getShortName();
final String urlPattern = ((HttpEndpoint) ejbEndpoint).getURLPattern();
WSLogger.ROOT_LOGGER.tracef("Creating web resource collection for endpoint: %s, URL pattern: %s", endpointName, urlPattern);
WebMetaDataHelper.newWebResourceCollection(endpointName, urlPattern, secureWsdlAccess, webResourceCollections);
// auth-constraint
if (hasAuthMethod) {
WSLogger.ROOT_LOGGER.tracef("Creating auth constraint for endpoint: %s", endpointName);
WebMetaDataHelper.newAuthConstraint(WebMetaDataHelper.getAllRoles(), securityConstraint);
}
// user-data-constraint
if (hasTransportGuarantee) {
WSLogger.ROOT_LOGGER.tracef("Creating new user data constraint for endpoint: %s, transport guarantee: %s", endpointName, transportGuarantee);
WebMetaDataHelper.newUserDataConstraint(transportGuarantee, securityConstraint);
}
}
}
}
use of org.jboss.wsf.spi.deployment.HttpEndpoint in project wildfly by wildfly.
the class WebMetaDataCreator method createServletMappings.
/**
* Creates servlet-mapping part of web.xml descriptor.
* <p/>
* <pre>
* <servlet-mapping>
* <servlet-name>EJBEndpointShortName</servlet-name>
* <url-pattern>EJBEndpointURLPattern</url-pattern>
* </servlet-mapping>
* </pre>
*
* @param dep webservice deployment
* @param jbossWebMD jboss web meta data
*/
private void createServletMappings(final Deployment dep, final JBossWebMetaData jbossWebMD) {
WSLogger.ROOT_LOGGER.trace("Creating servlet mappings");
final List<ServletMappingMetaData> servletMappings = WebMetaDataHelper.getServletMappings(jbossWebMD);
for (final Endpoint ep : dep.getService().getEndpoints()) {
if (ep instanceof HttpEndpoint) {
final String endpointName = ep.getShortName();
final List<String> urlPatterns = WebMetaDataHelper.getUrlPatterns(((HttpEndpoint) ep).getURLPattern());
WSLogger.ROOT_LOGGER.tracef("Servlet name: %s, URL patterns: %s", endpointName, urlPatterns);
WebMetaDataHelper.newServletMapping(endpointName, urlPatterns, servletMappings);
}
}
}
Aggregations