]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/UserAdminService.java
Improve secure logging
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / UserAdminService.java
index 47ea65ecccc1fda91d337c826f0c5b7f4b96ed45..65bc4bb251eb2dba8afe374aa7a3baac656bb818 100644 (file)
@@ -2,26 +2,37 @@ package org.argeo.security;
 
 import java.util.Set;
 
-public interface UserAdminService {
-       /*
-        * USERS
+import org.springframework.security.userdetails.UserDetailsManager;
+
+/** Enrich {@link UserDetailsManager} in order to provide roles semantics. */
+public interface UserAdminService extends UserDetailsManager {
+       /**
+        * Usernames must match this regexp pattern ({@value #USERNAME_PATTERN}).
+        * Thanks to <a href=
+        * "http://www.mkyong.com/regular-expressions/how-to-validate-username-with-regular-expression/"
+        * >this tip</a> (modified to add upper-case, add '@')
         */
-       public void newUser(ArgeoUser argeoUser);
-
-       public ArgeoUser getUser(String username);
+       //public final static String USERNAME_PATTERN = "^[a-zA-Z0-9_-@]{3,64}$";
 
-       public Set<ArgeoUser> listUsers();
-
-       public Boolean userExists(String username);
-
-       public void updateUser(ArgeoUser user);
+       /**
+        * Email addresses must match this regexp pattern ({@value #EMAIL_PATTERN}.
+        * Thanks to <a href=
+        * "http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/"
+        * >this tip</a>.
+        */
+       public final static String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
 
-       public void updateUserPassword(String username, String password);
+       /*
+        * USERS
+        */
+       /** List all users. */
+       public Set<String> listUsers();
 
        /** List users having this role (except the super user). */
-       public Set<ArgeoUser> listUsersInRole(String role);
+       public Set<String> listUsersInRole(String role);
 
-       public void deleteUser(String username);
+       /** Synchronize with the underlying DAO. */
+       public void synchronize();
 
        /*
         * ROLES
@@ -31,9 +42,4 @@ public interface UserAdminService {
        public Set<String> listEditableRoles();
 
        public void deleteRole(String role);
-
-       /*
-        * SYSTEM
-        */
-       public Runnable wrapWithSystemAuthentication(final Runnable runnable);
 }