1 package org.apache.turbine.services.security; 2 3 18 19 import java.util.List ; 20 import java.util.Map ; 21 22 import org.apache.torque.util.Criteria; 23 24 import org.apache.turbine.om.security.Group; 25 import org.apache.turbine.om.security.Permission; 26 import org.apache.turbine.om.security.Role; 27 import org.apache.turbine.om.security.TurbineGroup; 28 import org.apache.turbine.om.security.TurbinePermission; 29 import org.apache.turbine.om.security.TurbineRole; 30 import org.apache.turbine.om.security.TurbineUser; 31 import org.apache.turbine.om.security.User; 32 import org.apache.turbine.services.Service; 33 import org.apache.turbine.services.security.db.DBUserManager; 34 import org.apache.turbine.util.security.AccessControlList; 35 import org.apache.turbine.util.security.DataBackendException; 36 import org.apache.turbine.util.security.EntityExistsException; 37 import org.apache.turbine.util.security.GroupSet; 38 import org.apache.turbine.util.security.PasswordMismatchException; 39 import org.apache.turbine.util.security.PermissionSet; 40 import org.apache.turbine.util.security.RoleSet; 41 import org.apache.turbine.util.security.TurbineAccessControlList; 42 import org.apache.turbine.util.security.UnknownEntityException; 43 44 62 public interface SecurityService 63 extends Service 64 { 65 66 static final String SERVICE_NAME = "SecurityService"; 67 68 72 static final String USER_CLASS_KEY = "user.class"; 73 74 78 static final String USER_CLASS_DEFAULT 79 = TurbineUser.class.getName(); 80 81 85 static final String GROUP_CLASS_KEY = "group.class"; 86 87 91 static final String GROUP_CLASS_DEFAULT 92 = TurbineGroup.class.getName(); 93 94 98 static final String PERMISSION_CLASS_KEY = "permission.class"; 99 100 104 static final String PERMISSION_CLASS_DEFAULT 105 = TurbinePermission.class.getName(); 106 107 111 static final String ROLE_CLASS_KEY = "role.class"; 112 113 117 static final String ROLE_CLASS_DEFAULT 118 = TurbineRole.class.getName(); 119 120 124 static final String ACL_CLASS_KEY = "acl.class"; 125 126 130 static final String ACL_CLASS_DEFAULT 131 = TurbineAccessControlList.class.getName(); 132 133 137 static final String USER_MANAGER_KEY = "user.manager"; 138 139 143 static final String USER_MANAGER_DEFAULT 144 = DBUserManager.class.getName(); 145 146 150 static final String SECURE_PASSWORDS_KEY = "secure.passwords"; 151 152 153 static final String SECURE_PASSWORDS_DEFAULT = "false"; 154 155 159 static final String SECURE_PASSWORDS_ALGORITHM_KEY 160 = "secure.passwords.algorithm"; 161 162 163 static final String SECURE_PASSWORDS_ALGORITHM_DEFAULT = "SHA"; 164 165 168 169 177 Class getUserClass() 178 throws UnknownEntityException; 179 180 189 User getUserInstance() 190 throws UnknownEntityException; 191 192 203 User getUserInstance(String userName) 204 throws UnknownEntityException; 205 206 214 Class getGroupClass() 215 throws UnknownEntityException; 216 217 226 Group getGroupInstance() 227 throws UnknownEntityException; 228 229 240 Group getGroupInstance(String groupName) 241 throws UnknownEntityException; 242 243 251 Class getPermissionClass() 252 throws UnknownEntityException; 253 254 263 Permission getPermissionInstance() 264 throws UnknownEntityException; 265 266 277 Permission getPermissionInstance(String permName) 278 throws UnknownEntityException; 279 280 288 Class getRoleClass() 289 throws UnknownEntityException; 290 291 300 Role getRoleInstance() 301 throws UnknownEntityException; 302 303 314 Role getRoleInstance(String roleName) 315 throws UnknownEntityException; 316 317 325 Class getAclClass() 326 throws UnknownEntityException; 327 328 340 AccessControlList getAclInstance(Map roles, Map permissions) 341 throws UnknownEntityException; 342 343 348 UserManager getUserManager(); 349 350 355 void setUserManager(UserManager userManager); 356 357 367 boolean accountExists(String userName) 368 throws DataBackendException; 369 370 379 boolean accountExists(User user) 380 throws DataBackendException; 381 382 394 User getAuthenticatedUser(String username, String password) 395 throws DataBackendException, UnknownEntityException, 396 PasswordMismatchException; 397 398 408 User getUser(String username) 409 throws DataBackendException, UnknownEntityException; 410 411 426 User[] getUsers(Criteria criteria) 427 throws DataBackendException; 428 429 443 List getUserList(Criteria criteria) 444 throws DataBackendException; 445 446 454 User getAnonymousUser() 455 throws UnknownEntityException; 456 457 466 boolean isAnonymousUser(User u); 467 468 477 void saveUser(User user) 478 throws UnknownEntityException, DataBackendException; 479 480 492 void saveOnSessionUnbind(User user) 493 throws UnknownEntityException, DataBackendException; 494 495 498 499 508 void addUser(User user, String password) 509 throws DataBackendException, EntityExistsException; 510 511 519 void removeUser(User user) 520 throws DataBackendException, UnknownEntityException; 521 522 525 526 536 String encryptPassword(String password); 537 538 553 String encryptPassword(String password, String salt); 554 555 565 boolean checkPassword(String checkpw, String encpw); 566 567 580 void changePassword(User user, String oldPassword, 581 String newPassword) 582 throws PasswordMismatchException, UnknownEntityException, 583 DataBackendException; 584 585 600 void forcePassword(User user, String password) 601 throws UnknownEntityException, DataBackendException; 602 603 606 607 615 AccessControlList getACL(User user) 616 throws DataBackendException, UnknownEntityException; 617 618 627 PermissionSet getPermissions(Role role) 628 throws DataBackendException, UnknownEntityException; 629 630 633 634 645 void grant(User user, Group group, Role role) 646 throws DataBackendException, UnknownEntityException; 647 648 659 void revoke(User user, Group group, Role role) 660 throws DataBackendException, UnknownEntityException; 661 662 672 void revokeAll(User user) 673 throws DataBackendException, UnknownEntityException; 674 675 684 void grant(Role role, Permission permission) 685 throws DataBackendException, UnknownEntityException; 686 687 696 void revoke(Role role, Permission permission) 697 throws DataBackendException, UnknownEntityException; 698 699 709 void revokeAll(Role role) 710 throws DataBackendException, UnknownEntityException; 711 712 715 716 722 Group getGlobalGroup(); 723 724 727 Group getNewGroup(String groupName); 728 729 732 Role getNewRole(String roleName); 733 734 737 Permission getNewPermission(String permissionName); 738 739 749 Group getGroup(String name) 750 throws DataBackendException, UnknownEntityException; 751 752 761 Group getGroupByName(String name) 762 throws DataBackendException, UnknownEntityException; 763 764 776 Group getGroupById(int id) 777 throws DataBackendException, 778 UnknownEntityException; 779 780 790 Role getRole(String name) 791 throws DataBackendException, UnknownEntityException; 792 793 802 Role getRoleByName(String name) 803 throws DataBackendException, UnknownEntityException; 804 805 817 Role getRoleById(int id) 818 throws DataBackendException, 819 UnknownEntityException; 820 821 831 Permission getPermission(String name) 832 throws DataBackendException, UnknownEntityException; 833 834 843 Permission getPermissionByName(String name) 844 throws DataBackendException, UnknownEntityException; 845 846 858 Permission getPermissionById(int id) 859 throws DataBackendException, 860 UnknownEntityException; 861 862 870 GroupSet getGroups(Criteria criteria) 871 throws DataBackendException; 872 873 881 RoleSet getRoles(Criteria criteria) 882 throws DataBackendException; 883 884 892 PermissionSet getPermissions(Criteria criteria) 893 throws DataBackendException; 894 895 902 GroupSet getAllGroups() 903 throws DataBackendException; 904 905 912 RoleSet getAllRoles() 913 throws DataBackendException; 914 915 922 PermissionSet getAllPermissions() 923 throws DataBackendException; 924 925 933 void saveGroup(Group group) 934 throws DataBackendException, UnknownEntityException; 935 936 944 void saveRole(Role role) 945 throws DataBackendException, UnknownEntityException; 946 947 956 void savePermission(Permission permission) 957 throws DataBackendException, UnknownEntityException; 958 959 962 963 972 Group addGroup(Group group) 973 throws DataBackendException, EntityExistsException; 974 975 984 Role addRole(Role role) 985 throws DataBackendException, EntityExistsException; 986 987 996 Permission addPermission(Permission permission) 997 throws DataBackendException, EntityExistsException; 998 999 1007 void removeGroup(Group group) 1008 throws DataBackendException, UnknownEntityException; 1009 1010 1018 void removeRole(Role role) 1019 throws DataBackendException, UnknownEntityException; 1020 1021 1029 void removePermission(Permission permission) 1030 throws DataBackendException, UnknownEntityException; 1031 1032 1041 void renameGroup(Group group, String name) 1042 throws DataBackendException, UnknownEntityException; 1043 1044 1053 void renameRole(Role role, String name) 1054 throws DataBackendException, UnknownEntityException; 1055 1056 1065 void renamePermission(Permission permission, String name) 1066 throws DataBackendException, UnknownEntityException; 1067} 1068 | Popular Tags |