org.apache.jetspeed.sso.impl
Class PersistenceBrokerSSOProvider

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
              extended by org.apache.jetspeed.sso.impl.PersistenceBrokerSSOProvider
All Implemented Interfaces:
org.apache.jetspeed.sso.SSOProvider, org.springframework.beans.factory.InitializingBean

public class PersistenceBrokerSSOProvider
extends org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
implements org.apache.jetspeed.sso.SSOProvider

Utility component to handle SSO requests

Author:
Roger Ruttimann

Field Summary
private  Hashtable clientProxy
           
private  String GROUP_PATH
           
private static org.apache.commons.logging.Log log
           
private  Hashtable mapSite
           
(package private) static char[] scrambler
           
private  String USER_PATH
           
 
Fields inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
repositoryPath
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PersistenceBrokerSSOProvider(String repositoryPath)
          PersitenceBrokerSSOProvider()
 
Method Summary
 void addCredentialsForSite(String fullPath, String remoteUser, String site, String pwd)
          addCredentialsForSite()
 void addCredentialsForSite(Subject subject, String remoteUser, String site, String pwd)
           
 void addSite(String siteName, String siteUrl)
           
 void addSiteChallengeResponse(String siteName, String siteUrl, String realm)
          Add a new site that uses ChallengeResponse Authentication
 void addSiteFormAuthenticated(String siteName, String siteUrl, String realm, String userField, String pwdField)
          Add a new site that uses Form Authentication
private  org.apache.jetspeed.security.om.InternalUserPrincipal findRemoteMatch(Collection remoteForPrincipals, Collection remoteForSite)
          removeRemotePrincipalForPrincipal
private  String getContentFromURL(String proxyID, String destUrl, org.apache.jetspeed.sso.SSOSite[] sites, boolean bRefresh)
           
 Collection getCookiesForUser(String fullPath)
          Retrive cookies for an user by User full path
 Collection getCookiesForUser(Subject user)
          Retrive Cookies by Subject
private  org.apache.jetspeed.sso.SSOContext getCredential(org.apache.jetspeed.sso.SSOSite ssoSite, String fullPath)
           
 org.apache.jetspeed.sso.SSOContext getCredentials(Subject subject, String site)
           
private  org.apache.jetspeed.security.om.InternalGroupPrincipal getGroupPrincipals(String principalFullPath)
           
private  org.apache.jetspeed.sso.SSOPrincipal getPrincipalForSite(org.apache.jetspeed.sso.SSOSite ssoSite, String fullPath)
           
 List getPrincipalsForSite(org.apache.jetspeed.sso.SSOSite site)
           
 String getRealmForSite(String site)
           
private  Collection getRemotePrincipalsForPrincipal(Collection principalsForSite, String fullPath)
           
 org.apache.jetspeed.sso.SSOSite getSite(String siteUrl)
           
 String getSiteName(String site)
          getSiteName
 Iterator getSites(String filter)
           
 Collection getSitesForPrincipal(String fullPath)
          Get all SSOSites that the principal has access to
 String getSiteURL(String site)
          Retrive site information getSiteURL
private  org.apache.jetspeed.sso.SSOPrincipal getSSOPrincipal(String fullPath)
           
private  org.apache.jetspeed.sso.SSOSite getSSOSiteObject(String site)
           
 boolean hasSSOCredentials(Subject subject, String site)
           
 void removeCredentialsForSite(String fullPath, String site)
          removeCredentialsForSite()
 void removeCredentialsForSite(Subject subject, String site)
           
 void removeSite(org.apache.jetspeed.sso.SSOSite site)
           
private  String scramble(String pwd)
           
 void setRealmForSite(String site, String realm)
           
private  String stripPortalPrincipalName(String fullPath)
           
private  String stripPrincipalName(String fullPath)
           
private  String unscramble(String pwd)
           
 void updateCredentialsForSite(Subject subject, String remoteUser, String site, String pwd)
          updateCredentialsForSite
 void updateSite(org.apache.jetspeed.sso.SSOSite site)
           
 String useSSO(Subject subject, String url, boolean bRefresh)
           
 String useSSO(Subject subject, String url, String SSOSite, boolean bRefresh)
           
private  char[] xor(char[] a, char[] b)
           
 
Methods inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
init
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jetspeed.sso.SSOProvider
init
 

Field Detail

log

private static final org.apache.commons.logging.Log log

mapSite

private Hashtable mapSite

clientProxy

private Hashtable clientProxy

USER_PATH

private String USER_PATH

GROUP_PATH

