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