| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| Authz |
|
| 1.0;1 |
| 1 | /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited |
|
| 2 | * |
|
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 4 | * you may not use this file except in compliance with the License. |
|
| 5 | * You may obtain a copy of the License at |
|
| 6 | * |
|
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | * |
|
| 9 | * Unless required by applicable law or agreed to in writing, software |
|
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 12 | * See the License for the specific language governing permissions and |
|
| 13 | * limitations under the License. |
|
| 14 | */ |
|
| 15 | ||
| 16 | package org.acegisecurity.taglibs.velocity; |
|
| 17 | ||
| 18 | import org.acegisecurity.Authentication; |
|
| 19 | ||
| 20 | import org.acegisecurity.acl.AclManager; |
|
| 21 | ||
| 22 | import org.acegisecurity.taglibs.authz.AclTag; |
|
| 23 | import org.acegisecurity.taglibs.authz.AuthenticationTag; |
|
| 24 | import org.acegisecurity.taglibs.authz.AuthorizeTag; |
|
| 25 | ||
| 26 | import org.acegisecurity.userdetails.UserDetails; |
|
| 27 | ||
| 28 | import org.springframework.context.ApplicationContext; |
|
| 29 | ||
| 30 | ||
| 31 | /** |
|
| 32 | * Wrapper the implementation of Acegi Security for Spring JSP tag includes: |
|
| 33 | * {@link AuthenticationTag}, {@link AclTag}, {@link AuthorizeTag} |
|
| 34 | * |
|
| 35 | * @author Wang Qi |
|
| 36 | * @version $Id: Authz.java 1784 2007-02-24 21:00:24Z luke_t $ |
|
| 37 | */ |
|
| 38 | public interface Authz { |
|
| 39 | //~ Methods ======================================================================================================== |
|
| 40 | ||
| 41 | /** |
|
| 42 | * all the listed roles must be granted to return true, otherwise fasle; |
|
| 43 | * |
|
| 44 | * @param roles - comma separate GrantedAuthoritys |
|
| 45 | * |
|
| 46 | * @return granted (true|false) |
|
| 47 | */ |
|
| 48 | boolean allGranted(String roles); |
|
| 49 | ||
| 50 | /** |
|
| 51 | * any the listed roles must be granted to return true, otherwise fasle; |
|
| 52 | * |
|
| 53 | * @param roles - comma separate GrantedAuthoritys |
|
| 54 | * |
|
| 55 | * @return granted (true|false) |
|
| 56 | */ |
|
| 57 | boolean anyGranted(String roles); |
|
| 58 | ||
| 59 | /** |
|
| 60 | * set Spring application context which contains acegi related bean |
|
| 61 | * |
|
| 62 | * @return DOCUMENT ME! |
|
| 63 | */ |
|
| 64 | ApplicationContext getAppCtx(); |
|
| 65 | ||
| 66 | /** |
|
| 67 | * return the principal's name, supports the various type of principals that can exist in the {@link |
|
| 68 | * Authentication} object, such as a String or {@link UserDetails} instance |
|
| 69 | * |
|
| 70 | * @return string representation of principal's name |
|
| 71 | */ |
|
| 72 | String getPrincipal(); |
|
| 73 | ||
| 74 | /** |
|
| 75 | * return true if the principal holds either permission specified for the provided domain object<P>Only |
|
| 76 | * works with permissions that are subclasses of {@link org.acegisecurity.acl.basic.AbstractBasicAclEntry}.</p> |
|
| 77 | * <p>For this class to operate it must be able to access the application context via the |
|
| 78 | * <code>WebApplicationContextUtils</code> and locate an {@link AclManager}.</p> |
|
| 79 | * |
|
| 80 | * @param domainObject - domain object need acl control |
|
| 81 | * @param permissions - comma separate integer permissions |
|
| 82 | * |
|
| 83 | * @return got acl permission (true|false) |
|
| 84 | */ |
|
| 85 | boolean hasPermission(Object domainObject, String permissions); |
|
| 86 | ||
| 87 | /** |
|
| 88 | * none the listed roles must be granted to return true, otherwise fasle; |
|
| 89 | * |
|
| 90 | * @param roles - comma separate GrantedAuthoritys |
|
| 91 | * |
|
| 92 | * @return granted (true|false) |
|
| 93 | */ |
|
| 94 | boolean noneGranted(String roles); |
|
| 95 | ||
| 96 | /** |
|
| 97 | * get Spring application context which contains acegi related bean |
|
| 98 | * |
|
| 99 | * @param appCtx DOCUMENT ME! |
|
| 100 | */ |
|
| 101 | void setAppCtx(ApplicationContext appCtx); |
|
| 102 | } |