1 package org.apache.fulcrum.security; 2 3 56 57 import java.util.Map ; 58 59 import org.apache.fulcrum.Service; 60 61 import org.apache.fulcrum.security.entity.Group; 62 import org.apache.fulcrum.security.entity.Permission; 63 import org.apache.fulcrum.security.entity.Role; 64 import org.apache.fulcrum.security.entity.User; 65 66 import org.apache.fulcrum.security.util.AccessControlList; 67 import org.apache.fulcrum.security.util.DataBackendException; 68 import org.apache.fulcrum.security.util.EntityExistsException; 69 import org.apache.fulcrum.security.util.GroupSet; 70 import org.apache.fulcrum.security.util.PasswordMismatchException; 71 import org.apache.fulcrum.security.util.PermissionSet; 72 import org.apache.fulcrum.security.util.RoleSet; 73 import org.apache.fulcrum.security.util.UnknownEntityException; 74 75 import org.apache.torque.util.Criteria; 76 77 95 public interface SecurityService 96 extends Service 97 { 98 99 public static final String SERVICE_NAME = "SecurityService"; 100 101 102 public static final String USER_CLASS_KEY = "user.class"; 103 104 105 public static final String USER_CLASS_DEFAULT = "org.apache.fulcrum.security.impl.db.entity.TurbineUser"; 106 107 108 public static final String GROUP_CLASS_KEY = "group.class"; 109 110 111 public static final String GROUP_CLASS_DEFAULT = "org.apache.fulcrum.security.impl.db.entity.TurbineGroup"; 112 113 114 public static final String PERMISSION_CLASS_KEY = "permission.class"; 115 116 117 public static final String PERMISSION_CLASS_DEFAULT = "org.apache.fulcrum.security.impl.db.entity.TurbinePermission"; 118 119 120 public static final String ROLE_CLASS_KEY = "role.class"; 121 122 123 public static final String ROLE_CLASS_DEFAULT = "org.apache.fulcrum.security.impl.db.entity.TurbineRole"; 124 125 126 public static final String ACL_CLASS_KEY = "acl.class"; 127 128 129 public static final String ACL_CLASS_DEFAULT = "org.apache.fulcrum.security.impl.TurbineAccessControlList"; 130 131 132 public static final String USER_MANAGER_KEY = "user.manager"; 133 134 135 public static final String USER_MANAGER_DEFAULT = "org.apache.fulcrum.security.impl.db.DBUserManager"; 136 137 138 public static final String SECURE_PASSWORDS_KEY = "secure.passwords"; 139 140 141 public static final String SECURE_PASSWORDS_DEFAULT = "false"; 142 143 144 public static final String SECURE_PASSWORDS_ALGORITHM_KEY = "secure.passwords.algorithm"; 145 146 147 public static final String SECURE_PASSWORDS_ALGORITHM_DEFAULT = "SHA"; 148 149 152 153 161 Class getUserClass() 162 throws UnknownEntityException; 163 164 173 User getUserInstance() 174 throws UnknownEntityException; 175 176 187 User getUserInstance(String userName) 188 throws UnknownEntityException; 189 190 198 Class getGroupClass() 199 throws UnknownEntityException; 200 201 210 Group getGroupInstance() 211 throws UnknownEntityException; 212 213 224 Group getGroupInstance(String groupName) 225 throws UnknownEntityException; 226 227 235 Class getPermissionClass() 236 throws UnknownEntityException; 237 238 247 Permission getPermissionInstance() 248 throws UnknownEntityException; 249 250 261 Permission getPermissionInstance(String permName) 262 throws UnknownEntityException; 263 264 272 Class getRoleClass() 273 throws UnknownEntityException; 274 275 284 Role getRoleInstance() 285 throws UnknownEntityException; 286 287 298 Role getRoleInstance(String roleName) 299 throws UnknownEntityException; 300 301 309 Class getAclClass() 310 throws UnknownEntityException; 311 312 324 AccessControlList getAclInstance(Map roles, Map permissions) 325 throws UnknownEntityException; 326 327 338 boolean accountExists(String userName) 339 throws DataBackendException; 340 341 351 boolean accountExists(User user) 352 throws DataBackendException; 353 354 364 User getAuthenticatedUser(String username, String password) 365 throws DataBackendException, UnknownEntityException, PasswordMismatchException; 366 367 375 User getUser(String username) 376 throws DataBackendException, UnknownEntityException; 377 378 392 User[] getUsers(Criteria criteria) 393 throws DataBackendException; 394 395 402 User getAnonymousUser() 403 throws UnknownEntityException; 404 405 416 void saveUser(User user) 417 throws UnknownEntityException, DataBackendException; 418 419 422 423 432 void addUser(User user, String password) 433 throws DataBackendException, EntityExistsException; 434 435 442 void removeUser(User user) 443 throws DataBackendException, UnknownEntityException; 444 445 448 449 459 String encryptPassword(String password); 460 461 474 void changePassword(User user, String oldPassword, String newPassword) 475 throws PasswordMismatchException, UnknownEntityException, 476 DataBackendException; 477 478 493 void forcePassword(User user, String password) 494 throws UnknownEntityException, DataBackendException; 495 496 499 500 510 AccessControlList getACL(User user) 511 throws DataBackendException, UnknownEntityException; 512 513 523 PermissionSet getPermissions(Role role) 524 throws DataBackendException, UnknownEntityException; 525 526 529 530 539 void grant(User user, Group group, Role role) 540 throws DataBackendException, UnknownEntityException; 541 542 551 void revoke(User user, Group group, Role role) 552 throws DataBackendException, UnknownEntityException; 553 554 563 void revokeAll(User user) 564 throws DataBackendException, UnknownEntityException; 565 566 574 void grant(Role role, Permission permission) 575 throws DataBackendException, UnknownEntityException; 576 577 585 void revoke(Role role, Permission permission) 586 throws DataBackendException, UnknownEntityException; 587 588 597 void revokeAll(Role role) 598 throws DataBackendException, UnknownEntityException; 599 600 603 604 610 Group getGlobalGroup(); 611 612 615 Group getNewGroup(String groupName); 616 617 620 Role getNewRole(String roleName); 621 622 625 Permission getNewPermission(String permissionName); 626 627 639 Group getGroup(String name) 640 throws DataBackendException, UnknownEntityException; 641 642 654 Role getRole(String name) 655 throws DataBackendException, UnknownEntityException; 656 657 669 Permission getPermission(String name) 670 throws DataBackendException, UnknownEntityException; 671 672 681 GroupSet getGroups(Criteria criteria) 682 throws DataBackendException; 683 684 693 RoleSet getRoles(Criteria criteria) 694 throws DataBackendException; 695 696 705 PermissionSet getPermissions(Criteria criteria) 706 throws DataBackendException; 707 708 714 GroupSet getAllGroups() 715 throws DataBackendException; 716 717 723 RoleSet getAllRoles() 724 throws DataBackendException; 725 726 732 PermissionSet getAllPermissions() 733 throws DataBackendException; 734 741 void saveGroup(Group group) 742 throws DataBackendException, UnknownEntityException; 743 744 751 void saveRole(Role role) 752 throws DataBackendException, UnknownEntityException; 753 754 761 void savePermission(Permission permission) 762 throws DataBackendException, UnknownEntityException; 763 764 767 768 776 Group addGroup(Group group) 777 throws DataBackendException, EntityExistsException; 778 779 787 Role addRole(Role role) 788 throws DataBackendException, EntityExistsException; 789 790 798 Permission addPermission(Permission permission) 799 throws DataBackendException, EntityExistsException; 800 801 808 void removeGroup(Group group) 809 throws DataBackendException, UnknownEntityException; 810 811 818 void removeRole(Role role) 819 throws DataBackendException, UnknownEntityException; 820 821 828 void removePermission(Permission permission) 829 throws DataBackendException, UnknownEntityException; 830 831 839 void renameGroup(Group group, String name) 840 throws DataBackendException, UnknownEntityException; 841 842 850 void renameRole(Role role, String name) 851 throws DataBackendException, UnknownEntityException; 852 853 861 void renamePermission(Permission permission, String name) 862 throws DataBackendException, UnknownEntityException; 863 } 864 | Popular Tags |