Class IPRangeAccessControl
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
net.shibboleth.utilities.java.support.security.impl.IPRangeAccessControl
- All Implemented Interfaces:
Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,AccessControl
public class IPRangeAccessControl extends AbstractIdentifiableInitializableComponent implements AccessControl
Simple access control implementation based on IP address checking.
-
Field Summary
Fields Modifier and Type Field Description private Collection<IPRange>
allowedRanges
List of CIDR blocks allowed to access this servlet.private org.slf4j.Logger
log
Class logger. -
Constructor Summary
Constructors Constructor Description IPRangeAccessControl()
Constructor. -
Method Summary
Modifier and Type Method Description boolean
checkAccess(javax.servlet.ServletRequest request, String operation, String resource)
Determine whether the request to the resource should be granted.private String
getLogPrefix()
Get logging prefix.void
setAllowedRanges(Collection<IPRange> ranges)
Set the CIDR address ranges to allow.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
doInitialize, getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
allowedRanges
List of CIDR blocks allowed to access this servlet.
-
-
Constructor Details
-
IPRangeAccessControl
public IPRangeAccessControl()Constructor.
-
-
Method Details
-
setAllowedRanges
Set the CIDR address ranges to allow.- Parameters:
ranges
- ranges to allow
-
checkAccess
public boolean checkAccess(@Nonnull javax.servlet.ServletRequest request, @Nullable String operation, @Nullable String resource)Determine whether the request to the resource should be granted.- Specified by:
checkAccess
in interfaceAccessControl
- Parameters:
request
- request to checkoperation
- operation being performedresource
- target resource- Returns:
- true iff access should be granted
-
getLogPrefix
Get logging prefix.- Returns:
- prefix
-