| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StaticSecurityChecker |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007 Ivan Dubrov | |
| 3 | * Copyright 2007 Robin Helgelin | |
| 4 | * | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | ||
| 18 | package nu.localhost.tapestry.acegi.services.internal; | |
| 19 | ||
| 20 | import org.acegisecurity.ConfigAttributeDefinition; | |
| 21 | import org.acegisecurity.intercept.AbstractSecurityInterceptor; | |
| 22 | import org.acegisecurity.intercept.InterceptorStatusToken; | |
| 23 | import org.acegisecurity.intercept.ObjectDefinitionSource; | |
| 24 | ||
| 25 | /** | |
| 26 | * Straighforward implementation of the {@link SecurityChecker}. | |
| 27 | * @author Ivan Dubrov | |
| 28 | */ | |
| 29 | 0 | public class StaticSecurityChecker extends AbstractSecurityInterceptor |
| 30 | implements SecurityChecker { | |
| 31 | ||
| 32 | /** Object definition source. */ | |
| 33 | 0 | private ObjectDefinitionSource objectDefinitionSource = |
| 34 | 0 | new StaticDefinitionSource(); |
| 35 | ||
| 36 | /** | |
| 37 | * Delegate to the | |
| 38 | * {@link AbstractSecurityInterceptor#beforeInvocation(Object)}. | |
| 39 | * @param object security object. | |
| 40 | * @return interceptor status token | |
| 41 | */ | |
| 42 | public final InterceptorStatusToken checkBefore(final Object object) { | |
| 43 | 0 | return beforeInvocation(object); |
| 44 | } | |
| 45 | ||
| 46 | /** | |
| 47 | * Delegate to the | |
| 48 | * {@link AbstractSecurityInterceptor#afterInvocation(InterceptorStatusToken | |
| 49 | * , Object)}. | |
| 50 | * @param token security token. | |
| 51 | * @param returnedObject object returned by the secured method. | |
| 52 | * @return object to return from the secured method | |
| 53 | */ | |
| 54 | public final Object checkAfter(final InterceptorStatusToken token, | |
| 55 | final Object returnedObject) { | |
| 56 | 0 | return afterInvocation(token, returnedObject); |
| 57 | } | |
| 58 | ||
| 59 | /** | |
| 60 | * Get secured object class. | |
| 61 | * @return secured object class. | |
| 62 | */ | |
| 63 | public final Class getSecureObjectClass() { | |
| 64 | 0 | return ConfigAttributeDefinition.class; |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * Obtain {@link ObjectDefinitionSource}. | |
| 69 | * @return {@link ObjectDefinitionSource}. | |
| 70 | */ | |
| 71 | public final ObjectDefinitionSource obtainObjectDefinitionSource() { | |
| 72 | 0 | return objectDefinitionSource; |
| 73 | } | |
| 74 | } |