You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dd...@apache.org on 2009/01/16 11:07:34 UTC
svn commit: r734954 [1/4] - in /portals/jetspeed-2/portal/trunk: ./
applications/jetspeed-demo/ applications/jetspeed-dependencies/ components/
components/jetspeed-db-tools/ components/jetspeed-portal/
components/jetspeed-security/src/main/java/org/apa...
Author: ddam
Date: Fri Jan 16 02:07:13 2009
New Revision: 734954
URL: http://svn.apache.org/viewvc?rev=734954&view=rev
Log:
JS2-907 : Reimplement SSO storage model and API on top on new Security model
Added:
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOUserImpl.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOSiteManagerSPI.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/SSOUserManagerSPI.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/JetspeedPersistentSSOSiteManager.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/spi/impl/SSOUserManagerSPIImpl.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/AbstractSecurityTestCase.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOManager.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/resources/cache-test.xml (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/sso/SSOPortletUtil.java (with props)
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOClient.java (with props)
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOManager.java (with props)
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOSiteManager.java (with props)
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUser.java (with props)
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOUserManager.java (with props)
Removed:
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/PersistenceBrokerSSOProvider.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOCookieImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOPrincipalImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/resources/boot/
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOCookie.java
Modified:
portals/jetspeed-2/portal/trunk/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml
portals/jetspeed-2/portal/trunk/applications/jetspeed-dependencies/pom.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/pom.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/ (props changed)
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/pom.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOSiteImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestBasicSSO.java
portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOComponent.java
portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/SSOIFramePortlet.java
portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/SSOWebContentPortlet.java
portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/WebContentPortlet.java
portals/jetspeed-2/portal/trunk/components/jetspeed-web-content/src/main/java/org/apache/jetspeed/portlet/sso/SSOProxyPortlet.java
portals/jetspeed-2/portal/trunk/components/pom.xml
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalType.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/security/SecurityException.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOException.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOProvider.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/sso/SSOSite.java
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/security-schema.xml
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/jetspeed-services.xml
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/security-managers.xml
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/sso.xml
portals/jetspeed-2/portal/trunk/pom.xml
Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed-demo/jetspeed-mvn-demo-pom.xml Fri Jan 16 02:07:13 2009
@@ -577,11 +577,11 @@
</deployment>
<!-- demo pa's -->
<deployment>
- <artifact>org.apache.portals.jetspeed-2:demo:war</artifact>
+ <artifact>org.apache.portals.applications:demo:war</artifact>
<delete>./demo</delete>
</deployment>
<deployment>
- <artifact>org.apache.portals.jetspeed-2:rss:war</artifact>
+ <artifact>org.apache.portals.applications:rss:war</artifact>
<delete>./rss</delete>
</deployment>
<deployment>
@@ -659,15 +659,15 @@
</dependency>
<!-- demo pa's -->
<dependency>
- <groupId>org.apache.portals.jetspeed-2</groupId>
+ <groupId>org.apache.portals.applications</groupId>
<artifactId>rss</artifactId>
- <version>2.1.3</version>
+ <version>2.2-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
- <groupId>org.apache.portals.jetspeed-2</groupId>
+ <groupId>org.apache.portals.applications</groupId>
<artifactId>demo</artifactId>
- <version>2.1.3</version>
+ <version>2.2-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed-dependencies/pom.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed-dependencies/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed-dependencies/pom.xml Fri Jan 16 02:07:13 2009
@@ -95,12 +95,10 @@
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-portlet-factory</artifactId>
</dependency>
- <!-- Commenting out SSO module for now
<dependency>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-sso</artifactId>
</dependency>
- -->
<dependency>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-statistics</artifactId>
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/pom.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/pom.xml Fri Jan 16 02:07:13 2009
@@ -87,6 +87,10 @@
</dependency>
<dependency>
<groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed-sso</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-registry</artifactId>
</dependency>
<dependency>
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml Fri Jan 16 02:07:13 2009
@@ -165,13 +165,11 @@
<artifactId>jetspeed-search</artifactId>
<scope>test</scope>
</dependency>
- <!-- Commenting out SSO module for now
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>jetspeed-sso</artifactId>
<scope>test</scope>
</dependency>
- -->
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>jetspeed-profiler</artifactId>
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/SecurityDomainImpl.java Fri Jan 16 02:07:13 2009
@@ -32,6 +32,20 @@
private boolean remote;
private boolean enabled=true;
+
+ public SecurityDomainImpl(){
+
+ }
+
+ public SecurityDomainImpl(SecurityDomain anotherDomain){
+ this();
+ this.domainId=anotherDomain.getDomainId();
+ this.name=anotherDomain.getName();
+ this.ownerDomainId=anotherDomain.getOwnerDomainId();
+ this.remote=anotherDomain.isRemote();
+ this.enabled=anotherDomain.isEnabled();
+ }
+
public Long getDomainId()
{
return domainId;
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedDomainPrincipalAccessManager.java Fri Jan 16 02:07:13 2009
@@ -38,20 +38,20 @@
List<String> getPrincipalNames(String nameFilter, JetspeedPrincipalType type, Long securityDomain);
- List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
- List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain);
+ List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain);
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/SecurityDomainStorageManager.java Fri Jan 16 02:07:13 2009
@@ -28,7 +28,9 @@
{
public void addDomain(SecurityDomain domain) throws SecurityException;
-
+
+ public void updateDomain(SecurityDomain domain) throws SecurityException;
+
public void removeDomain(SecurityDomain domain) throws SecurityException;
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java Fri Jan 16 02:07:13 2009
@@ -115,83 +115,93 @@
}
public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedFrom(principalFromName, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedFrom(principalFromName, from, to, associationName, defaultDomainId, defaultDomainId);
}
//
// JetspeedPrincipalAccessManager interface implementation
//
@SuppressWarnings("unchecked")
- public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsTo.associationName", associationName);
criteria.addEqualTo("associationsTo.from.name", principalFromName);
criteria.addEqualTo("type", to.getName());
- criteria.addEqualTo("associationsTo.to.domainId", securityDomain);
+ criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+ criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
}
public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedTo(principalToName, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedTo(principalToName, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsFrom.associationName", associationName);
criteria.addEqualTo("associationsFrom.to.name", principalToName);
criteria.addEqualTo("type", from.getName());
- criteria.addEqualTo("associationsFrom.from.domainId", securityDomain);
+ criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+ criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
}
public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedFrom(principalFromId, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedFrom(principalFromId, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<JetspeedPrincipal> getAssociatedFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsTo.associationName", associationName);
criteria.addEqualTo("associationsTo.from.id", principalFromId);
criteria.addEqualTo("type", to.getName());
- criteria.addEqualTo("associationsTo.to.domainId", securityDomain);
+ criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+ criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
}
public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedTo(principalToId, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedTo(principalToId, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<JetspeedPrincipal> getAssociatedTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsFrom.associationName", associationName);
criteria.addEqualTo("associationsFrom.to.id", principalToId);
criteria.addEqualTo("type", from.getName());
- criteria.addEqualTo("associationsFrom.from.domainId", securityDomain);
+ criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+ criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
Query query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
}
public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedNamesFrom(principalFromName, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedNamesFrom(principalFromName, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsTo.associationName", associationName);
criteria.addEqualTo("associationsTo.from.name", principalFromName);
criteria.addEqualTo("type", to.getName());
- criteria.addEqualTo("associationsTo.to.domainId", securityDomain);
+ criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+ criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
query.setAttributes(new String[]{"name"});
ArrayList<String> names = new ArrayList<String>();
@@ -203,17 +213,19 @@
}
public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedNamesFrom(principalFromId, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedNamesFrom(principalFromId, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<String> getAssociatedNamesFrom(Long principalFromId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsTo.associationName", associationName);
criteria.addEqualTo("associationsTo.from.id", principalFromId);
criteria.addEqualTo("type", to.getName());
- criteria.addEqualTo("associationsTo.to.domainId", securityDomain);
+ criteria.addEqualTo("associationsTo.to.domainId", toSecurityDomain);
+ criteria.addEqualTo("associationsTo.from.domainId", fromSecurityDomain);
ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
query.setAttributes(new String[]{"name"});
ArrayList<String> names = new ArrayList<String>();
@@ -225,17 +237,19 @@
}
public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedNamesTo(principalToName, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedNamesTo(principalToName, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsFrom.associationName", associationName);
criteria.addEqualTo("associationsFrom.to.name", principalToName);
criteria.addEqualTo("type", from.getName());
- criteria.addEqualTo("associationsFrom.from.domainId", securityDomain);
+ criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+ criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
query.setAttributes(new String[]{"name"});
ArrayList<String> names = new ArrayList<String>();
@@ -247,17 +261,19 @@
}
public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName){
- return getAssociatedNamesTo(principalToId, from, to, associationName, getDefaultSecurityDomainId());
+ Long defaultDomainId = getDefaultSecurityDomainId();
+ return getAssociatedNamesTo(principalToId, from, to, associationName, defaultDomainId, defaultDomainId);
}
@SuppressWarnings("unchecked")
- public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long securityDomain)
+ public List<String> getAssociatedNamesTo(Long principalToId, JetspeedPrincipalType from, JetspeedPrincipalType to, String associationName, Long fromSecurityDomain, Long toSecurityDomain)
{
Criteria criteria = new Criteria();
criteria.addEqualTo("associationsFrom.associationName", associationName);
criteria.addEqualTo("associationsFrom.to.id", principalToId);
criteria.addEqualTo("type", from.getName());
- criteria.addEqualTo("associationsFrom.from.domainId", securityDomain);
+ criteria.addEqualTo("associationsFrom.from.domainId", fromSecurityDomain);
+ criteria.addEqualTo("associationsFrom.to.domainId", toSecurityDomain);
ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class, criteria);
query.setAttributes(new String[]{"name"});
ArrayList<String> names = new ArrayList<String>();
@@ -954,7 +970,11 @@
}
protected boolean domainExists(SecurityDomain domain){
- return getDomainByName(domain.getName()) != null;
+ if (domain.getDomainId() != null){
+ return getDomain(domain.getDomainId()) != null;
+ } else {
+ return getDomainByName(domain.getName()) != null;
+ }
}
public void addDomain(SecurityDomain domain) throws SecurityException
@@ -1041,6 +1061,31 @@
}
+ public void updateDomain(SecurityDomain domain) throws SecurityException
+ {
+ if (!domainExists(domain)){
+ throw new SecurityException(SecurityException.SECURITY_DOMAIN_DOES_NOT_EXIST.create(domain.getName()));
+ }
+ try
+ {
+ getPersistenceBrokerTemplate().store(domain);
+ }
+ catch (Exception pbe)
+ {
+ if (pbe instanceof DataIntegrityViolationException)
+ {
+ logger.error(pbe.getMessage(), pbe);
+ throw new SecurityException(SecurityException.SECURITY_DOMAIN_UPDATE_FAILURE.create(domain.getDomainId()));
+ }
+
+ KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
+ "updateDomain",
+ pbe.getMessage());
+ logger.error(msg, pbe);
+ throw new SecurityException(msg, pbe);
+ }
+ }
+
@SuppressWarnings("unchecked")
public Collection<SecurityDomain> getDomainsOwnedBy(Long ownerDomainId)
{
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Jan 16 02:07:13 2009
@@ -1,9 +1,7 @@
target
surefire*.properties
jcoverage.ser
-
.settings
-
.classpath
-
.project
+jetspeed-mvn.properties
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/pom.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/pom.xml Fri Jan 16 02:07:13 2009
@@ -35,7 +35,7 @@
</parent>
<packaging>jar</packaging>
- <!-- Dependencies -->
+ <!-- Dependencies -->
<dependencies>
@@ -65,6 +65,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jetspeed-file-cache</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<scope>test</scope>
@@ -80,37 +85,28 @@
<artifactId>tyrex</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>tyrex</groupId>
+ <artifactId>tyrex</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>jetspeed-cm</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
- <!-- Temporary excluding blocks starts -->
- <!-- TODO: Refactor SSO components and test cases. After that, remove the excluding blocks. -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- <testExcludes>
- <exclude>**/*.java</exclude>
- </testExcludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- <!-- Temporary excluding blocks ends -->
<plugin>
<groupId>${pom.groupId}</groupId>
<artifactId>jetspeed-unpack-maven-plugin</artifactId>
@@ -129,7 +125,7 @@
<resources>
<resource>
<path>assembly</path>
- <include>sso.xml,transaction.xml,cache.xml,security-*.xml</include>
+ <include>sso.xml,transaction.xml,security-*.xml,static-bean-references.xml,boot/datasource.xml</include>
</resource>
<resource>
<path>db-ojb</path>
@@ -146,6 +142,12 @@
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
+ <testResource>
+ <directory>src/test/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
</testResources>
</build>
</project>
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml?rev=734954&r1=734953&r2=734954&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/JETSPEED-INF/ojb/sso_repository.xml Fri Jan 16 02:07:13 2009
@@ -18,87 +18,6 @@
<descriptor-repository version="1.0">
-<!--
- - S E C U R I T Y P R I N C I P A L (Short version for SSO lookup)
- -->
- <class-descriptor
- class="org.apache.jetspeed.sso.impl.SSOPrincipalImpl"
- proxy="dynamic"
- table="SECURITY_PRINCIPAL"
- >
- <documentation>Represents a user principal.</documentation>
- <field-descriptor
- name="principalId"
- column="principal_id"
- jdbc-type="BIGINT"
- primarykey="true"
- indexed="true"
- autoincrement="true"
- >
- </field-descriptor>
- <field-descriptor
- name="classname"
- column="classname"
- jdbc-type="VARCHAR"
- nullable="false"
- length="254"
- >
- </field-descriptor>
- <field-descriptor
- name="isMappingOnly"
- column="is_mapping_only"
- jdbc-type="INTEGER"
- conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
- <field-descriptor
- name="fullPath"
- column="full_path"
- jdbc-type="VARCHAR"
- nullable="false"
- length="254"
- >
- </field-descriptor>
- <field-descriptor
- name="creationDate"
- column="creation_date"
- jdbc-type="TIMESTAMP"
- nullable="false"
- >
- </field-descriptor>
- <field-descriptor
- name="modifiedDate"
- column="modified_date"
- jdbc-type="TIMESTAMP"
- nullable="false"
- >
- </field-descriptor>
- <field-descriptor
- name="enabled"
- column="is_enabled"
- jdbc-type="INTEGER"
- conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
- <collection-descriptor
- name="remotePrincipals"
- element-class-ref="org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl"
- proxy="true"
- refresh="true"
- auto-retrieve="true"
- auto-update="object"
- auto-delete="object"
- indirection-table="SSO_PRINCIPAL_TO_REMOTE"
- >
- <documentation>This is the reference to principals.</documentation>
- <fk-pointing-to-this-class column="PRINCIPAL_ID"/>
- <fk-pointing-to-element-class column="REMOTE_PRINCIPAL_ID"/>
- </collection-descriptor>
- </class-descriptor>
-
-
<!--
- S I T E
-->
@@ -109,164 +28,72 @@
>
<documentation>Represents the single sign on site</documentation>
<field-descriptor
- name="siteId"
+ name="id"
column="SITE_ID"
jdbc-type="INTEGER"
primarykey="true"
indexed="true"
- autoincrement="true"
- >
- </field-descriptor>
+ autoincrement="true"/>
<field-descriptor
name="name"
column="NAME"
jdbc-type="VARCHAR"
nullable="false"
- length="254"
- >
- </field-descriptor>
+ indexed="true"
+ length="254"/>
<field-descriptor
- name="siteURL"
+ name="url"
column="URL"
jdbc-type="VARCHAR"
nullable="false"
- length="254"
- >
- </field-descriptor>
+ length="254"/>
<field-descriptor
name="isAllowUserSet"
column="ALLOW_USER_SET"
jdbc-type="INTEGER"
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
+ nullable="false"/>
<field-descriptor
name="isCertificateRequired"
column="REQUIRES_CERTIFICATE"
jdbc-type="INTEGER"
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
-
+ nullable="false"/>
<field-descriptor
- name="isChallangeResponseAuthentication"
+ name="challengeResponseAuthentication"
column="CHALLENGE_RESPONSE_AUTH"
jdbc-type="INTEGER"
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
+ nullable="false"/>
<field-descriptor
name="isFormAuthentication"
column="FORM_AUTH"
jdbc-type="INTEGER"
conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
- nullable="false"
- >
- </field-descriptor>
+ nullable="false"/>
<field-descriptor
name="formUserField"
column="FORM_USER_FIELD"
jdbc-type="VARCHAR"
nullable="false"
- length="128"
- >
- </field-descriptor>
+ length="128"/>
<field-descriptor
name="formPwdField"
column="FORM_PWD_FIELD"
jdbc-type="VARCHAR"
nullable="false"
- length="128"
- >
- </field-descriptor>
- <field-descriptor
- name="realm"
- column="REALM"
- jdbc-type="VARCHAR"
- nullable="false"
- length="128"
- >
- </field-descriptor>
- <collection-descriptor
- name="principals"
- element-class-ref="org.apache.jetspeed.sso.impl.SSOPrincipalImpl"
- proxy="true"
- refresh="true"
- auto-retrieve="true"
- auto-update="object"
- auto-delete="object"
- indirection-table="SSO_SITE_TO_PRINCIPALS"
- >
- <documentation>This is the reference to principals.</documentation>
- <fk-pointing-to-this-class column="SITE_ID"/>
- <fk-pointing-to-element-class column="PRINCIPAL_ID"/>
- </collection-descriptor>
- <collection-descriptor
- name="remotePrincipals"
- element-class-ref="org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl"
- proxy="true"
- refresh="true"
- auto-retrieve="true"
- auto-update="object"
- auto-delete="object"
- indirection-table="SSO_SITE_TO_REMOTE"
- >
- <documentation>This is the reference to principals.</documentation>
- <fk-pointing-to-this-class column="SITE_ID"/>
- <fk-pointing-to-element-class column="PRINCIPAL_ID"/>
- </collection-descriptor>
+ length="128"/>
+ <field-descriptor
+ name="realm"
+ column="REALM"
+ jdbc-type="VARCHAR"
+ nullable="false"
+ length="128"/>
+ <field-descriptor
+ name="securityDomainId"
+ nullable="false"
+ jdbc-type="BIGINT"
+ column="domain_id"/>
</class-descriptor>
- <!-- SSO Cookie -->
-
- <class-descriptor
- class="org.apache.jetspeed.sso.impl.SSOCookieImpl"
- proxy="dynamic"
- table="SSO_COOKIE"
- >
- <documentation>Represents the single sign on cookie</documentation>
- <field-descriptor
- name="cookieId"
- column="COOKIE_ID"
- jdbc-type="INTEGER"
- primarykey="true"
- indexed="true"
- autoincrement="true"
- >
- </field-descriptor>
- <field-descriptor
- name="cookie"
- column="COOKIE"
- jdbc-type="VARCHAR"
- nullable="false"
- length="1024"
- >
- </field-descriptor>
- <field-descriptor
- name="createDate"
- column="CREATE_DATE"
- jdbc-type="TIMESTAMP"
- nullable="false"
- >
- </field-descriptor>
-
- <collection-descriptor
- name="remotePrincipals"
- element-class-ref="org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl"
- proxy="true"
- refresh="true"
- auto-retrieve="true"
- auto-update="object"
- auto-delete="object"
- indirection-table="SSO_COOKIE_TO_REMOTE"
- >
- <documentation>This is the reference to principals for a cookie.</documentation>
- <fk-pointing-to-this-class column="COOKIE_ID"/>
- <fk-pointing-to-element-class column="REMOTE_PRINCIPAL_ID"/>
- </collection-descriptor>
- </class-descriptor>
-
</descriptor-repository>
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java?rev=734954&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java Fri Jan 16 02:07:13 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.sso.impl;
+
+import org.apache.jetspeed.security.impl.JetspeedPrincipalAssociationTypeImpl;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
+import org.apache.jetspeed.security.spi.impl.BaseJetspeedPrincipalAssociationHandler;
+
+/**
+ * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
+ * @version $Id$
+ */
+public class IsOwnedByPrincipalAssociationHandler extends BaseJetspeedPrincipalAssociationHandler
+{
+ public static final String ASSOCIATION_NAME = "ownedBy";
+
+ public IsOwnedByPrincipalAssociationHandler(JetspeedPrincipalManagerSPI from, JetspeedPrincipalManagerSPI to, JetspeedPrincipalAssociationStorageManager jpasm)
+ {
+ super(new JetspeedPrincipalAssociationTypeImpl(ASSOCIATION_NAME, from.getPrincipalType(), to.getPrincipalType(), false, true, true, false), from, to, jpasm);
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsOwnedByPrincipalAssociationHandler.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java?rev=734954&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java Fri Jan 16 02:07:13 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.sso.impl;
+
+import org.apache.jetspeed.security.impl.JetspeedPrincipalAssociationTypeImpl;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
+import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
+import org.apache.jetspeed.security.spi.impl.BaseJetspeedPrincipalAssociationHandler;
+
+/**
+ * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
+ * @version $Id$
+ */
+public class IsRemoteIdentityForPrincipalAssociationHandler extends BaseJetspeedPrincipalAssociationHandler
+{
+ public static final String ASSOCIATION_NAME = "isRemoteIdFor";
+
+ public IsRemoteIdentityForPrincipalAssociationHandler(JetspeedPrincipalManagerSPI from, JetspeedPrincipalManagerSPI to, JetspeedPrincipalAssociationStorageManager jpasm)
+ {
+ super(new JetspeedPrincipalAssociationTypeImpl(ASSOCIATION_NAME, from.getPrincipalType(), to.getPrincipalType(), false, false, false, false), from, to, jpasm);
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/IsRemoteIdentityForPrincipalAssociationHandler.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java?rev=734954&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java Fri Jan 16 02:07:13 2009
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.sso.impl;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.sso.SSOClient;
+import org.apache.jetspeed.sso.SSOException;
+import org.apache.jetspeed.sso.SSOSite;
+
+
+/**
+ * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
+ * @version $Id$
+ */
+public class SSOClientImpl implements SSOClient
+{
+
+ /* Logging */
+ private static final Log log = LogFactory.getLog(SSOClientImpl.class);
+
+ private SSOSite site;
+ private PasswordCredential credential;
+ private HttpClient httpClient;
+
+ public SSOClientImpl(SSOSite site, PasswordCredential credential)
+ {
+ super();
+ this.credential = credential;
+ this.site = site;
+ }
+
+ public String get(String destUrl, boolean refreshProxy) throws SSOException {
+ StringWriter sw = new StringWriter();
+ write(destUrl,refreshProxy,sw);
+ return sw.toString();
+ }
+
+ public void write(String destUrl, boolean refreshProxy, Writer out) throws SSOException
+ {
+
+ GetMethod get = null;
+
+ if (refreshProxy == true || httpClient == null)
+ {
+ get = new GetMethod(site.getURL());
+
+ login(get);
+
+ /*
+ * If the destination URL and the SSO url match
+ * use the authentication process but return immediately
+ * the result page.
+ */
+ if( destUrl.compareTo(site.getURL()) == 0)
+ {
+ try{
+ IOUtils.copy(get.getResponseBodyAsStream(), out);
+ } catch (IOException ioe){
+ log.error("Error while reading response from remote site at "+destUrl);
+ }
+ get.releaseConnection();
+ return;
+ } else {
+ get.releaseConnection();
+ }
+ }
+
+ // All the SSO authentication done go to the destination url
+ get = new GetMethod(destUrl);
+ try {
+ // execute the GET
+ httpClient.executeMethod( get );
+
+ } catch (Exception e) {
+ log.error("Exception while fetching SSO content. Error: " +e);
+ }
+
+
+ try
+ {
+ IOUtils.copy(get.getResponseBodyAsStream(), out);
+ }
+ catch(IOException ioe)
+ {
+ throw new SSOException ("SSO Component Error. Failed to get content for URL " + destUrl, ioe);
+ }
+ catch (Exception e)
+ {
+ throw new SSOException ("SSO Component Error. Failed to get content for URL " + destUrl, e);
+
+ }
+
+ get.releaseConnection();
+
+ return;
+ }
+
+ public boolean login() throws SSOException {
+ GetMethod get = new GetMethod(site.getURL().toString());
+
+ int status = login(get);
+
+ get.releaseConnection();
+
+ return status >= 200 && status < 300;
+ }
+
+ private int login(GetMethod get) throws SSOException {
+ URL url = null;
+
+ try{
+ url = new URL(site.getURL());
+ } catch (MalformedURLException muex){
+ log.error(muex);
+ throw new SSOException("SSO: Marlformed url: "+site.getURL());
+ }
+ httpClient = new HttpClient();
+ httpClient.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY);
+
+ httpClient.getState().setCredentials(
+ site.getRealm(),
+ url.getHost(),
+ new UsernamePasswordCredentials(credential.getUserName(), this.unscramble(credential.getPassword()))
+ );
+ // Build URL if it's Form authentication
+ StringBuffer siteURL = new StringBuffer(site.getURL());
+
+ // Check if it's form based or ChallengeResponse
+ if (site.isFormAuthentication())
+ {
+ siteURL.append("?").append(site.getFormUserField()).append("=").append(credential.getUserName()).append("&").append(site.getFormPwdField()).append("=").append(this.unscramble(credential.getPassword()));
+ }
+
+ get.setDoAuthentication( true );
+ // execute the GET
+ int status = -1;
+
+ try{
+ status = httpClient.executeMethod( get );
+ } catch (IOException ioe){
+ log.error("SSO: Error executing get method for url "+site.getURL());
+ throw new SSOException(ioe);
+ }
+ return status;
+ }
+
+ static char[] scrambler ="Jestspeed-2 is getting ready for release".toCharArray();
+
+ private char[] xor(char[] a, char[]b)
+ {
+ int len = Math.min(a.length, b.length);
+ char[] result = new char[len];
+ for(int i=0; i<len;i++)
+ {
+ result[i] = (char) (a[i] ^ b[i]);
+ }
+ return result;
+ }
+
+ private String unscramble(String pwd)
+ {
+ byte[] bytes = pwd.getBytes();
+ bytes = Base64.decodeBase64(bytes);
+ String chars = new String(bytes);
+ String unscrambled = new String(xor(chars.toCharArray(), scrambler));
+ return unscrambled;
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOClientImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java?rev=734954&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java Fri Jan 16 02:07:13 2009
@@ -0,0 +1,409 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.sso.impl;
+
+import java.security.Principal;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityDomain;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.impl.SecurityDomainImpl;
+import org.apache.jetspeed.security.spi.SecurityDomainAccessManager;
+import org.apache.jetspeed.security.spi.SecurityDomainStorageManager;
+import org.apache.jetspeed.security.spi.impl.PasswordCredentialImpl;
+import org.apache.jetspeed.sso.SSOClient;
+import org.apache.jetspeed.sso.SSOException;
+import org.apache.jetspeed.sso.SSOManager;
+import org.apache.jetspeed.sso.SSOSite;
+import org.apache.jetspeed.sso.SSOUser;
+import org.apache.jetspeed.sso.spi.SSOSiteManagerSPI;
+import org.apache.jetspeed.sso.spi.SSOUserManagerSPI;
+
+
+/**
+ * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
+ * @version $Id$
+ */
+public class SSOManagerImpl implements SSOManager
+{
+ /* Logging */
+ private static final Log log = LogFactory.getLog(SSOManagerImpl.class);
+
+ private UserManager userManager;
+ private SSOUserManagerSPI ssoUserManagerSPI;
+
+ private SecurityDomainAccessManager domainAccessManager;
+ private SecurityDomainStorageManager domainStorageManager;
+ private SSOSiteManagerSPI ssoSiteManagerSPI;
+
+ private Long defaultDomainId;
+
+ public SSOClient getClient(SSOSite site, SSOUser remoteUser) throws SSOException {
+ PasswordCredential pwdCred = getCredentials(remoteUser);
+ return new SSOClientImpl(site,pwdCred);
+ }
+
+ protected User getUser(String username) {
+ User user = null;
+ try{
+ user = userManager.getUser(username);
+ } catch (SecurityException secex){
+ }
+ return user;
+ }
+
+ protected Collection<SSOUser> getRemoteUsers(JetspeedPrincipal p) throws SSOException {
+ try{
+ return ssoUserManagerSPI.getUsers(p);
+ } catch (SecurityException secex){
+ throw new SSOException(secex);
+ }
+ }
+
+ public Collection<SSOUser> getRemoteUsers(SSOSite site, Subject subject) throws SSOException {
+ Map<Long,SSOUser> resultUsers = new HashMap<Long,SSOUser>();
+ for (Principal p : subject.getPrincipals()){
+ if (p instanceof JetspeedPrincipal){
+ try{
+ Collection<SSOUser> usersForThisPrincipal = getRemoteUsers(site,(JetspeedPrincipal)p);
+ for (SSOUser user : usersForThisPrincipal)
+ {
+ if (!resultUsers.containsKey(user.getId())){
+ resultUsers.put(user.getId(), user);
+ }
+ }
+ } catch (SSOException se){
+ throw new SSOException(se);
+ }
+ }
+ }
+ return resultUsers.values();
+ }
+
+ public Collection<SSOUser> getRemoteUsers(SSOSite site, JetspeedPrincipal portalPrincipal) throws SSOException {
+ try{
+ return ssoUserManagerSPI.getUsers(portalPrincipal,site.getSecurityDomainId());
+ } catch (SecurityException secex){
+ throw new SSOException(secex);
+ }
+ }
+
+
+ public void setPassword(SSOUser user, String pwd) throws SSOException
+ {
+ PasswordCredential pwdCred = null;
+
+ try{
+ pwdCred=ssoUserManagerSPI.getPasswordCredential(user);
+ } catch (SecurityException secex){
+
+ }
+ if (pwdCred != null){
+ pwdCred.setPassword(pwd, false);
+ } else {
+ pwdCred=new PasswordCredentialImpl(user,pwd);
+ }
+
+ try{
+ ssoUserManagerSPI.storePasswordCredential(pwdCred);
+ } catch (SecurityException sx){
+ throw new SSOException(sx);
+ }
+ }
+
+ public Collection<JetspeedPrincipal> getPortalPrincipals(SSOUser user)
+ {
+ SSOSite site = ssoSiteManagerSPI.getSite(user);
+ if (site != null){
+ SecurityDomain ssoDomain = domainAccessManager.getDomain(site.getSecurityDomainId());
+ SecurityDomain ownerDomain = domainAccessManager.getDomain(ssoDomain.getOwnerDomainId());
+ return ssoUserManagerSPI.getPortalPrincipals(user,ownerDomain.getDomainId());
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ protected Long getDefaultDomainId(){
+ if (defaultDomainId==null){
+ SecurityDomain domain=domainAccessManager.getDomainByName(SecurityDomain.DEFAULT_NAME);
+ if (domain == null){
+ throw new RuntimeException("Could not find default security domain.");
+ }
+ defaultDomainId=domain.getDomainId();
+ }
+ return defaultDomainId;
+ }
+
+ public SSOSite addSite(SSOSite site) throws SSOException {
+
+ return this.addSite(getDefaultDomainId(), site);
+ }
+
+ protected SSOSite addSite(Long ownerDomainId, SSOSite site) throws SSOException
+ {
+ if (domainAccessManager.getDomainByName(site.getName()) != null){
+ throw new SSOException(SSOException.SITE_ALREADY_EXISTS);
+ }
+
+ SecurityDomainImpl sd = new SecurityDomainImpl();
+ sd.setName(site.getName());
+ sd.setOwnerDomainId(ownerDomainId);
+ sd.setEnabled(true);
+ sd.setRemote(true);
+
+ try{
+ domainStorageManager.addDomain(sd);
+ } catch(SecurityException sx){
+ log.error("Could not add remote security domain with name "+site.getName()+" for owner domain "+ownerDomainId);
+ throw new SSOException(SSOException.SITE_COULD_NOT_BE_CREATED,sx);
+ }
+ SecurityDomain storedDomain = domainAccessManager.getDomainByName(site.getName());
+ if (storedDomain == null || storedDomain.getDomainId() == null){
+ throw new SSOException(SSOException.SITE_COULD_NOT_BE_CREATED);
+ }
+
+ site.setSecurityDomainId(storedDomain.getDomainId());
+
+ try{
+ return ssoSiteManagerSPI.add(site);
+ } catch (SSOException se){
+ // catch SSO Exception to remove already stored domain.
+ try{
+ domainStorageManager.removeDomain(storedDomain);
+ } catch (SecurityException secex){
+
+ }
+ // rethrow exception
+ throw new SSOException(se);
+ }
+ }
+
+ public PasswordCredential getCredentials(SSOUser user) throws SSOException
+ {
+ try{
+ return ssoUserManagerSPI.getPasswordCredential(user);
+ } catch (SecurityException secex){
+ // TODO provide meaningful message
+ throw new SSOException(secex);
+ }
+ }
+
+ public Collection<SSOSite> getSites(String filter)
+ {
+ return ssoSiteManagerSPI.getSites(filter);
+ }
+
+ public Collection<SSOUser> getUsersForSite(SSOSite site) throws SSOException
+ {
+ try{
+ return ssoUserManagerSPI.getUsers("", site.getSecurityDomainId());
+ } catch (SecurityException e){
+ throw new SSOException("Could not fetch SSO users for site "+site.getName(),e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<SSOSite> getSitesForPrincipal(JetspeedPrincipal localPrincipal) throws SSOException
+ {
+ Collection<SSOSite> sitesFound = null;
+ if (localPrincipal != null){
+ Collection<SSOUser> ssoUsers = getRemoteUsers(localPrincipal);
+ if (ssoUsers != null && ssoUsers.size() > 0){
+ sitesFound = ssoSiteManagerSPI.getSites(ssoUsers);
+ }
+ }
+ return sitesFound != null ? sitesFound : Collections.EMPTY_SET;
+ }
+
+ public Collection<SSOSite> getSitesForSubject(Subject subject) throws SSOException {
+ Map<Integer,SSOSite> siteIdToSite = new HashMap<Integer,SSOSite>();
+ for (Principal p : subject.getPrincipals()){
+ if (p instanceof JetspeedPrincipal){
+ try {
+ Collection<SSOSite> sitesForThisPrincipal = getSitesForPrincipal((JetspeedPrincipal)p);
+ for (SSOSite site : sitesForThisPrincipal)
+ {
+ if (!siteIdToSite.containsKey(site.getId())){
+ siteIdToSite.put(site.getId(), site);
+ }
+ }
+ } catch (SSOException se){
+
+ }
+ }
+ }
+ return siteIdToSite.values();
+ }
+
+ public void addAssociation(SSOUser user, JetspeedPrincipal principal) throws SSOException
+ {
+ try{
+ ssoUserManagerSPI.addSSOUserToPrincipal(user, principal);
+ } catch (SecurityException secex){
+ throw new SSOException("Unable to associate principal "+principal.getName() + " with SSO user "+user.getName());
+ }
+
+ }
+
+ public SSOUser addUser(SSOSite site, JetspeedPrincipal ownerPrincipal,
+ String ssoUsername, String ssoUserPassword) throws SSOException
+ {
+ SSOUser newUser = null;
+ try{
+ // step 1. create new SSO user
+ newUser = ssoUserManagerSPI.addUser(ssoUsername, site.getSecurityDomainId(), ownerPrincipal);
+ // step 2. store new user's credentials
+ setPassword(newUser, ssoUserPassword);
+ // step 3. relate owner to SSO user
+ addAssociation(newUser, ownerPrincipal);
+ } catch (SecurityException secex){
+ // revert changes, if applicable
+ if (newUser != null){
+ removeUser(newUser);
+ }
+ throw new SSOException("Unable to add new SSO User "+ssoUsername,secex);
+ }
+ return newUser;
+ }
+
+ public void updateUser(SSOUser user) throws SSOException{
+ try{
+ ssoUserManagerSPI.updateUser(user);
+ } catch (SecurityException secex){
+ throw new SSOException("Unable to update user:",secex);
+ }
+ }
+
+ public void removeUser(SSOUser remoteUser)
+ throws SSOException
+ {
+ try{
+ ssoUserManagerSPI.removeUser(remoteUser.getName(), remoteUser.getDomainId());
+ } catch (SecurityException secex){
+ throw new SSOException("Unable to remove SSO User "+remoteUser.getName(),secex);
+ }
+
+
+ }
+
+ public void removeSite(SSOSite site) throws SSOException
+ {
+ SecurityDomain domain = domainAccessManager.getDomain(site.getSecurityDomainId());
+ if (domain != null){
+ try{
+ domainStorageManager.removeDomain(domain);
+ } catch (SecurityException secex){
+ throw new SSOException("Unable to remove security domain (id:"+site.getSecurityDomainId()+") associated with the SSO Site "+site.getName());
+ }
+ }
+
+ ssoSiteManagerSPI.remove(site);
+ }
+
+ public void updateSite(SSOSite site) throws SSOException
+ {
+ SSOSite currentSite = ssoSiteManagerSPI.getById(site.getId());
+ if (currentSite == null){
+ throw new SSOException("Unable to update site: site doesn't exist.");
+ }
+ if (!currentSite.getName().equals(site.getName())){
+ if (domainAccessManager.getDomainByName(site.getName()) != null){
+ throw new SSOException("Unable to rename site to '"+site.getName()+"': a security domain with that name already exists!");
+ }
+ SecurityDomain domain = domainAccessManager.getDomain(currentSite.getSecurityDomainId());
+ SecurityDomainImpl renamedDomain = new SecurityDomainImpl(domain);
+ renamedDomain.setName(site.getName());
+ try{
+ domainStorageManager.updateDomain(renamedDomain);
+ } catch (SecurityException secex){
+ throw new SSOException("Unable to rename security domain "+domain.getName()+" to "+site.getName()+".",secex);
+ }
+ }
+ ssoSiteManagerSPI.update(site);
+ }
+
+ public SSOUser getRemoteUser(SSOSite site, String remoteUsername ) {
+ try{
+ return ssoUserManagerSPI.getUser(remoteUsername, site.getSecurityDomainId());
+ } catch (SecurityException secex){
+ log.debug("Could not find SSO user with name "+remoteUsername+" from remote site "+site.getName()+" (domain id: "+site.getSecurityDomainId()+")", secex);
+ return null;
+ }
+ }
+
+ public SSOSite getSiteByUrl(String siteUrl)
+ {
+ return ssoSiteManagerSPI.getByUrl(siteUrl);
+ }
+
+ public SSOSite getSiteByName(String siteName)
+ {
+ return ssoSiteManagerSPI.getByName(siteName);
+ }
+
+ public SSOSite getSiteById(int id)
+ {
+ return ssoSiteManagerSPI.getById(id);
+ }
+
+ public SSOSite newSite(String name, String url){
+ return new SSOSiteImpl(name,url);
+ }
+
+ public void setUserManager(UserManager userMan)
+ {
+ this.userManager = userMan;
+ }
+
+
+ public void setSSOUserManagerSPI(SSOUserManagerSPI ssoUserManSPI)
+ {
+ this.ssoUserManagerSPI = ssoUserManSPI;
+ }
+
+
+ public void setDomainAccessManager(SecurityDomainAccessManager domainAccess)
+ {
+ this.domainAccessManager = domainAccess;
+ }
+
+
+ public void setDomainStorageManager(SecurityDomainStorageManager domainStore)
+ {
+ this.domainStorageManager = domainStore;
+ }
+
+ public void setSSOSiteManagerSPI(SSOSiteManagerSPI ssoSiteManSPI)
+ {
+ this.ssoSiteManagerSPI = ssoSiteManSPI;
+ }
+
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/sso/impl/SSOManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org