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

org.ow2.util.security.api.ISecurityContext Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2006-2012 Bull S.A.S.
 *
 * 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.ow2.util.security.api;

import java.security.Principal;

import javax.security.auth.Subject;

/**
 * Interface used to describe operations on a security context.
 * @author Florent Benoit
 */
public interface ISecurityContext {

    /**
     * Gets the caller's principal.
     * @param runAsBean if true, the bean is a run-as bean.
     * @return principal of the caller.
     */
    Principal getCallerPrincipal(final boolean runAsBean);

    /**
     * Enters in run-as mode with the given subject.
* The previous subject is stored and will be restored when run-as mode will * be ended. * @param runAsSubject the subject to used in run-as mode. * @return the previous subject. */ Subject enterRunAs(final Subject runAsSubject); /** * Ends the run-as mode and then restore the context stored by container. * @param oldSubject subject kept by container and restored. */ void endsRunAs(final Subject oldSubject); /** * Gets the caller's roles. * @param runAsBean if true, the bean is a run-as bean. * @return array of roles of the caller. */ Principal[] getCallerRoles(final boolean runAsBean); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy