Package org.apache.struts2.interceptor.servlet

# Class ServletPrincipalProxy

java.lang.Object
org.apache.struts2.interceptor.servlet.ServletPrincipalProxy

All Implemented Interfaces:
  `PrincipalProxy`

public class ServletPrincipalProxy extends Object implements PrincipalProxy
PrincipalProxy implementation for using HttpServletRequest Principal related methods.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServletPrincipalProxy(jakarta.servlet.http.HttpServletRequest request)`
  Constructs a proxy

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getRemoteUser()`
  Gets the user id
  `Principal`
  `getUserPrincipal()`
  Gets the user principal
  `boolean`
  `isRequestSecure()`
  Is the request using https?
  `boolean`
  `isUserInRole(String role)`
  True if the user is in the given role

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ServletPrincipalProxy

    public ServletPrincipalProxy(jakarta.servlet.http.HttpServletRequest request)
    Constructs a proxy
    Parameters:
      `request` - The underlying request

- ## Method Details

  - ### isUserInRole

    public boolean isUserInRole(String role)
    True if the user is in the given role
    Specified by:
      `isUserInRole` in interface `PrincipalProxy`
    Parameters:
      `role` - The role
    Returns:
      True if the user is in that role

  - ### getUserPrincipal

    public Principal getUserPrincipal()
    Gets the user principal
    Specified by:
      `getUserPrincipal` in interface `PrincipalProxy`
    Returns:
      The principal

  - ### getRemoteUser

    public String getRemoteUser()
    Gets the user id
    Specified by:
      `getRemoteUser` in interface `PrincipalProxy`
    Returns:
      The user id

  - ### isRequestSecure

    public boolean isRequestSecure()
    Is the request using https?
    Specified by:
      `isRequestSecure` in interface `PrincipalProxy`
    Returns:
      True if using https