Yeah, that'll work with JAXRS, but I'm actually using JAXWS. I'll give it a
try, Change to JAXRS and try to do it.

Thanks a lot!
Bernardo.

On Thu, Oct 6, 2011 at 10:57 AM, Osvaldo Pina <[email protected]>wrote:

>    Hi,
>
>   You can do that:
>
> // Create a proxy to a access a jaxrs server
>  BookStore proxy = JAXRSClientFactory.create("http://books";,
> BookStore.class);
>
> // add a cookie to a call
>  WebClient.client(proxy).cookie(getLtpaToken());
>
>
>   Ats,
>   Osvaldo Pina.
>
>
>
> 2011/10/6 Bernardo Corrêa <[email protected]>
> >
> > Thanks Osvaldo.
> >
> > I think that'll do, but where should I use it in order to CXF send the
> > lpta2token or lptatoken in Websphere 6.1 in the client call?
> >
> > Thanks again.
> >
> > On Thu, Oct 6, 2011 at 10:30 AM, Osvaldo Pina <[email protected]
> >wrote:
> >
> > >  Hi,
> > >
> > >  I'm using websphere 7 and I´m using the following code to generate a
> > > LtpaToken2 inside the container:
> > >
> > >    private String getSecurityToken() {
> > >        byte[] token = null;
> > >        try {
> > >            // Get current security subject
> > >            Subject securitySubject = WSSubject.getRunAsSubject();
> > >            if (securitySubject != null) {
> > >                // Get all security credentials from the security
> subject
> > >                Set<WSCredential> securityCredentials =
> > > securitySubject.getPublicCredentials(WSCredential.class);
> > >
> > >                // Get the first credential
> > >                WSCredential securityCredential =
> > > securityCredentials.iterator().next();
> > >                String user = securityCredential.getSecurityName();
> > >                if (user.equalsIgnoreCase("UNAUTHENTICATED")) {
> > >                    return null;
> > >                }
> > >                token = securityCredential.getCredentialToken();
> > >                if (token == null) {
> > >                    return null;
> > >                }
> > >                return Base64.encodeBytes(token);
> > >            }
> > >        } catch (Exception e) {
> > >            //TODO Logar erro adequadamente;
> > >            e.printStackTrace();
> > >        }
> > >        return null;
> > >    }
> > >
> > >  and then I send a ltpaToken2 in the client call by adding a cookie:
> > >        client.cookie(new Cookie("LtpaToken2", ltpaToken));
> > >
> > >  I'm do't know to much about websphere administration configuration, so
> I
> > > don´t know if it will work on your environment.
> > >
> > >  Ats,
> > >   Osvaldo Pina.
> > >
> > >
> > > 2011/10/6 Bernardo Corrêa <[email protected]>
> > >
> > > > Hi, I'm facing a problem and could not find a way to solve it, so I'm
> > > gonna
> > > > try to get help from you guys.
> > > >
> > > > I have 2 apps deployed on Webpshere Server (same server, same cell)
> with
> > > > app
> > > > security enabled  (JAAS / LPTA), one that exposes a webservice and
> one
> > > that
> > > > will get the data from it.
> > > >
> > > > The problem is I can't get CXF to use the LPTA token from the
> cointeiner
> > > > when creating the http call to the endpoint. Does anyone know how I
> could
> > > > solve this?
> > > >
> > > > Just to remember, is the same server and I'm using a Federated
> repository
> > > > to
> > > > manage users and groups, it's not even a problem of authentication
> > > between
> > > > two server.
> > > >
> > > > I get HTTP 401.
> > > >
> > > > Thanks in advance
> > > >
> > >
>

Reply via email to