private String GROUP_PATH

scrambler

static char[] scrambler
Constructor Detail

PersistenceBrokerSSOProvider

public PersistenceBrokerSSOProvider(String repositoryPath)
                             throws ClassNotFoundException
PersitenceBrokerSSOProvider()

Parameters:
repository - Location of repository mapping file. Must be available within the classpath.
prefsFactoryImpl - java.util.prefs.PreferencesFactory implementation to use.
enablePropertyManager - Whether or not we chould be suing the property manager.
Throws:
ClassNotFoundException - if the prefsFactoryImpl argument does not reperesent a Class that exists in the current classPath.
Method Detail

useSSO

public String useSSO(Subject subject,
                     String url,
                     String SSOSite,
                     boolean bRefresh)
              throws org.apache.jetspeed.sso.SSOException
Specified by:
useSSO in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

useSSO

public String useSSO(Subject subject,
                     String url,
                     boolean bRefresh)
              throws org.apache.jetspeed.sso.SSOException
Specified by:
useSSO in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

getCookiesForUser

public Collection getCookiesForUser(String fullPath)
Retrive cookies for an user by User full path

Specified by:
getCookiesForUser in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
fullPath -
Returns:

getCookiesForUser

public Collection getCookiesForUser(Subject user)
Retrive Cookies by Subject

Specified by:
getCookiesForUser in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
user -
Returns:

setRealmForSite

public void setRealmForSite(String site,
                            String realm)
                     throws org.apache.jetspeed.sso.SSOException
Specified by:
setRealmForSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

getRealmForSite

public String getRealmForSite(String site)
                       throws org.apache.jetspeed.sso.SSOException
Specified by:
getRealmForSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

getSitesForPrincipal

public Collection getSitesForPrincipal(String fullPath)
Get all SSOSites that the principal has access to

Specified by:
getSitesForPrincipal in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
userId -
Returns:

getSites

public Iterator getSites(String filter)
Specified by:
getSites in interface org.apache.jetspeed.sso.SSOProvider

addCredentialsForSite

public void addCredentialsForSite(String fullPath,
                                  String remoteUser,
                                  String site,
                                  String pwd)
                           throws org.apache.jetspeed.sso.SSOException
addCredentialsForSite()

Specified by:
addCredentialsForSite in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
fullPath -
remoteUser -
site -
pwd -
Throws:
org.apache.jetspeed.sso.SSOException

removeCredentialsForSite

public void removeCredentialsForSite(String fullPath,
                                     String site)
                              throws org.apache.jetspeed.sso.SSOException
removeCredentialsForSite()

Specified by:
removeCredentialsForSite in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
fullPath -
site -
Throws:
org.apache.jetspeed.sso.SSOException

getSiteURL

public String getSiteURL(String site)
Retrive site information getSiteURL

Specified by:
getSiteURL in interface org.apache.jetspeed.sso.SSOProvider

getSiteName

public String getSiteName(String site)
getSiteName

Specified by:
getSiteName in interface org.apache.jetspeed.sso.SSOProvider

hasSSOCredentials

public boolean hasSSOCredentials(Subject subject,
                                 String site)
Specified by:
hasSSOCredentials in interface org.apache.jetspeed.sso.SSOProvider

getCredentials

public org.apache.jetspeed.sso.SSOContext getCredentials(Subject subject,
                                                         String site)
                                                  throws org.apache.jetspeed.sso.SSOException
Specified by:
getCredentials in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

addCredentialsForSite

public void addCredentialsForSite(Subject subject,
                                  String remoteUser,
                                  String site,
                                  String pwd)
                           throws org.apache.jetspeed.sso.SSOException
Specified by:
addCredentialsForSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

removeCredentialsForSite

public void removeCredentialsForSite(Subject subject,
                                     String site)
                              throws org.apache.jetspeed.sso.SSOException
Specified by:
removeCredentialsForSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

updateCredentialsForSite

public void updateCredentialsForSite(Subject subject,
                                     String remoteUser,
                                     String site,
                                     String pwd)
                              throws org.apache.jetspeed.sso.SSOException
updateCredentialsForSite

Specified by:
updateCredentialsForSite in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
subject - Current subject
remoteUser - remote user login
site - URL or description of site
pwd - Password for credentail
Throws:
org.apache.jetspeed.sso.SSOException

getSSOSiteObject

private org.apache.jetspeed.sso.SSOSite getSSOSiteObject(String site)

getCredential

private org.apache.jetspeed.sso.SSOContext getCredential(org.apache.jetspeed.sso.SSOSite ssoSite,
                                                         String fullPath)

