Class AccessRequester

java.lang.Object
com.sap.cloud.sdk.cloudplatform.auditlog.AccessRequester

public class AccessRequester extends Object
Represents the requester of an access to an object in the context of an audit log.

Therefore this class stores identifiable information of the requester. Information about the field accessed as well as about the access time are handled in the implementation of the AuditLog interface.

  • Field Details

    • UNKNOWN

      public static final AccessRequester UNKNOWN
      Field representing an unknown requester.
    • UNAUTHENTICATED_USER

      public static final String UNAUTHENTICATED_USER
      Default user Id, used in case of an unknown remote user.
      See Also:
  • Constructor Details

    • AccessRequester

      public AccessRequester(@Nonnull javax.servlet.http.HttpServletRequest request)
      Creates an AccessRequester based on the given request.
      Parameters:
      request - The request which tries to access an object.
    • AccessRequester

      public AccessRequester(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull Tenant tenant)
      Creates an AccessRequester based on the given request and tenant.
      Parameters:
      request - The request which tries to access an object.
      tenant - The tenant which tries to access an object.
    • AccessRequester

      public AccessRequester(@Nullable String tenantId, @Nullable String principalId, @Nullable String ipAddress, @Nullable String channel)
  • Method Details

    • getPrincipalId

      @Nonnull public io.vavr.control.Option<String> getPrincipalId()
      The Id of the remote user requesting access.
      Returns:
      An Option containing the user Id.
    • getTenantId

      @Nonnull public io.vavr.control.Option<String> getTenantId()
      The tenant or zone Id of the remote user requesting access.
      Returns:
      An Option containing the tenant or zone Id.
    • getIpAddress

      @Nonnull public io.vavr.control.Option<String> getIpAddress()
      The IP address of the remote user requesting access.
      Returns:
      An Option containing the IP address.
    • getChannel

      @Nonnull public io.vavr.control.Option<String> getChannel()
      The connection channel used, e.g. http, or https.
      Returns:
      An Option containing the connection channel.
    • of

      @Nonnull public static AccessRequester of(@Nullable javax.servlet.http.HttpServletRequest request)
      Creates a request based on the given, nullable request.
      Parameters:
      request - The request which tries to access an object.
      Returns:
      An AccessRequester for the given request. Never null.
    • of

      @Nonnull public static AccessRequester of(@Nullable javax.servlet.http.HttpServletRequest request, @Nullable Tenant tenant)
      Creates a request based on the given, nullable request and tenant.
      Parameters:
      request - The request which tries to access an object.
      tenant - The tenant which tries to access an object.
      Returns:
      An AccessRequester for the given request. Never null.
    • ofJakarta

      @Nonnull public static AccessRequester ofJakarta(@Nullable jakarta.servlet.http.HttpServletRequest request)
      Creates a request based on the given, nullable request.
      Parameters:
      request - The request which tries to access an object.
      Returns:
      An AccessRequester for the given request. Never null.
    • ofJakarta

      @Nonnull public static AccessRequester ofJakarta(@Nullable jakarta.servlet.http.HttpServletRequest req, @Nullable Tenant tenant)
      Creates a request based on the given, nullable request.
      Parameters:
      req - The request which tries to access an object.
      tenant - The tenant which tries to access an object.
      Returns:
      An AccessRequester for the given request. Never null.
    • ofCurrentRequest

      @Nonnull public static AccessRequester ofCurrentRequest()
      Creates a request based on the current request.
      Returns:
      An AccessRequester for the current request. Never null.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object