All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.acegisecurity.RunAsManager Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.acegisecurity;

/**
 * Creates a new temporary {@link Authentication} object for the current secure
 * object invocation only.
 * 
 * 

* This interface permits implementations to replace the * Authentication object that applies to the current secure * object invocation only. The {@link * org.acegisecurity.intercept.AbstractSecurityInterceptor} will replace * the Authentication object held in the * {@link org.acegisecurity.context.SecurityContext SecurityContext} * for the duration of the secure object callback only, returning it to * the original Authentication object when the callback ends. *

* *

* This is provided so that systems with two layers of objects can be * established. One layer is public facing and has normal secure methods with * the granted authorities expected to be held by external callers. The other * layer is private, and is only expected to be called by objects within the * public facing layer. The objects in this private layer still need security * (otherwise they would be public methods) and they also need security in * such a manner that prevents them being called directly by external callers. * The objects in the private layer would be configured to require granted * authorities never granted to external callers. The * RunAsManager interface provides a mechanism to elevate * security in this manner. *

* *

* It is expected implementations will provide a corresponding concrete * Authentication and AuthenticationProvider so that * the replacement Authentication object can be authenticated. * Some form of security will need to be implemented to ensure the * AuthenticationProvider only accepts * Authentication objects created by an authorized concrete * implementation of RunAsManager. *

* * @author Ben Alex * @version $Id: RunAsManager.java 1496 2006-05-23 13:38:33Z benalex $ */ public interface RunAsManager { //~ Methods ======================================================================================================== /** * Returns a replacement Authentication object for the current secure object invocation, or * null if replacement not required. * * @param authentication the caller invoking the secure object * @param object the secured object being called * @param config the configuration attributes associated with the secure object being invoked * * @return a replacement object to be used for duration of the secure object invocation, or null if * the Authentication should be left as is */ public Authentication buildRunAs(Authentication authentication, Object object, ConfigAttributeDefinition config); /** * Indicates whether this RunAsManager is able to process the passed * ConfigAttribute.

This allows the AbstractSecurityInterceptor to check every * configuration attribute can be consumed by the configured AccessDecisionManager and/or * RunAsManager and/or AfterInvocationManager.

* * @param attribute a configuration attribute that has been configured against the * AbstractSecurityInterceptor * * @return true if this RunAsManager can support the passed configuration attribute */ public boolean supports(ConfigAttribute attribute); /** * Indicates whether the RunAsManager implementation is able to provide run-as replacement for * the indicated secure object type. * * @param clazz the class that is being queried * * @return true if the implementation can process the indicated class */ public boolean supports(Class clazz); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy