Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9052201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:06:24+00:00 2026-06-16T13:06:24+00:00

I have an EJB which makes a call to another server in the cell

  • 0

I have an EJB which makes a call to another server in the cell using HTTP (REST api).

At the EJB context the user is already authenticated and authorized, how can I propagate the security tokens to the other server avoiding the need to provide credentials in the request ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:06:25+00:00Added an answer on June 16, 2026 at 1:06 pm

    It is possible to obtain WebSphere’s Ltpa token from the security subject and pass it as a cookie for the HTTP call:

    public static SingleSignonToken getSSOTokenFromSubject(final Subject subject) {
        if (subject == null) {
            return null;
        }
        return AccessController.doPrivileged(new PrivilegedAction<SingleSignonToken>() {
            public SingleSignonToken run() {
                Set<SingleSignonToken> ssoTokens = subject.getPrivateCredentials(SingleSignonToken.class);
                    for (SingleSignonToken ssoToken : ssoTokens) {
                    if (ssoToken.getName().equals("LtpaToken")) {
                        return ssoToken;
                    }
                }
    
                return null;
            }
        });
    }
    
    // Get cookie to add to outgoing HTTP requests
    SingleSignonToken ssoToken =  getSSOTokenFromSubject(subject);
    
    String ssoTokenStr = null;
    if (ssoToken != null) {
        byte[] ssoTokenBytes = ssoToken.getBytes();
        ssoTokenStr = com.ibm.ws.util.Base64.encode(ssoTokenBytes);
    }
    String ssoTokenCookie = "LtpaToken2=" + ssoTokenStr;
    

    By adding the ssoTokenCookie to the request cookies there is no need to provider user credentials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an EJB (PersonManager) in the Enterprise Application modul, which injects another EJB
We have a setup in which EJB A is running on server A, and
I have an EJB which I don't want anyone to be able to instantiate
I have some cleanup code which may try to refer to an (stateful) EJB
I'm using an application with EJB and CMT transactions. I have an EJB (let´s
To summarize the issue I'm encountering, I have an EJB which uses version A
I have a custom InjectionProvider which retrieves a User object from the SecurityContext and
I am using a GlassFish-3.1.2 server running in my subnet (192.168.1.3:3700). I already deployed
I have a class, which is either EJB or POJO (I don't know). I
I have a Java EE application with its EJB and database server. I'm now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.