(runAs.getRoleName() == null || runAs.getRoleName().length() == 0)) { DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment.backend.emptyRoleName"); (runAs.getPrincipal() == null || runAs.getPrincipal().length() == 0) && application != null && application.getRoleMapper() != null) { String roleName = runAs.getRoleName(); " is not mapped to a principal."); runAs.setPrincipal(principalName);
@Override public RunAsIdentityDescriptor getDescriptor() { if (descriptor == null) descriptor = new RunAsIdentityDescriptor(); return descriptor; }
public EJBSecurityManager(EjbDescriptor ejbDescriptor, InvocationManager invMgr, EJBSecurityManagerFactory fact) throws Exception { this.deploymentDescriptor = (EjbDescriptor) ejbDescriptor; this.invMgr = invMgr; roleMapperFactory = SecurityUtil.getRoleMapperFactory(); // get the default policy policy = Policy.getPolicy(); ejbSFM = fact; boolean runas = !(deploymentDescriptor.getUsesCallerIdentity()); if (runas) { runAs = deploymentDescriptor.getRunAsIdentity(); // Note: runAs may be null even when runas==true if this EJB // is an MDB. if (runAs != null) { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, deploymentDescriptor.getEjbClassName() + " will run-as: " + runAs.getPrincipal() + " (" + runAs.getRoleName() + ")"); } } } else { runAs = null; } initialize(); }
public Object run() { LoginContextDriver.loginPrincipal(runAs.getPrincipal(), realmName); return null; } });
new RunAsIdentityDescriptor(); runAsDesc.setRoleName(roleName); wcd.setRunAsIdentity(runAsDesc);
@Override public Node writeDescriptor(Node parent, String nodeName, RunAsIdentityDescriptor descriptor) { Node subNode = super.writeDescriptor(parent, nodeName, descriptor); writeLocalizedDescriptions(subNode, descriptor); appendTextChild(subNode, TagNames.ROLE_NAME, descriptor.getRoleName()); return subNode; }
/** * receives notification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { String name = element.getQName(); if (name.equals(RuntimeTagNames.SERVLET_NAME)) { Object parentDesc = ((WLWebBundleRuntimeNode)getParentNode()).getDescriptor(); if (parentDesc instanceof WebBundleDescriptor) { descriptor = ((WebBundleDescriptor)parentDesc).getWebComponentByCanonicalName(value); } } else if (name.equals(RuntimeTagNames.RUN_AS_PRINCIPAL_NAME)) { if (descriptor != null && descriptor.getRunAsIdentity() != null) { descriptor.getRunAsIdentity().setPrincipal(value); } } else { super.setElementValue(element, value); } }
/** * This method iniitalizes the EJBSecurityManager */ public EJBSecurityManager(EjbDescriptor ejbDescriptor, InvocationManager invMgr, EJBSecurityManagerFactory fact) throws Exception { this.deploymentDescriptor = (EjbDescriptor) ejbDescriptor; this.invMgr = invMgr; roleMapperFactory = Globals.get(SecurityRoleMapperFactory.class); // get the default policy policy = Policy.getPolicy(); ejbSFM = fact; boolean runas = !(deploymentDescriptor.getUsesCallerIdentity()); if (runas) { runAs = deploymentDescriptor.getRunAsIdentity(); // Note: runAs may be null even when runas==true if this EJB // is an MDB. if (runAs != null) { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, deploymentDescriptor.getEjbClassName() + " will run-as: " + runAs.getPrincipal() + " (" + runAs.getRoleName() + ")"); } } } else { runAs = null; } initialize(); }
public Object run() { LoginContextDriver.loginPrincipal(runAs.getPrincipal(), realmName); return null; } });
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, WebComponentContext[] webCompContexts) throws AnnotationProcessorException { RunAs runAsAn = (RunAs)ainfo.getAnnotation(); for (WebComponentContext webCompContext : webCompContexts) { WebComponentDescriptor webDesc = webCompContext.getDescriptor(); // override by xml if (webDesc.getRunAsIdentity() != null) { continue; } String roleName = runAsAn.value(); Role role = new Role(roleName); // add Role if not exists webDesc.getWebBundleDescriptor().addRole(role); RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor(); runAsDesc.setRoleName(roleName); webDesc.setRunAsIdentity(runAsDesc); } return getDefaultProcessedResult(); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element for this DOM tree fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, RunAsIdentityDescriptor descriptor) { Node subNode = super.writeDescriptor(parent, nodeName, descriptor); writeLocalizedDescriptions(subNode, descriptor); appendTextChild(subNode, EjbTagNames.ROLE_NAME, descriptor.getRoleName()); return subNode; }
/** * receives notiification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (RuntimeTagNames.SERVLET_NAME.equals(element.getQName())) { Object parentDesc = ((WebBundleRuntimeNode) getParentNode()).getWebBundleDescriptor(); if (parentDesc instanceof WebBundleDescriptor) { descriptor = ((WebBundleDescriptor) parentDesc).getWebComponentByCanonicalName(value); } } else if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) { if (descriptor!=null && descriptor.getRunAsIdentity()!=null) { descriptor.getRunAsIdentity().setPrincipal(value); } } else super.setElementValue(element, value); }
"identity)"); } else { String role = runas.getRoleName(); String user = runas.getPrincipal(); logger.finest(" Will run-as: Role: " + role + " Principal: " + user); (RunAsIdentityDescriptor)wcd.getRunAsIdentity(); if (runas!=null) { String role = runas.getRoleName(); String user = runas.getPrincipal(); logger.finest(" Will run-as: Role: " + role + " Principal: " + user);
(runAs.getRoleName() == null || runAs.getRoleName().length() == 0)) { DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment.backend.emptyRoleName"); (runAs.getPrincipal() == null || runAs.getPrincipal().length() == 0) && application != null && application.getRoleMapper() != null) { String roleName = runAs.getRoleName(); " is not mapped to a principal."); runAs.setPrincipal(principalName);
String principal = runAsDescriptor.getPrincipal(); String servlet = wcd.getCanonicalName();
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, WebComponentContext[] webCompContexts) throws AnnotationProcessorException { RunAs runAsAn = (RunAs)ainfo.getAnnotation(); for (WebComponentContext webCompContext : webCompContexts) { WebComponentDescriptor webDesc = webCompContext.getDescriptor(); // override by xml if (webDesc.getRunAsIdentity() != null) { continue; } String roleName = runAsAn.value(); Role role = new Role(roleName); // add Role if not exists webDesc.getWebBundleDescriptor().addRole(role); RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor(); runAsDesc.setRoleName(roleName); webDesc.setRunAsIdentity(runAsDesc); } return getDefaultProcessedResult(); }
wrapper.setRunAs(webComponentDesc.getRunAsIdentity().getRoleName());
descriptor.getRunAsIdentity().setPrincipal(value);
public void setUsesCallerIdentity(boolean isCallerID) { if (isCallerID) { runAs = null; } else { runAs = new RunAsIdentityDescriptor(""); } }
"identity)"); } else { String role = runas.getRoleName(); String user = runas.getPrincipal(); logger.finest(" Will run-as: Role: " + role + " Principal: " + user); (RunAsIdentityDescriptor)wcd.getRunAsIdentity(); if (runas!=null) { String role = runas.getRoleName(); String user = runas.getPrincipal(); logger.finest(" Will run-as: Role: " + role + " Principal: " + user);