@Override public String getTimedObjectId() { return deploymentString + "." + ejbComponent.getValue().getComponentName(); }
protected <T> T createViewInstanceProxy(final Class<T> viewInterface, final Map<Object, Object> contextData) { if (viewInterface == null) throw EjbLogger.ROOT_LOGGER.viewInterfaceCannotBeNull(); if (viewServices.containsKey(viewInterface.getName())) { final ServiceName serviceName = viewServices.get(viewInterface.getName()); return createViewInstanceProxy(viewInterface, contextData, serviceName); } else { throw EjbLogger.ROOT_LOGGER.viewNotFound(viewInterface.getName(), this.getComponentName()); } }
public EJBLocalHome getEJBLocalHome() throws IllegalStateException { if (ejbLocalHomeViewServiceName == null) { throw EjbLogger.ROOT_LOGGER.beanLocalHomeInterfaceIsNull(getComponentName()); } return createViewInstanceProxy(EJBLocalHome.class, Collections.emptyMap(), ejbLocalHomeViewServiceName); }
@Override public ProtectionDomain run() { if (!securityManager.authorize(ejbComponent.getComponentName(), componentView.getProxyClass().getProtectionDomain().getCodeSource(), methodIntfType.name(), AuthorizationInterceptor.this.viewMethod, AuthorizationInterceptor.this.getMethodRolesAsPrincipals(), AuthorizationInterceptor.this.contextID)) { throw EjbLogger.ROOT_LOGGER.invocationOfMethodNotAllowed(invokedMethod,ejbComponent.getComponentName()); } return null; } });
private EJBMethodPermission createEjbMethodPermission(Method invokedMethod, EJBComponent ejbComponent, MethodInterfaceType methodIntfType) { return new EJBMethodPermission(ejbComponent.getComponentName(), methodIntfType.name(), invokedMethod); }
public EJBHome getEJBHome() throws IllegalStateException { if (ejbHomeViewServiceName == null) { throw EjbLogger.ROOT_LOGGER.beanHomeInterfaceIsNull(getComponentName()); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbHomeViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = earApplicationName == null ? "" : earApplicationName; return EJBClient.createProxy(createHomeLocator(view.getViewClass().asSubclass(EJBHome.class), locatorAppName, moduleName, getComponentName(), distinctName)); }
public Object processInvocation(final InterceptorContext context) throws Exception { final Component component = context.getPrivateData(Component.class); if (! (component instanceof EJBComponent)) { throw EjbLogger.ROOT_LOGGER.unexpectedComponent(component, EJBComponent.class); } final Iterator<String> iterator = rolesAllowed.iterator(); if (iterator.hasNext()) { final SecurityDomain securityDomain = context.getPrivateData(SecurityDomain.class); final SecurityIdentity identity = securityDomain.getCurrentSecurityIdentity(); final Roles ejbRoles = identity.getRoles("ejb", true); do { final String role = iterator.next(); if (ejbRoles.contains(role) || (role.equals("**") && !identity.isAnonymous())) { return context.proceed(); } } while (iterator.hasNext()); } throw EjbLogger.ROOT_LOGGER.invocationOfMethodNotAllowed(context.getMethod(), ((EJBComponent) component).getComponentName()); } }
private void hasPermission(EJBComponent ejbComponent, ComponentView componentView, Method method, SecurityIdentity securityIdentity) { MethodInterfaceType methodIntfType = getMethodInterfaceType(componentView.getPrivateData(MethodIntf.class)); EJBMethodPermission permission = createEjbMethodPermission(method, ejbComponent, methodIntfType); ProtectionDomain domain = new ProtectionDomain (componentView.getProxyClass().getProtectionDomain().getCodeSource(), null, null, getGrantedRoles(securityIdentity)); Policy policy = WildFlySecurityManager.isChecking() ? doPrivileged((PrivilegedAction<Policy>) Policy::getPolicy) : Policy.getPolicy(); if (!policy.implies(domain, permission)) { throw EjbLogger.ROOT_LOGGER.invocationOfMethodNotAllowed(method,ejbComponent.getComponentName()); } }
final String msg = EjbLogger.ROOT_LOGGER.transactionNotComplete(component.getComponentName()); EjbLogger.ROOT_LOGGER.error(msg); if (ex instanceof Exception) {
@Override protected Interceptor create(final Component component, final InterceptorFactoryContext context) { if (! (component instanceof EJBComponent)) { throw EjbLogger.ROOT_LOGGER.unexpectedComponent(component, EJBComponent.class); } final EJBComponent ejbComponent = (EJBComponent) component; final EJBSecurityMetaData securityMetaData = ejbComponent.getSecurityMetaData(); String securityDomainName = securityMetaData.getSecurityDomain(); if (securityDomainName == null) { securityDomainName = DEFAULT_DOMAIN; } final SecurityDomain securityDomain = ejbComponent.getSecurityDomain(); if (securityDomain == null) { throw EjbLogger.ROOT_LOGGER.invalidSecurityForDomainSet(ejbComponent.getComponentName()); } if (ROOT_LOGGER.isTraceEnabled()) { ROOT_LOGGER.trace("Using security domain: " + securityDomainName + " for EJB " + ejbComponent.getComponentName()); } return new SecurityDomainInterceptor(securityDomain); } }
private void checkBadStateful() { int status = Status.STATUS_NO_TRANSACTION; TransactionManager tm = getComponent().getTransactionManager(); try { status = tm.getStatus(); } catch (SystemException ex) { EjbLogger.ROOT_LOGGER.failedToGetStatus(ex); } switch (status) { case Status.STATUS_COMMITTING: case Status.STATUS_MARKED_ROLLBACK: case Status.STATUS_PREPARING: case Status.STATUS_ROLLING_BACK: try { tm.rollback(); } catch (Exception ex) { EjbLogger.ROOT_LOGGER.failedToRollback(ex); } EjbLogger.ROOT_LOGGER.transactionNotComplete(getComponent().getComponentName(), statusAsString(status)); } }
public boolean isCallerInRole(final String roleName) throws IllegalStateException { if (isSecurityDomainKnown()) { if (enableJacc) { Policy policy = WildFlySecurityManager.isChecking() ? doPrivileged((PrivilegedAction<Policy>) Policy::getPolicy) : Policy.getPolicy(); ProtectionDomain domain = new ProtectionDomain(null, null, null, JaccInterceptor.getGrantedRoles(getCallerSecurityIdentity())); return policy.implies(domain, new EJBRoleRefPermission(getComponentName(), roleName)); } else { return checkCallerSecurityIdentityRole(roleName); } } else if (WildFlySecurityManager.isChecking()) { return WildFlySecurityManager.doUnchecked((PrivilegedAction<Boolean>) () -> serverSecurityManager.isCallerInRole(getComponentName(), policyContextID, securityMetaData.getSecurityRoles(), securityMetaData.getSecurityRoleLinks(), roleName)); } else { return this.serverSecurityManager.isCallerInRole(getComponentName(), policyContextID, securityMetaData.getSecurityRoles(), securityMetaData.getSecurityRoleLinks(), roleName); } }
if (!securityManager.authorize(ejbComponent.getComponentName(), componentView.getProxyClass().getProtectionDomain().getCodeSource(), methodIntfType.name(), this.viewMethod, this.getMethodRolesAsPrincipals(), this.contextID)) { throw EjbLogger.ROOT_LOGGER.invocationOfMethodNotAllowed(invokedMethod,ejbComponent.getComponentName());
public static void addTimers(final EJBComponent ejb, final ModelNode response) { response.setEmptyList(); final String name = ejb.getComponentName(); TimerService ts = ejb.getTimerService(); if (ts != null) { for (Timer timer : ts.getTimers()) { ModelNode timerNode = response.add(); addTimeRemaining(timer, timerNode, name); addNextTimeout(timer, timerNode, name); addCalendarTimer(timer, timerNode, name); addPersistent(timer, timerNode, name); addSchedule(timer, timerNode, name); } } }
EjbLogger.EJB3_INVOCATION_LOGGER.invocationFailed(component.getComponentName(), invokedMethod, t);
try { final String earApplicationName = ejbComponent.getEarApplicationName() == null ? "" : ejbComponent.getEarApplicationName(); if (locator.getBeanName().equals(ejbComponent.getComponentName()) && locator.getAppName().equals(earApplicationName) && locator.getModuleName().equals(ejbComponent.getModuleName()) && throw EjbLogger.ROOT_LOGGER.incorrectEJBLocatorForBean(locator, ejbComponent.getComponentName());
protected void executeReadAttribute(final String attributeName, final OperationContext context, final T component, final PathAddress address) { final boolean hasPool = componentType.hasPool(); if (COMPONENT_CLASS_NAME.getName().equals(attributeName)) { context.getResult().set(component.getComponentName()); } else if (SECURITY_DOMAIN.getName().equals(attributeName)) { final ModelNode result = context.getResult();
if (component.getDistinctName() == null || component.getDistinctName().isEmpty()) { name = earApplicationName == null || earApplicationName.isEmpty() ? "" : earApplicationName + "/"; name = name + component.getModuleName() + "/" + component.getComponentName(); } else { name = earApplicationName == null || earApplicationName.isEmpty() ? "" : earApplicationName + "/"; name = name + component.getModuleName() + "/" + component.getDistinctName() + "/" + component.getComponentName(); name = component.getComponentName(); EjbLogger.ROOT_LOGGER.debugf("Home IOR for %s bound to %s in CORBA naming service", component.getComponentName(), this.name);
ROOT_LOGGER.trace("Using security domain: " + securityDomain + " for EJB " + ejbComponent.getComponentName());
protected <T> T createViewInstanceProxy(final Class<T> viewInterface, final Map<Object, Object> contextData) { if (viewInterface == null) throw MESSAGES.viewInterfaceCannotBeNull(); if (viewServices.containsKey(viewInterface.getName())) { final ServiceName serviceName = viewServices.get(viewInterface.getName()); return createViewInstanceProxy(viewInterface, contextData, serviceName); } else { throw MESSAGES.viewNotFound(viewInterface.getName(), this.getComponentName()); } }