WebServiceSecurityType wsSecurity = wsBinding.getWebServiceSecurity();
if (wsSecurity != null) {
earContext.setHasSecurity(true);
String policyContextID = sessionName.toString();
Properties properties = wsSecurity.getProperties();
PermissionCollection uncheckedPermissions = new Permissions();
String transportGuarantee = wsSecurity.getTransportGuarantee().toString().trim();
boolean getProtected = properties.get("getProtected") == null? true: Boolean.valueOf((String) properties.get("getProtected"));
if (getProtected) {
WebUserDataPermission webUserDataPermission = new WebUserDataPermission("/*", null, transportGuarantee);
uncheckedPermissions.add(webUserDataPermission);
} else {
uncheckedPermissions.add(new WebUserDataPermission("/*", new String[] {"GET"}, "NONE"));
uncheckedPermissions.add(new WebUserDataPermission("/*", "!GET:" + transportGuarantee));
}
Map<String, PermissionCollection> rolePermissions = new HashMap<String, PermissionCollection>();
//TODO allow jaspi authentication
boolean secured = wsSecurity.getAuthMethod() != null && AuthMethodType.NONE != (wsSecurity.getAuthMethod());// || wsSecurity.isSetAuthentication();
if (secured) {
boolean getSecured = properties.get("getSecured") == null? true: Boolean.valueOf((String) properties.get("getSecured"));
if (!getSecured) {
uncheckedPermissions.add(new WebResourcePermission("/*", "GET"));
}
} else {
uncheckedPermissions.add(new WebResourcePermission("/*", (String[]) null));
}
ComponentPermissions permissions = new ComponentPermissions(new Permissions(), uncheckedPermissions, rolePermissions);
earContext.addSecurityContext(policyContextID, permissions);
}
}
}