use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.
the class EjbContext method getHandlerChainContainers.
public HandlerChainContainer[] getHandlerChainContainers(boolean serviceSideHandlerChain, Class declaringClass) {
if (serviceSideHandlerChain) {
EjbDescriptor[] ejbs = getDescriptor().getEjbBundleDescriptor().getEjbByClassName(declaringClass.getName());
List<WebServiceEndpoint> result = new ArrayList<WebServiceEndpoint>();
for (EjbDescriptor ejb : ejbs) {
result.addAll(getDescriptor().getEjbBundleDescriptor().getWebServices().getEndpointsImplementedBy(ejb));
}
return (result.toArray(new HandlerChainContainer[result.size()]));
} else {
List<ServiceReferenceDescriptor> result = new ArrayList<ServiceReferenceDescriptor>();
result.addAll(getDescriptor().getEjbBundleDescriptor().getEjbServiceReferenceDescriptors());
return (result.toArray(new HandlerChainContainer[result.size()]));
}
}
use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.
the class AbstractAuthAnnotationHandler method postProcessAnnotation.
/**
* This method is for processing security annotation associated to ejb.
* Dervied class call this method may like to override
*
* protected void processEjbMethodSecurity(Annotation authAnnotation,
* MethodDescriptor md, EjbDescriptor ejbDesc)
*/
@Override
public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext) throws AnnotationProcessorException {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
Annotation authAnnotation = ainfo.getAnnotation();
if (!ejbContext.isInherited() && (ejbDesc.getMethodPermissionsFromDD() == null || ejbDesc.getMethodPermissionsFromDD().size() == 0)) {
for (MethodDescriptor md : getMethodAllDescriptors(ejbDesc)) {
processEjbMethodSecurity(authAnnotation, md, ejbDesc);
}
} else {
Class classAn = (Class) ainfo.getAnnotatedElement();
for (Object next : ejbDesc.getSecurityBusinessMethodDescriptors()) {
MethodDescriptor md = (MethodDescriptor) next;
// override by existing info
if (classAn.equals(ejbContext.getDeclaringClass(md)) && !hasMethodPermissionsFromDD(md, ejbDesc)) {
processEjbMethodSecurity(authAnnotation, md, ejbDesc);
}
}
}
}
use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.
the class RunAsHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
RunAs runAsAn = (RunAs) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
// override by xml
if (ejbDesc.getUsesCallerIdentity() != null) {
continue;
}
String roleName = runAsAn.value();
Role role = new Role(roleName);
// add Role if not exists
ejbDesc.getEjbBundleDescriptor().addRole(role);
RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor();
runAsDesc.setRoleName(roleName);
ejbDesc.setUsesCallerIdentity(false);
if (ejbDesc.getRunAsIdentity() == null) {
ejbDesc.setRunAsIdentity(runAsDesc);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.
the class CSIV2TaggedComponentInfo method getEjbDescriptor.
public EjbDescriptor getEjbDescriptor(IORInfo iorInfo) {
CSIv2Policy csiv2Policy = null;
try {
csiv2Policy = (CSIv2Policy) iorInfo.get_effective_policy(orbHelper.getCSIv2PolicyType());
} catch (INV_POLICY ex) {
logger.log(FINE, "CSIV2TaggedComponentInfo.getEjbDescriptor: CSIv2Policy not present");
}
// Add CSIv2 tagged component for this EJB type.
if (logger.isLoggable(FINE)) {
logger.log(FINE, "TxSecIORInterceptor.establish_components: CSIv2Policy: " + csiv2Policy);
}
EjbDescriptor ejbDesc = null;
if (csiv2Policy != null) {
ejbDesc = csiv2Policy.getEjbDescriptor();
}
return ejbDesc;
}
use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.
the class SecurityMechanismSelector method evaluate_client_conformance.
/**
* Evaluates a client's conformance to the security policies configured on the target. Returns true
* if conformant to the security policies otherwise return false.
*
* Conformance checking is done as follows: First, the object_id is mapped to the set of
* EjbIORConfigurationDescriptor. Each EjbIORConfigurationDescriptor corresponds to a single
* CompoundSecMechanism of the CSIv2 spec. A client is considered to be conformant if a
* CompoundSecMechanism consistent with the client's actions is found i.e. transport_mech,
* as_context_mech and sas_context_mech must all be consistent.
*/
private boolean evaluate_client_conformance(SecurityContext ctx, byte[] object_id, boolean ssl_used, X509Certificate[] certchain) {
if (object_id == null)
return true;
if (protocolMgr == null)
protocolMgr = orbHelper.getProtocolManager();
// is on a callback object in the client VM.
if (protocolMgr == null)
return true;
EjbDescriptor ejbDesc = protocolMgr.getEjbDescriptor(object_id);
Set iorDescSet = null;
if (ejbDesc != null) {
iorDescSet = ejbDesc.getIORConfigurationDescriptors();
} else {
// Probably a non-EJB CORBA object.
// Create a temporary EjbIORConfigurationDescriptor.
iorDescSet = getCorbaIORDescSet();
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: iorDescSet: " + iorDescSet);
}
/*
* if there are no IORConfigurationDescriptors configured, then no security policy is configured. So
* consider the client to be conformant.
*/
if (iorDescSet.isEmpty())
return true;
// go through each EjbIORConfigurationDescriptor trying to find
// a find a CompoundSecMechanism that matches client's actions.
boolean checkSkipped = false;
for (Iterator itr = iorDescSet.iterator(); itr.hasNext(); ) {
EjbIORConfigurationDescriptor iorDesc = (EjbIORConfigurationDescriptor) itr.next();
if (skip_client_conformance(iorDesc)) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: skip_client_conformance");
}
checkSkipped = true;
continue;
}
if (!evaluate_client_conformance_ssl(iorDesc, ssl_used, certchain)) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_ssl");
}
checkSkipped = false;
continue;
}
String realmName = "default";
if (ejbDesc != null && ejbDesc.getApplication() != null) {
realmName = ejbDesc.getApplication().getRealm();
}
if (realmName == null) {
realmName = iorDesc.getRealmName();
}
if (realmName == null) {
realmName = "default";
}
if (!evaluate_client_conformance_ascontext(ctx, iorDesc, realmName)) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_ascontext");
}
checkSkipped = false;
continue;
}
if (!evaluate_client_conformance_sascontext(ctx, iorDesc)) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_sascontext");
}
checkSkipped = false;
continue;
}
// security policy matched.
return true;
}
if (checkSkipped)
return true;
// No matching security policy found
return false;
}
Aggregations