public static MethodIntf of(final InterceptorContext invocation) { //for timer invocations there is no view, so the methodInf is attached directly //to the context. Otherwise we retrieve it from the invoked view MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class); if (methodIntf == null) { final ComponentView componentView = invocation.getPrivateData(ComponentView.class); if (componentView != null) { methodIntf = componentView.getPrivateData(MethodIntf.class); } else { methodIntf = MethodIntf.BEAN; } } return methodIntf; } }
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 MethodInterfaceType methodIntfType = this.getMethodInterfaceType(componentView.getPrivateData(MethodIntf.class));
@Override public Object processInvocation(final InterceptorContext invocation) throws Exception { // Do we have a foreign transaction context? Transaction tx = TxServerInterceptor.getCurrentTransaction(); if (tx instanceof ForeignTransaction) { final EJBComponent component = (EJBComponent) invocation.getPrivateData(Component.class); //for timer invocations there is no view, so the methodInf is attached directly //to the context. Otherwise we retrieve it from the invoked view MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class); if (methodIntf == null) { final ComponentView componentView = invocation.getPrivateData(ComponentView.class); if (componentView != null) { methodIntf = componentView.getPrivateData(MethodIntf.class); } else { methodIntf = MethodIntf.BEAN; } } final TransactionAttributeType attr = component.getTransactionAttributeType(methodIntf, invocation.getMethod()); if (attr != TransactionAttributeType.NOT_SUPPORTED && attr != TransactionAttributeType.REQUIRES_NEW) { throw EjbLogger.ROOT_LOGGER.transactionPropagationNotSupported(); } } return invocation.proceed(); } }
Ejb2xViewType viewType = view.getPrivateData(Ejb2xViewType.class); if (viewType != null) {
public static MethodIntf of(final InterceptorContext invocation) { //for timer invocations there is no view, so the methodInf is attached directly //to the context. Otherwise we retrieve it from the invoked view MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class); if (methodIntf == null) { final ComponentView componentView = invocation.getPrivateData(ComponentView.class); if (componentView != null) { methodIntf = componentView.getPrivateData(MethodIntf.class); } else { methodIntf = MethodIntf.BEAN; } } return methodIntf; } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { final Component component = context.getPrivateData(Component.class); if (component instanceof EJBComponent == false) { throw MESSAGES.unexpectedComponent(component,EJBComponent.class); } final Method invokedMethod = context.getMethod(); final ComponentView componentView = context.getPrivateData(ComponentView.class); final String viewClassOfInvokedMethod = componentView.getViewClass().getName(); // shouldn't really happen if the interceptor was setup correctly. But let's be safe and do a check if (!this.viewClassName.equals(viewClassOfInvokedMethod) || !this.viewMethod.equals(invokedMethod)) { throw MESSAGES.failProcessInvocation(this.getClass().getName(), invokedMethod,viewClassOfInvokedMethod, viewMethod, viewClassName); } final EJBComponent ejbComponent = (EJBComponent) component; final ServerSecurityManager securityManager = ejbComponent.getSecurityManager(); final MethodInterfaceType methodIntfType = this.getMethodInterfaceType(componentView.getPrivateData(MethodIntf.class)); // set the JACC contextID before calling the security manager. final String previousContextID = setContextID(this.contextID); try { if (!securityManager.authorize(ejbComponent.getComponentName(), componentView.getProxyClass().getProtectionDomain().getCodeSource(), methodIntfType.name(), this.viewMethod, this.getMethodRolesAsPrincipals(), this.contextID)) throw MESSAGES.invocationOfMethodNotAllowed(invokedMethod,ejbComponent.getComponentName()); } finally { // reset the previous JACC contextID. setContextID(previousContextID); } // successful authorization, let the invocation proceed return context.proceed(); }
@Override public Object processInvocation(final InterceptorContext invocation) throws Exception { // Do we have a foreign transaction context? Transaction tx = TxServerInterceptor.getCurrentTransaction(); if (tx instanceof ForeignTransaction) { final EJBComponent component = (EJBComponent) invocation.getPrivateData(Component.class); //for timer invocations there is no view, so the methodInf is attached directly //to the context. Otherwise we retrieve it from the invoked view MethodIntf methodIntf = invocation.getPrivateData(MethodIntf.class); if (methodIntf == null) { final ComponentView componentView = invocation.getPrivateData(ComponentView.class); if (componentView != null) { methodIntf = componentView.getPrivateData(MethodIntf.class); } else { methodIntf = MethodIntf.BEAN; } } final TransactionAttributeType attr = component.getTransactionAttributeType(methodIntf, invocation.getMethod()); if (attr != TransactionAttributeType.NOT_SUPPORTED && attr != TransactionAttributeType.REQUIRES_NEW) { throw EjbMessages.MESSAGES.transactionPropagationNotSupported(); } } return invocation.proceed(); } }
Ejb2xViewType viewType = view.getPrivateData(Ejb2xViewType.class); if (viewType != null) {