View Javadoc

    1   /*
    2    * $Id: PrincipalProxy.java 502196 2007-02-01 11:28:57Z rgielen $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
    10   * with the License.  You may obtain a copy of the License at
    11   *
    12   *  http://www.apache.org/licenses/LICENSE-2.0
    13   *
    14   * Unless required by applicable law or agreed to in writing,
    15   * software distributed under the License is distributed on an
    16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    17   * KIND, either express or implied.  See the License for the
    18   * specific language governing permissions and limitations
    19   * under the License.
    20   */
    21  package org.apache.struts2.interceptor;
    22
    23  import java.security.Principal;
    24
    25  import javax.servlet.http.HttpServletRequest;
    26
    27  /***
    28   * Proxy interface used together with PrincipalAware interface. It allows to get indirect access to
    29   * HttpServletRequest or PortletRequest Principal related methods.
    30   */
    31  public interface PrincipalProxy {
    32
    33      /***
    34       * True if the user is in the given role
    35       *
    36       * @param role The role
    37       * @return True if the user is in that role
    38       */
    39      boolean isUserInRole(String role);
    40
    41      /***
    42       * Gets the user principal
    43       *
    44       * @return The principal
    45       */
    46      Principal getUserPrincipal();
    47
    48      /***
    49       * Gets the user id
    50       *
    51       * @return The user id
    52       */
    53      String getRemoteUser();
    54
    55      /***
    56       * Is the request using https?
    57       *
    58       * @return True if using https
    59       */
    60      boolean isRequestSecure();
    61
    62      /***
    63       * Gets the request.
    64       *
    65       * @return The request
    66       * @deprecated To obtain the HttpServletRequest in your action, use
    67       *             {@link org.apache.struts2.servlet.ServletRequestAware}, since this method will be dropped in future.
    68       */
    69      HttpServletRequest getRequest();
    70  }