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 at...@apache.org on 2008/09/11 16:37:09 UTC
svn commit: r694278 - in
/portals/jetspeed-2/portal/branches/security-refactoring:
components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/
components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/
jetspeed-...
Author: ate
Date: Thu Sep 11 07:37:08 2008
New Revision: 694278
URL: http://svn.apache.org/viewvc?rev=694278&view=rev
Log:
Adding basic implementations of UserPasswordCredentialManager and UserPasswordCredentialPolicyManager (unfinished)
Added:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java (with props)
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java (with props)
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialPolicyManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java?rev=694278&r1=694277&r2=694278&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/UserManagerImpl.java Thu Sep 11 07:37:08 2008
@@ -31,7 +31,6 @@
import org.apache.jetspeed.security.GroupManager;
import org.apache.jetspeed.security.JetspeedPrincipal;
import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
-import org.apache.jetspeed.security.JetspeedPrincipalManager;
import org.apache.jetspeed.security.JetspeedPrincipalType;
import org.apache.jetspeed.security.JetspeedSubjectFactory;
import org.apache.jetspeed.security.PasswordCredential;
@@ -137,7 +136,7 @@
return anonymousUser;
}
- public PasswordCredential getPasswordCredential(User user)
+ public PasswordCredential getPasswordCredential(User user) throws SecurityException
{
if (credentialManager != null)
{
Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java?rev=694278&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java Thu Sep 11 07:37:08 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.security.spi.impl;
+
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.spi.UserPasswordCredentialManager;
+import org.apache.jetspeed.security.spi.UserPasswordCredentialPolicyManager;
+import org.apache.jetspeed.security.spi.UserPasswordCredentialStorageManager;
+
+/**
+ * @version $Id$
+ */
+public class UserPasswordCredentialManagerImpl implements UserPasswordCredentialManager
+{
+ private UserPasswordCredentialStorageManager upcsm;
+ private UserPasswordCredentialPolicyManager upcpm;
+
+ public UserPasswordCredentialManagerImpl(UserPasswordCredentialStorageManager upcsm)
+ {
+ this.upcsm = upcsm;
+ }
+
+ public UserPasswordCredentialManagerImpl(UserPasswordCredentialStorageManager upcsm, UserPasswordCredentialPolicyManager upcpm)
+ {
+ this(upcsm);
+ this.upcpm = upcpm;
+ }
+
+ public PasswordCredential getPasswordCredential(User user) throws SecurityException
+ {
+ PasswordCredential credential = upcsm.getPasswordCredential(user);
+ if (upcpm != null)
+ {
+ upcpm.onLoad(credential, user.getName());
+ }
+ return credential;
+ }
+
+ public void storePasswordCredential(PasswordCredential credential) throws SecurityException
+ {
+ if (upcpm != null)
+ {
+ upcpm.onStore(credential);
+ }
+ upcsm.storePasswordCredential(credential);
+ }
+}
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java?rev=694278&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java Thu Sep 11 07:37:08 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.security.spi.impl;
+
+import java.util.List;
+
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.spi.CredentialPasswordEncoder;
+import org.apache.jetspeed.security.spi.CredentialPasswordValidator;
+import org.apache.jetspeed.security.spi.PasswordCredentialInterceptor;
+import org.apache.jetspeed.security.spi.UserPasswordCredentialPolicyManager;
+
+/**
+ * @version $Id$
+ *
+ */
+public class UserPasswordCredentialPolicyManagerImpl implements UserPasswordCredentialPolicyManager
+{
+ private CredentialPasswordEncoder encoder;
+ private CredentialPasswordValidator validator;
+ private PasswordCredentialInterceptor[] interceptors;
+
+ public UserPasswordCredentialPolicyManagerImpl()
+ {
+ this.interceptors = new PasswordCredentialInterceptor[0];
+ }
+
+ public UserPasswordCredentialPolicyManagerImpl(CredentialPasswordEncoder encoder, CredentialPasswordValidator validator, List<?> interceptors)
+ {
+ this.encoder = encoder;
+ this.validator = validator;
+ this.interceptors = (PasswordCredentialInterceptor[]) interceptors.toArray(new PasswordCredentialInterceptor[interceptors.size()]);
+ }
+
+ public CredentialPasswordEncoder getCredentialPasswordEncoder()
+ {
+ return encoder;
+ }
+
+ public CredentialPasswordValidator getCredentialPasswordValidator()
+ {
+ return validator;
+ }
+
+ public void onLoad(PasswordCredential credential, String userName)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean authenticate(PasswordCredential credential, String userName, String password) throws SecurityException
+ {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ public void onStore(PasswordCredential credential)
+ {
+ // TODO Auto-generated method stub
+ }
+}
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java?rev=694278&r1=694277&r2=694278&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java Thu Sep 11 07:37:08 2008
@@ -195,7 +195,7 @@
* @param user the user
* @return null if the UserManager doesn't support PasswordCredentials
*/
- PasswordCredential getPasswordCredential(User user);
+ PasswordCredential getPasswordCredential(User user) throws SecurityException;
void storePasswordCredential(PasswordCredential credential) throws SecurityException;
}
\ No newline at end of file
Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialPolicyManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialPolicyManager.java?rev=694278&r1=694277&r2=694278&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialPolicyManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialPolicyManager.java Thu Sep 11 07:37:08 2008
@@ -18,13 +18,14 @@
package org.apache.jetspeed.security.spi;
import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
/**
* @version $Id$
*
*/
public interface UserPasswordCredentialPolicyManager
-{
+{
CredentialPasswordEncoder getCredentialPasswordEncoder();
CredentialPasswordValidator getCredentialPasswordValidator();
void onLoad(PasswordCredential credential, String userName) throws SecurityException;
Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java?rev=694278&r1=694277&r2=694278&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java Thu Sep 11 07:37:08 2008
@@ -25,6 +25,6 @@
*/
public interface UserPasswordCredentialStorageManager
{
- PasswordCredential getPasswordCredential(User user);
+ PasswordCredential getPasswordCredential(User user) throws SecurityException;
void storePasswordCredential(PasswordCredential credential) throws SecurityException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org