stripPrincipalName

private String stripPrincipalName(String fullPath)

getPrincipalForSite

private org.apache.jetspeed.sso.SSOPrincipal getPrincipalForSite(org.apache.jetspeed.sso.SSOSite ssoSite,
                                                                 String fullPath)

getSSOPrincipal

private org.apache.jetspeed.sso.SSOPrincipal getSSOPrincipal(String fullPath)

findRemoteMatch

private org.apache.jetspeed.security.om.InternalUserPrincipal findRemoteMatch(Collection remoteForPrincipals,
                                                                              Collection remoteForSite)
removeRemotePrincipalForPrincipal

Parameters:
site -
fullPath -
Returns:
removes remotePrincipal for a site & principal private InternalUserPrincipal removeRemotePrincipalForPrincipal(SSOSite site, String fullPath) throws SSOException { if (site.getPrincipals() != null) { Iterator itPrincipals = site.getPrincipals().iterator(); while (itPrincipals.hasNext()) { SSOPrincipal tmp = (SSOPrincipal)itPrincipals.next(); if (tmp.getFullPath().compareToIgnoreCase(fullPath) == 0) { // Found -- get the remotePrincipal Collection collRemotePrincipals = tmp.getRemotePrincipals() ; if (collRemotePrincipals != null) { Iterator itRemotePrincipals = collRemotePrincipals.iterator(); if (itRemotePrincipals.hasNext()) { InternalUserPrincipal remotePrincipal = (InternalUserPrincipal)itRemotePrincipals.next(); // Found remove the object collRemotePrincipals.remove(remotePrincipal); return remotePrincipal; } } } } } throw new SSOException(SSOException.REQUESTED_PRINCIPAL_DOES_NOT_EXIST); }

getRemotePrincipalsForPrincipal

private Collection getRemotePrincipalsForPrincipal(Collection principalsForSite,
                                                   String fullPath)

getSite

public org.apache.jetspeed.sso.SSOSite getSite(String siteUrl)
Specified by:
getSite in interface org.apache.jetspeed.sso.SSOProvider

updateSite

public void updateSite(org.apache.jetspeed.sso.SSOSite site)
                throws org.apache.jetspeed.sso.SSOException
Specified by:
updateSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

addSiteFormAuthenticated

public void addSiteFormAuthenticated(String siteName,
                                     String siteUrl,
                                     String realm,
                                     String userField,
                                     String pwdField)
                              throws org.apache.jetspeed.sso.SSOException
Add a new site that uses Form Authentication

Specified by:
addSiteFormAuthenticated in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
siteName -
siteUrl -
realm -
userField -
pwdField -
Throws:
org.apache.jetspeed.sso.SSOException

addSiteChallengeResponse

public void addSiteChallengeResponse(String siteName,
                                     String siteUrl,
                                     String realm)
                              throws org.apache.jetspeed.sso.SSOException
Add a new site that uses ChallengeResponse Authentication

Specified by:
addSiteChallengeResponse in interface org.apache.jetspeed.sso.SSOProvider
Parameters:
siteName -
siteUrl -
realm -
Throws:
org.apache.jetspeed.sso.SSOException

addSite

public void addSite(String siteName,
                    String siteUrl)
             throws org.apache.jetspeed.sso.SSOException
Specified by:
addSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

removeSite

public void removeSite(org.apache.jetspeed.sso.SSOSite site)
                throws org.apache.jetspeed.sso.SSOException
Specified by:
removeSite in interface org.apache.jetspeed.sso.SSOProvider
Throws:
org.apache.jetspeed.sso.SSOException

getPrincipalsForSite

public List getPrincipalsForSite(org.apache.jetspeed.sso.SSOSite site)
Specified by:
getPrincipalsForSite in interface org.apache.jetspeed.sso.SSOProvider

stripPortalPrincipalName

private String stripPortalPrincipalName(String fullPath)

getGroupPrincipals

private org.apache.jetspeed.security.om.InternalGroupPrincipal getGroupPrincipals(String principalFullPath)

getContentFromURL

private String getContentFromURL(String proxyID,
                                 String destUrl,
                                 org.apache.jetspeed.sso.SSOSite[] sites,
                                 boolean bRefresh)
                          throws org.apache.jetspeed.sso.SSOException
Throws:
org.apache.jetspeed.sso.SSOException

scramble

private String scramble(String pwd)

unscramble

private String unscramble(String pwd)

xor

private char[] xor(char[] a,
                   char[] b)


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.