use of org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method create.
/**
* Builds universal JSE meta data model that is AS agnostic.
*
* @param dep webservice deployment
* @return universal JSE meta data model
*/
JSEArchiveMetaData create(final Deployment dep) {
if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
WSLogger.ROOT_LOGGER.tracef("Creating JBoss agnostic meta data for POJO webservice deployment: %s", dep.getSimpleName());
}
final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep, JBossWebMetaData.class);
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
final List<POJOEndpoint> pojoEndpoints = getPojoEndpoints(unit);
final JSEArchiveMetaData.Builder builder = new JSEArchiveMetaData.Builder();
// set context root
final String contextRoot = getContextRoot(dep, jbossWebMD);
builder.setContextRoot(contextRoot);
WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
// set servlet url patterns mappings
final Map<String, String> servletMappings = getServletUrlPatternsMappings(jbossWebMD, pojoEndpoints);
builder.setServletMappings(servletMappings);
// set servlet class names mappings
final Map<String, String> servletClassNamesMappings = getServletClassMappings(jbossWebMD, pojoEndpoints);
builder.setServletClassNames(servletClassNamesMappings);
// set security domain
final String securityDomain = jbossWebMD.getSecurityDomain();
builder.setSecurityDomain(securityDomain);
// set wsdl location resolver
final JBossWebservicesMetaData jbossWebservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
if (jbossWebservicesMD != null) {
final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(jbossWebservicesMD.getWebserviceDescriptions());
builder.setPublishLocationAdapter(resolver);
}
// set security meta data
final List<JSESecurityMetaData> jseSecurityMDs = getSecurityMetaData(jbossWebMD.getSecurityConstraints());
builder.setSecurityMetaData(jseSecurityMDs);
// set config name and file
setConfigNameAndFile(builder, jbossWebMD, jbossWebservicesMD);
return builder.build();
}
use of org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method getSecurityMetaData.
/**
* Builds security meta data.
*
* @param securityConstraintsMD security constraints meta data
* @return universal JSE security meta data model
*/
private List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraintsMD) {
final List<JSESecurityMetaData> jseSecurityMDs = new LinkedList<JSESecurityMetaData>();
if (securityConstraintsMD != null) {
for (final SecurityConstraintMetaData securityConstraintMD : securityConstraintsMD) {
final JSESecurityMetaData.Builder jseSecurityMDBuilder = new JSESecurityMetaData.Builder();
// transport guarantee
jseSecurityMDBuilder.setTransportGuarantee(securityConstraintMD.getTransportGuarantee().name());
// web resources
for (final WebResourceCollectionMetaData webResourceMD : securityConstraintMD.getResourceCollections()) {
jseSecurityMDBuilder.addWebResource(webResourceMD.getName(), webResourceMD.getUrlPatterns());
}
jseSecurityMDs.add(jseSecurityMDBuilder.build());
}
}
return jseSecurityMDs;
}
Aggregations