/** * Set the record version. * * @param ver the new record version, must be > 0 */ protected void setVersion(final long ver) { version = Constraint.isGreaterThan(0, ver, "Version must be greater than zero"); }
/** * Constructor. * * @param maxValueSize maximum value size */ public MemcachedStorageCapabilities(@Positive final long maxValueSize) { Constraint.isGreaterThan(0, maxValueSize, "Maximum value size must be a positive integer"); valueSize = maxValueSize; }
/** * Constructor. * * @param objectSource the object source byte[] */ public XMLObjectSource(@Nonnull @NotEmpty final byte[] objectSource) { source = Constraint.isNotNull(objectSource, "Object source byte[] may not be null"); Constraint.isGreaterThan(0, source.length, "Object source byte[] length must be greater than zero"); }
/** * Constructor. * * @param objectSource the object source byte[] */ public XMLObjectSource(@Nonnull @NotEmpty final byte[] objectSource) { source = Constraint.isNotNull(objectSource, "Object source byte[] may not be null"); Constraint.isGreaterThan(0, source.length, "Object source byte[] length must be greater than zero"); }
/** * Set the context size limit. * * @param size limit on context size in characters */ public void setContextSize(@Positive final int size) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); contextSize = (int) Constraint.isGreaterThan(0, size, "Size must be greater than zero"); }
/** * Set the key size limit. * * @param size size limit on key size in characters */ public void setKeySize(@Positive final int size) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); keySize = (int) Constraint.isGreaterThan(0, size, "Size must be greater than zero"); }
/** * Set the value size limit. * * @param size size limit on value size in characters */ public void setValueSize(@Positive final int size) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); valueSize = (int) Constraint.isGreaterThan(0, size, "Size must be greater than zero"); }
/** * Sets the maximum amount of time, in milliseconds, a descriptor may be valid. * * @param duration maximum amount of time, in milliseconds, a descriptor may be valid, must be greater than 0 */ public synchronized void setMaximumValidityDuration(final long duration) { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isGreaterThan(0, duration, "Maximum validity duration must be greater than 0"); maxValidityDuration = duration; }
/** * Constructor. * * @param skew the clock skew, must be greater than 0 * @param generator the identifier generator, must not be null */ public SecurityConfiguration(@Duration @Positive final long skew, @Nonnull final IdentifierGenerationStrategy generator) { clockSkew = (int) Constraint.isGreaterThan(0, skew, "Clock skew must be greater than 0"); idGenerator = Constraint.isNotNull(generator, "Identifier generator cannot be null"); }
/** * Set the artifact entry lifetime in milliseconds. * * @param lifetime artifact entry lifetime in milliseconds */ @Duration public void setArtifactLifetime(@Duration @Positive final long lifetime) { artifactLifetime = Constraint.isGreaterThan(0, lifetime, "Artifact lifetime must be greater than zero"); }
/** * Set the maximum failed attempts within window. * * <p>Defaults to 5.</p> * * @param attempts maximum failed attempts */ public void setMaxAttempts(@Positive final int attempts) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); maxAttemptsLookupStrategy = FunctionSupport.constant( (int) Constraint.isGreaterThan(0, attempts, "Attempts must be greater than zero")); }
/** * Get ticket validity period. * * @return Ticket validity period in milliseconds. */ @Positive @Duration public long getTicketValidityPeriod() { return Constraint.isGreaterThan(0, getIndirectProperty(ticketValidityPeriodLookupStrategy, ticketValidityPeriod), "Ticket validity period must be positive."); }
/** * Set the time, in milliseconds, ids are valid. * * @param lifetime time, in milliseconds, ids are valid */ public void setIdLifetime(@Duration @Positive final long lifetime) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); idLifetime = Constraint.isGreaterThan(0, lifetime, "ID lifetime must be positive"); }
/** * Set the artifact entry lifetime in milliseconds. * * @param lifetime artifact entry lifetime in milliseconds */ @Duration public void setArtifactLifetime(@Duration @Positive final long lifetime) { artifactLifetime = Constraint.isGreaterThan(0, lifetime, "Artifact lifetime must be greater than zero"); }
/** * Set the last activity instant, in milliseconds since the epoch, for the session. * * <p>This manipulates only the internal state of the object. The {@link #setLastActivityInstant(long)} * method must be overridden to support other persistence requirements.</p> * * @param instant last activity instant, in milliseconds since the epoch, for the session, must be greater than 0 */ @Duration public void doSetLastActivityInstant(@Duration @Positive final long instant) { lastActivityInstant = Constraint.isGreaterThan(0, instant, "Last activity instant must be greater than 0"); }
/** * Constructor. * * @param lifetime lifetime in milliseconds, determines expiration of {@link SPSession} to be created */ public BasicSPSessionCreationStrategy(@Positive @Duration final long lifetime) { sessionLifetime = Constraint.isGreaterThan(0, lifetime, "Lifetime must be greater than 0"); relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class); }
/** * Constructor. * * @param id the identifier of the service associated with this session * @param creation creation time of session, in milliseconds since the epoch * @param expiration expiration time of session, in milliseconds since the epoch */ public BasicSPSession(@Nonnull @NotEmpty final String id, @Duration @Positive final long creation, @Duration @Positive final long expiration) { serviceId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Service ID cannot be null nor empty"); creationInstant = Constraint.isGreaterThan(0, creation, "Creation instant must be greater than 0"); expirationInstant = Constraint.isGreaterThan(0, expiration, "Expiration instant must be greater than 0"); }
/** * Sets the amount of time the descriptors will be valid, expressed in milliseconds. * * @param duration amount of time the descriptors will be valid, expressed in milliseconds */ public synchronized void setValidityDuration(@Duration @Positive final long duration) { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); validityDuration = Constraint.isGreaterThan(0, duration, "validity duration must be greater than 0"); }
/** * Set the time, in milliseconds, ids are valid. * * @param lifetime time, in milliseconds, ids are valid */ @Duration public void setIdLifetime(@Duration @Positive final long lifetime) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); idLifetime = Constraint.isGreaterThan(0, lifetime, "ID lifetime must be positive"); }
/** * Constructor. * * @param lifetime lifetime in milliseconds, determines upper bound for expiration of * {@link SAML2SPSession} to be created */ public SAML2SPSessionCreationStrategy(@Positive @Duration final long lifetime) { sessionLifetime = Constraint.isGreaterThan(0, lifetime, "Lifetime must be greater than 0"); relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class); responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class), new OutboundMessageContextLookup()); }