Class IPRangeAccessControl
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.shared.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
FieldsModifier and TypeFieldDescriptionprivate Collection<IPRange>List of CIDR blocks allowed to access this servlet.private final org.slf4j.LoggerClass logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAccess(ServletRequest request, String operation, String resource) Determine whether the request to the resource should be granted.private StringGet logging prefix.voidsetAllowedRanges(Collection<IPRange> ranges) Set the CIDR address ranges to allow.Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.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 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
Get logging prefix.- Returns:
- prefix
-