public class AccessRequester extends Object
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.
Modifier and Type | Field and Description |
---|---|
String |
tenantId
Tenant Id of the user requesting the access.
|
static String |
UNAUTHENTICATED_USER
Default user Id, used in case of an unknown remote user.
|
static AccessRequester |
UNKNOWN
Null-Object representing an unknown requester.
|
Constructor and Description |
---|
AccessRequester(javax.servlet.http.HttpServletRequest request)
Creates an AccessRequester based on the given request.
|
AccessRequester(javax.servlet.http.HttpServletRequest request,
Tenant tenant)
Creates an AccessRequester based on the given request and tenant.
|
AccessRequester(String userId,
String tenantId,
String ipAddress,
String channel) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
Optional<String> |
getChannel()
The connection channel used, e.g.
|
Optional<String> |
getIpAddress()
The IP address of the remote user requesting access.
|
Optional<String> |
getTenantId()
The tenant Id of the remote user requesting access.
|
Optional<String> |
getUserId()
The Id of the remote user requesting access.
|
int |
hashCode() |
static AccessRequester |
of(javax.servlet.http.HttpServletRequest request)
Creates a request based on the given, nullable request.
|
static AccessRequester |
of(javax.servlet.http.HttpServletRequest request,
Tenant tenant)
Creates a request based on the given, nullable request and tenant.
|
static AccessRequester |
ofCurrentRequest()
Creates a request based on the current request.
|
String |
toString() |
public static final AccessRequester UNKNOWN
public static final String UNAUTHENTICATED_USER
public AccessRequester(@Nonnull javax.servlet.http.HttpServletRequest request)
request
- The request which tries to access an object.public AccessRequester(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull Tenant tenant)
request
- The request which tries to access an object.tenant
- The tenant which tries to access an object.public Optional<String> getUserId()
Optional
containing the user Id.public Optional<String> getTenantId()
Optional
containing the tenant Id.public Optional<String> getIpAddress()
Optional
containing the IP address.public Optional<String> getChannel()
Optional
containing the connection channel.@Nullable public static AccessRequester of(@Nullable javax.servlet.http.HttpServletRequest request)
request
- The request which tries to access an object.null
.@Nullable public static AccessRequester of(@Nullable javax.servlet.http.HttpServletRequest request, @Nullable Tenant tenant)
request
- The request which tries to access an object.tenant
- The tenant which tries to access an object.null
.@Nullable public static AccessRequester ofCurrentRequest()
null
.protected boolean canEqual(Object other)
Copyright © 2018 SAP SE. All rights reserved.