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>allowedRangesList of CIDR blocks allowed to access this servlet.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description IPRangeAccessControl()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckAccess(javax.servlet.ServletRequest request, String operation, String resource)Determine whether the request to the resource should be granted.private StringgetLogPrefix()Get logging prefix.voidsetAllowedRanges(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 Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
allowedRanges
@Nonnull @NonnullElements private Collection<IPRange> allowedRanges
List of CIDR blocks allowed to access this servlet.
-
-
Method Detail
-
setAllowedRanges
public void setAllowedRanges(@Nonnull @NonnullElements Collection<IPRange> ranges)
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:
checkAccessin interfaceAccessControl- Parameters:
request- request to checkoperation- operation being performedresource- target resource- Returns:
- true iff access should be granted
-
getLogPrefix
@Nonnull private String getLogPrefix()
Get logging prefix.- Returns:
- prefix
-
-