Connecting to domino server the right way... using LTPAToken etc.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > Connecting to domino server the right way... using LTPAToken etc.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Connecting to domino server the right way... using LTPAToken etc.  
Lee Francis Wilhelmsen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-06-05 12:53 PM

Hi

I've asked similar questions in the past and seen most of the postings
regarding this subject, but I'm still not satisfied. I'm using WPS 5.0.2
and Domino 6.5.1 server

My wishes:

- I want my portlets to connect to the domino backend using http
and using SSO.
- I want to use the portal's Content Access Service to perform
the connection or by using an active credential. This is to use
any connection settings configured by the portal
(proxy server & port etc)

Ok, so you have your portlet running in the portal, your domino and WPS
servers are configured to use SSO, you log on to the portal and the LTPA
cookie is set...

From what I have seen during my own experiments the following code will
work fine:

String ltpaToken = null;
Cookie[] cookies = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals("LtpaToken")) {
ltpaToken = cookies[i].getValue();
break;
}
}

// seems to work... problem is not using content access service

if (ltpaToken != null) {
String cookie = "LtpaToken=" + ltpaToken.toString();

URL url = new URL(domino url);
URLConnection connection = url.openConnection();

connection.setRequestProperty("cookie", cookie);
connection.connect();

InputStream input = connection.getInputStream();

// read input and do something...

} else {
// No LTPAToken cookie found
}




However, it doesn't use the content access service and also the code for
finding the token is messy.

I've seen the following code used in the infocentre:

PortletContext context = getPortletConfig().getContext();
CredentialVaultService service = (CredentialVaultService)
context.getService(CredentialVaultService.class);

Subject subject = service.getUserSubject(request);
System.out.println(subject.toString());

// seems to return empty array!!!
Object[] temp =
subject. getPrivateCredentials(LtpaTokenCredentia
l.class).toArray();

if (temp.length > 0) {
LtpaTokenCredential ltpaToken = (LtpaTokenCredential) temp[0];

URL url = new URL(domino url);
URLConnection connection =ltpaToken.getAuthenticatedConnection(url);

// Create the LTPA Cookie in the Header
String cookie = "LtpaToken=" + ltpaToken.toString();

// Set the LTPA token Cookie
connection.setRequestProperty("cookie", cookie);

connection.connect();

InputStream input = connection.getInputStream();

// read input and do something...
}

However, I can't get this code working.. I never get a valid
LtpaTokenCredential object and have no idea why. The temp array is
always empty.

Now, I would prefer to use the active credential (second alternative)
for connecting (using LtpaTokenCredential), but since I never get one
then that just ain't gonna happen. What can be wrong?

I have run these two procedures within two different methods on the same
portlet (from doView()) and one works, while the other can't find the
credential...

Really appreciate any help with this.

Regards
Lee Francis Wilhelmsen





[ Post a follow-up to this message ]



    Re: Connecting to domino server the right way... using LTPAToken etc.  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-06-05 10:58 PM

> - I want to use the portal's Content Access Service
> to perform
> the connection or by using an active credential.
> al. This is to use
>    any connection settings configured by the portal
>    (proxy server & port etc)

Hi Lee,

The CAS has a getURL method, used similarly to the other CAS methods, which 
will return a URL for you to use, and which will allow you to add the LTPATo
ken.

For example..

URL url = contentAccessService.getURL(<domino URL>, portletRequest, portletR
esponse);
URLConnection connection = url.openConnection();

//etc

Hope that helps,

Jimmy





[ Post a follow-up to this message ]



    Re: Connecting to domino server the right way... using LTPAToken etc.  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-06-05 10:58 PM


> URL url = contentAccessService.getURL(<domino URL>,
> portletRequest, portletResponse);

Should read:
URL url = contentAccessService.getURL(domino URL, portletRequest, portletRes
ponse);





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:18 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register