JBoss distributed environment propagation User Identification Method

Source: Internet
Author: User
Tags jboss server

Description

Actions access ejbs, and ejbs access ejbs. In this way, distributed calls are called. You want to upload the user_id randomly generated by the Action layer to the EJB layer.

Three methods

1. The action layer defines a JBoss client interceptor EJB layer defines a JBoss server interceptor

2. Use securityassociation of JBoss

Add the following code to the action:

Securityassociation. setprincipal (New simpleprincipa ("user_id "));

Since the servlet may have configured principal, it is best to add your own information when getprincipal and then new.

Get the required information at the EJB end, and then construct a principal class set.

3. Use AOP to intercept the org. JBoss. ejb3.remoting. islocalinterceptor. Invoke Method

Then, the EJB User-Defined interceptor obtains

The first method recommended by JBoss is



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.