Richard: I have an implementation of an sso portlet in an J-M3 enviroment.
First you have to create, (in the Adminstrative part of Jetpeed,
sso-admin.psml) a sso Site (name and url). Then you select that new site and
you will see in the sso Detail that you can create a mapping of a portal
principal (admin for example) to a remote principal (you have also to set
the remote password).
The 2 step is to create your own sso portlet:
In the jsp view asociated with this portlet, you must put a link like that:
<a href="<portlet:actionURL/>" target="_blank">
MY SSO SITE
</a>
Then in the processaction() of the sso portlet class you shoul do somenthing
like that:
public void processActionLink( ActionRequest request, ActionResponse
actionResponse )
throws PortletException, IOException {
actionResponse.sendRedirect( getURLSource( request, actionResponse ) );
}
private Subject getSubject() {
AccessControlContext context = AccessController.getContext();
return Subject.getSubject( context );
}
public String getURLSource( ActionRequest request, ActionResponse response
) {
PortletPreferences prefs = request.getPreferences();
String baseSource = prefs.getValue( SRC, "" );//your site
Subject subject = getSubject();
String principal = null;
String credential = null;
try {
SSOContext context = sso.getCredentials( subject, baseSource );
principal = context.getRemotePrincipalName();
credential = context.getRemoteCredential();
} catch ( SSOException ex ) {
/** @todo manejar excepcion */
}
String type = prefs.getValue( SSO_TYPE, SSO_TYPE_URL );
if ( type.equals( SSO_TYPE_URL ) ) {
String userNameParam = prefs.getValue( SSO_TYPE_URL_USERNAME, "user"
);
String passwordParam = prefs.getValue( SSO_TYPE_URL_PASSWORD,
"password" );
StringBuffer source = new StringBuffer( baseSource );
if ( baseSource.indexOf( "?" ) == -1 ) {
source.append( "?" );
} else {
source.append( "&" );
}
source.append( userNameParam );
source.append( "=" );
String userName = principal;
if ( userName == null ) {
userName = "";
}
String password = credential;
if ( password == null ) {
password = "";
}
source.append( userName );
source.append( "&" );
source.append( passwordParam );
source.append( "=" );
source.append( password );
return response.encodeURL( source.toString() );
} else {
return baseSource;
}
}
that not the best way to do, but it was the fast implementation that i
found!
Enjoy it. Eduardo Coll.
From: Richard Bounds <[EMAIL PROTECTED]>
Reply-To: "Jetspeed Users List" <[email protected]>
To: [email protected]
Subject: Help with SSO
Date: Thu, 15 Sep 2005 16:18:38 +0100
Hi,
I've built Jetspeed 2.0-M3 from source and got it running OK on Tomcat
5.5.9. I'd like to implement single sign-on to another web application
from Jetspeed. The other webapp uses JAAS for authentication and I've
tried setting up SSO using the tomcat SSO valve, but not been able to make
much progress. I see that there is an SSO component in Jetspeed, but I
haven't been able to find any documentation for it. Could somebody give me
some pointers to get me started in the right direction?
Many thanks,
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]