Author: ate
Date: Thu Sep 4 06:18:48 2008
New Revision: 692002
URL: http://svn.apache.org/viewvc?rev=692002&view=rev
Log:
- adding newUser and newTransientUser methods to UserManager
- redefinition of authentication and Credential handling (only
PasswordCrendential supported)
Added:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
(contents, props changed)
- copied, changed from r691966,
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredentialManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
(contents, props changed)
- copied, changed from r691966,
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedCredentialStorageManager.java
Removed:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredential.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredentialManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedCredentialStorageManager.java
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/AuthenticationProvider.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/UserManager.java
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.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/BaseJetspeedPrincipalManager.java?rev=692002&r1=692001&r2=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipalManager.java
Thu Sep 4 06:18:48 2008
@@ -19,7 +19,6 @@
import java.util.List;
import org.apache.jetspeed.security.DependentPrincipalException;
-import org.apache.jetspeed.security.JetspeedCredentialManager;
import org.apache.jetspeed.security.JetspeedPermission;
import org.apache.jetspeed.security.JetspeedPrincipal;
import org.apache.jetspeed.security.JetspeedPrincipalAssociationHandler;
@@ -76,10 +75,6 @@
return
jetspeedPrincipalAccessManager.getAssociatedTo(principalName,
getPrincipalType(), associationName);
}
- public JetspeedCredentialManager getCredentialManager() {
- return null;
- }
-
public JetspeedPrincipal getPrincipal(String name) {
return jetspeedPrincipalAccessManager.getPrincipal(name,
getPrincipalType());
}
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/AuthenticationProvider.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/AuthenticationProvider.java?rev=692002&r1=692001&r2=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/AuthenticationProvider.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/AuthenticationProvider.java
Thu Sep 4 06:18:48 2008
@@ -16,9 +16,6 @@
*/
package org.apache.jetspeed.security;
-import org.apache.jetspeed.security.spi.CredentialHandler;
-import org.apache.jetspeed.security.spi.UserSecurityHandler;
-
/**
* <p>
* Configures an authentication provider.
@@ -46,42 +43,15 @@
* @return The authentication provider description.
*/
String getProviderDescription();
-
- /**
- * <p>
- * Gets the [EMAIL PROTECTED] UserSecurityHandler}.
- * </p>
- *
- * @return The [EMAIL PROTECTED] UserSecurityHandler}.
- */
- UserSecurityHandler getUserSecurityHandler();
-
-
- /**
- * <p>
- * Sets the [EMAIL PROTECTED] UserSecurityHandler}.
- * </p>
- *
- * @param userSecurityHandler The [EMAIL PROTECTED] UserSecurityHandler}.
- */
- void setUserSecurityHandler(UserSecurityHandler userSecurityHandler);
-
- /**
- * <p>
- * Gets the [EMAIL PROTECTED] CredentialHandler}.
- * </p>
- *
- * @return The [EMAIL PROTECTED] CredentialHandler}.
- */
- CredentialHandler getCredentialHandler();
-
- /**
- * <p>
- * Sets the [EMAIL PROTECTED] CredentialHandler}.
- * </p>
- *
- * @param credHandler The [EMAIL PROTECTED] CredentialHandler}.
- */
- void setCredentialHandler(CredentialHandler credHandler);
-
+
+ /**
+ * <p>
+ * Authenticate a user.
+ * </p>
+ *
+ * @param userName The user name.
+ * @param password The user password.
+ * @return Whether or not a user is authenticated.
+ */
+ boolean authenticate(String userName, String password) throws
SecurityException;
}
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java?rev=692002&r1=692001&r2=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
Thu Sep 4 06:18:48 2008
@@ -31,8 +31,6 @@
void setAccessManager(JetspeedPrincipalAccessManager pm);
- JetspeedCredentialManager getCredentialManager();
-
void addAssociationHandler(JetspeedPrincipalAssociationHandler ah);
boolean principalExists(String name);
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java?rev=692002&r1=692001&r2=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PasswordCredential.java
Thu Sep 4 06:18:48 2008
@@ -32,35 +32,53 @@
String PASSWORD_CREDENTIAL_DAYS_VALID_REQUEST_ATTR_KEY =
PasswordCredential.class.getName() + ".check";
/**
+ * @return The user this PasswordCredential belongs to
+ */
+ User getUser();
+ /**
* @return The username.
*/
- String getUserName();
-
+ String getName();
+
+ void setUserName(String name);
+
+ boolean isReadOnly();
+
/**
* @return The password.
*/
char[] getPassword();
+
+ void setPassword(char[] password);
/**
* @return true if update required.
*/
boolean isUpdateRequired();
+ void setUpdateRequired(boolean updateRequired);
+
/**
* @return true if enabled.
*/
boolean isEnabled();
+ void setEnabled(boolean enabled);
+
/**
* @return true if expired.
*/
boolean isExpired();
+ void setExpired(boolean expired);
+
/**
* @return when the password is (going to be) expired.
*/
Date getExpirationDate();
+ void setExpirationDate(Date expirationDate);
+
/**
* @return the previous time the user logged in
*/
@@ -81,4 +99,6 @@
* @return The number of authentication failures
*/
int getAuthenticationFailures();
+
+ void resetAuthenticationFailured();
}
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=692002&r1=692001&r2=692002&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 4 06:18:48 2008
@@ -16,7 +16,6 @@
*/
package org.apache.jetspeed.security;
-import java.sql.Date;
import java.util.Collection;
import java.util.List;
@@ -39,6 +38,12 @@
*/
String getAnonymousUser();
+ User newUser(String name);
+
+ User newUser(String name, boolean mapped);
+
+ User newTransientUser(String name);
+
/**
* <p>
* Add a new user provided a username and password.
@@ -181,40 +186,6 @@
Collection<User> getUsersInGroup(String groupFullPathName) throws
SecurityException;
/**
- * <p>
- * Set the user password.
- * </p>
- *
- * @param username The user name.
- * @param oldPassword The old password.
- * @param newPassword The new password.
- * @throws Throws a security exception.
- */
- void setPassword(String username, String oldPassword, String newPassword)
throws SecurityException;
-
- /**
- * <p>
- * Set the update required state of the user password credential.
- * </p>
- *
- * @param userName The user name.
- * @param updateRequired The update required state.
- * @throws Throws a security exception.
- */
- void setPasswordUpdateRequired(String userName, boolean updateRequired)
throws SecurityException;
-
- /**
- * <p>
- * Set the enabled state of the user password credential.
- * </p>
- *
- * @param userName The user name.
- * @param enabled The enabled state.
- * @throws Throws a security exception.
- */
- void setPasswordEnabled(String userName, boolean enabled) throws
SecurityException;
-
- /**
* Enable or disable a user.
* @param userName The user name
* @param enabled enabled flag for the user
@@ -222,19 +193,6 @@
void setUserEnabled(String userName, boolean enabled) throws
SecurityException;
/**
- * <p>
- * Set the expiration date and the expired flag of the password
credential.</p>
- * <p>
- * If a date equal or before the current date is provided, the expired
flag will be set to true,
- * otherwise to false.</p>
- *
- * @param userName The user name.
- * @param expirationDate The expiration date to set.
- * @throws Throws a security exception.
- */
- void setPasswordExpiration(String userName, Date expirationDate) throws
SecurityException;
-
- /**
* Updates a user and all attributes and associations
* @param user
* @throws SecurityException
@@ -249,4 +207,15 @@
* @throws SecurityException
*/
Collection<User> lookupUsers(String attributeName, String attributeValue)
throws SecurityException;
+
+ /**
+ * Returns the current PasswordCredential for a User or a new one if the
doesn't have one yet
+ * @param user the user
+ * @return null if the UserManager doesn't support PasswordCredentials
+ */
+ PasswordCredential getPasswordCredential(User user);
+
+ void setPassword(User user, String oldPassword, String newPassword) throws
SecurityException;
+
+ void savePasswordCredential(PasswordCredential credential) throws
SecurityException;
}
\ No newline at end of file
Copied:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
(from r691966,
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredentialManager.java)
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java?p2=portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java&p1=portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredentialManager.java&r1=691966&r2=692002&rev=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedCredentialManager.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
Thu Sep 4 06:18:48 2008
@@ -14,23 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.jetspeed.security;
+package org.apache.jetspeed.security.spi;
import java.util.List;
-import org.apache.jetspeed.security.spi.JetspeedCredentialStorageManager;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.User;
/**
* @version $Id$
*/
-public interface JetspeedCredentialManager extends
JetspeedCredentialStorageManager
+public interface UserPasswordCredentialManager extends
UserPasswordCredentialStorageManager
{
- JetspeedPrincipalType getPrincipalType();
+ boolean isReadOnly();
+
+ void
setUserPasswordCredentialStorageManager(UserPasswordCredentialStorageManager
sm);
+ PasswordCredential newPasswordCredential();
- void setCredentialStorageManager(JetspeedCredentialStorageManager sm);
- JetspeedCredential newCredential();
+ List<PasswordCredential> getPasswordCredentials(String userName);
- List<JetspeedCredential> getCredentials(String principalName);
-
- List<JetspeedCredential> getCredentials(JetspeedPrincipal principal);
+ List<PasswordCredential> getPasswordCredentials(User user);
}
\ No newline at end of file
Propchange:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
(from r691966,
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedCredentialStorageManager.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?p2=portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java&p1=portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedCredentialStorageManager.java&r1=691966&r2=692002&rev=692002&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/JetspeedCredentialStorageManager.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
Thu Sep 4 06:18:48 2008
@@ -16,17 +16,17 @@
*/
package org.apache.jetspeed.security.spi;
-import org.apache.jetspeed.security.JetspeedCredential;
-import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.User;
/**
* @version $Id$
*/
-public interface JetspeedCredentialStorageManager
+public interface UserPasswordCredentialStorageManager
{
- void addCredential(JetspeedCredential credential, JetspeedPrincipal
principal);
+ void addCredential(PasswordCredential credential, User user);
- void updateCredential(JetspeedCredential credential);
+ void updateCredential(PasswordCredential credential);
- void removeCredential(JetspeedCredential credential);
+ void removeCredential(PasswordCredential credential);
}
Propchange:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/spi/UserPasswordCredentialStorageManager.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]