Author: shane.bryzak(a)jboss.com
Date: 2010-05-31 19:37:43 -0400 (Mon, 31 May 2010)
New Revision: 12914
Removed:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/PasswordEncoder.java
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/PasswordHashEncoder.java
Log:
update IdentityManager api
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
---
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -149,26 +149,48 @@
boolean revokeRole(String username, String roleType, String groupName, String
groupType);
/**
- * Adds a user to the specified group
+ * Associates a user with the specified group
*
- * @param username The username of the user being added to the group
* @param groupName The name of the group the user is being added to
* @param groupType The type of the group
- * @return true if the user was successfully added
+ * @param username The username of the user being added to the group
+ * @return true if the user was successfully associated
*/
- boolean addUserToGroup(String username, String groupName, String groupType);
+ boolean associateUser(String groupName, String groupType, String username);
/**
- * Removes a user from the specified group
+ * Disassociates a user with the specified group
*
- * @param username The username of the user being removed
* @param groupName The name of the group the user is being removed from
* @param groupType The type of the group
- * @return true if the user was successfully removed
+ * @param username The username of the user being removed
+ * @return true if the user was successfully disassociated
*/
- boolean removeUserFromGroup(String username, String groupName, String groupType);
+ boolean disassociateUser(String groupName, String groupType, String username);
/**
+ * Associates a group with the specified "parent" group
+ *
+ * @param groupName The name of the parent group
+ * @param groupType The type of the parent group
+ * @param memberGroupName The name of the member group
+ * @param memberGroupType The type of the member group
+ * @return true if the group was successfully associated
+ */
+ boolean associateGroup(String groupName, String groupType, String memberGroupName,
String memberGroupType);
+
+ /**
+ * Disassociates a member group with the specified "parent" group
+ *
+ * @param groupNameThe name of the parent group
+ * @param groupType The type of the parent group
+ * @param memberGroupName The name of the member group
+ * @param memberGroupType The type of the member group
+ * @return true if the group was successfully disassociated
+ */
+ boolean disassociateGroup(String groupName, String groupType, String memberGroupName,
String memberGroupType);
+
+ /**
* Finds users that match the specified filter. A filter of null will return
* all users.
*
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java
===================================================================
---
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -139,24 +139,6 @@
boolean deleteUserAttribute(String username, String attribute);
/**
- *
- * @param username
- * @param groupName
- * @param groupType
- * @return
- */
- boolean addUserToGroup(String username, String groupName, String groupType);
-
- /**
- *
- * @param username
- * @param groupName
- * @param groupType
- * @return
- */
- boolean removeUserFromGroup(String username, String groupName, String groupType);
-
- /**
* Creates a new role type with the specified role type name.
* @return true if the role type was created successfully.
*/
@@ -203,24 +185,14 @@
*/
boolean createGroup(String name, String groupType);
- /**
- * Add the specified user to the specified group
- *
- * @param user The name of the user
- * @param group The name of the group
- * @return true if the user was successfully added
- */
- boolean addUserToGroup(String username, Group group);
+ boolean associateUser(String groupName, String groupType, String username);
- /**
- * Removes the specified user from the specified group
- *
- * @param user The user to remove
- * @param group The group to remove the user from
- * @return true if the user was successfully removed
- */
- boolean removeUserFromGroup(String username, Group group);
+ boolean disassociateUser(String groupName, String groupType, String username);
+ boolean associateGroup(String groupName, String groupType, String memberGroupName,
String memberGroupType);
+
+ boolean disassociateGroup(String groupName, String groupType, String memberGroupName,
String memberGroupType);
+
/**
* Deletes the specified group
*
Deleted:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/PasswordEncoder.java
===================================================================
---
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/PasswordEncoder.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/PasswordEncoder.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -1,29 +0,0 @@
-package org.jboss.seam.security.management;
-
-import java.util.Map;
-
-/**
- * Encodes user passwords for persistent storage
- *
- * @author Shane Bryzak
- *
- */
-public interface PasswordEncoder
-{
- /**
- * Encodes the specified password
- *
- * @param password
- * @return
- */
- String encodePassword(String password);
-
- /**
- * Encodes the specified password using the provided options
- *
- * @param password
- * @param options
- * @return
- */
- String encodePassword(String password, Map options);
-}
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -127,20 +127,30 @@
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
return roleIdentityStore.revokeRole(name, role, groupName, groupType);
+ }
+
+ public boolean associateUser(String groupName, String groupType, String username)
+ {
+ identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
+ return identityStore.associateUser(groupName, groupType, username);
}
- public boolean addUserToGroup(String username, String groupName, String groupType)
+ public boolean disassociateUser(String groupName, String groupType, String username)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
- return identityStore.addUserToGroup(username, groupName, groupType);
+ return identityStore.disassociateUser(groupName, groupType, username);
}
- public boolean removeUserFromGroup(String username, String groupName, String
groupType)
+ public boolean associateGroup(String groupName, String groupType, String
memberGroupName, String memberGroupType)
{
- identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
- return identityStore.removeUserFromGroup(username, groupName, groupType);
+ return false;
}
+ public boolean disassociateGroup(String groupName, String groupType, String
memberGroupName, String memberGroupType)
+ {
+ return false;
+ }
+
public boolean createRoleType(String roleType)
{
identity.checkPermission(ROLE_PERMISSION_NAME, PERMISSION_CREATE);
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -1,6 +1,7 @@
package org.jboss.seam.security.management;
import java.io.Serializable;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -12,6 +13,7 @@
import org.jboss.seam.security.annotations.management.IdentityProperty;
import org.jboss.seam.security.annotations.management.PropertyType;
+import org.jboss.weld.extensions.util.AbstractBeanProperty;
import org.jboss.weld.extensions.util.AnnotatedBeanProperty;
import org.jboss.weld.extensions.util.TypedBeanProperty;
import org.picketlink.idm.api.Credential;
@@ -37,6 +39,9 @@
private static final String DEFAULT_RELATIONSHIP_TYPE_MEMBERSHIP =
"MEMBERSHIP";
private static final String DEFAULT_RELATIONSHIP_TYPE_ROLE = "ROLE";
+
+ private static final String DEFAULT_ATTRIBUTE_USER_ENABLED = "ENABLED";
+ private static final String DEFAULT_ATTRIBUTE_PASSWORD_SALT =
"PASSWORD_SALT";
private Logger log = LoggerFactory.getLogger(JpaIdentityStore.class);
@@ -72,6 +77,9 @@
private AnnotatedBeanProperty<IdentityProperty> roleTypeNameProperty;
+ private Map<String,AnnotatedBeanProperty<IdentityProperty>>
annotatedProperties =
+ new HashMap<String,AnnotatedBeanProperty<IdentityProperty>>();
+
private String userIdentityType = DEFAULT_USER_IDENTITY_TYPE;
private String roleIdentityType = DEFAULT_ROLE_IDENTITY_TYPE;
private String groupIdentityType = DEFAULT_GROUP_IDENTITY_TYPE;
@@ -273,7 +281,7 @@
/**
*
*/
- @Inject PasswordEncoder passwordEncoder;
+ @Inject CredentialEncoder credentialEncoder;
public boolean createUser(String username, Credential credential,
Map<String, ?> attributes)
@@ -370,18 +378,25 @@
}
}
- public boolean addUserToGroup(String username, String groupName,
- String groupType)
+ public boolean associateUser(String groupName, String groupType, String username)
{
- // TODO Auto-generated method stub
return false;
}
-
- public boolean addUserToGroup(String username, Group group)
+
+ public boolean disassociateUser(String groupName, String groupType, String username)
{
- // TODO Auto-generated method stub
return false;
}
+
+ public boolean associateGroup(String groupName, String groupType, String
memberGroupName, String memberGroupType)
+ {
+ return false;
+ }
+
+ public boolean disassociateGroup(String groupName, String groupType, String
memberGroupName, String memberGroupType)
+ {
+ return false;
+ }
public boolean authenticate(String username, Credential credential)
{
@@ -499,19 +514,6 @@
return null;
}
- public boolean removeUserFromGroup(String username, String groupName,
- String groupType)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean removeUserFromGroup(String username, Group group)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
public boolean revokeRole(String username, String roleType,
String groupName, String groupType)
{
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/PasswordHashEncoder.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/PasswordHashEncoder.java 2010-05-31
23:30:39 UTC (rev 12913)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/PasswordHashEncoder.java 2010-05-31
23:37:43 UTC (rev 12914)
@@ -2,13 +2,15 @@
import java.util.Map;
+import org.picketlink.idm.api.Credential;
+
/**
* Default password encoder, creates password hashes.
*
* @author Shane Bryzak
*
*/
-public class PasswordHashEncoder implements PasswordEncoder
+public class PasswordHashEncoder implements CredentialEncoder
{
private String passwordHash;
private int passwordIterations = 1000;
@@ -32,14 +34,11 @@
{
this.passwordIterations = passwordIterations;
}
-
- public String encodePassword(String password)
+
+ public String encode(Credential credential, Map<String,Object> options)
{
- return encodePassword(password, null);
- }
-
- public String encodePassword(String password, Map options)
- {
+
+ // TODO Auto-generated method stub
return null;
}
}