public class IpExtractor extends Object implements CredentialsExtractor<TokenCredentials>
enhanced for
iteration over arrays.
By default, if no proxy ip is setted (setProxyIp(String)
), only request from proxy IP will be accepted.Constructor and Description |
---|
IpExtractor() |
IpExtractor(String... alternateIpHeaders) |
Modifier and Type | Method and Description |
---|---|
TokenCredentials |
extract(WebContext context)
Extract the right credentials.
|
List |
getAlternateIpHeaders() |
String |
getProxyIp() |
void |
setAlternateIpHeaders(String... alternateIpHeaders) |
void |
setProxyIp(String proxyIp) |
String |
toString() |
public IpExtractor()
public IpExtractor(String... alternateIpHeaders)
public TokenCredentials extract(WebContext context)
CredentialsExtractor
CredentialsException
in case of failure.extract
in interface CredentialsExtractor<TokenCredentials>
context
- the current web contextpublic String getProxyIp()
public void setProxyIp(String proxyIp)
proxyIp
- Set the IP to verify the proxy request source.
Setting null
or ""
(empty string) disabled the proxy IP check.public List getAlternateIpHeaders()
Collections.unmodifiableList(List)
public void setAlternateIpHeaders(String... alternateIpHeaders)
alternateIpHeaders
- Sets alternate headers to search for IP.
The first match will be returned as specified for enhanced for
iteration over arrays.Copyright © 2019. All rights reserved.