Package org.forgerock.openig.el
Class ExpressionInstant
java.lang.Object
org.forgerock.openig.el.ExpressionInstant
A wrapper of the
Instant
plus/minus functions for use in expressions. It ensures that multiple calls to the
wrapped functions are always based on the same instant in time.
For example, if added to the bindings as now
:
"iat": "${now.epochSeconds}",
"exp": "${now.plusMinutes(30).epochSeconds}",
"expires", "${now.plusSeconds(20).rfc1123}"
-
Constructor Summary
ConstructorDescriptionExpressionInstant
(Instant instant) Create a newExpressionInstant
based on the passedInstant
. -
Method Summary
Modifier and TypeMethodDescriptionlong
Return the milliseconds since the epoch of 1970-01-01T00:00:00Z.long
Return the seconds since the epoch of 1970-01-01T00:00:00Z.Returns the current instant as a String in the Date format of RFC1123, which is the format used in aExpires
value in cookies.minusDays
(long daysToSubtract) Return a newExpressionInstant
with the daysToSubtract subtracted from the current value of theInstant
.minusHours
(long hoursToSubtract) Return a newExpressionInstant
with the hoursToSubtract subtracted from the current value of theInstant
.minusMillis
(long millisecondsToSubtract) Return a newExpressionInstant
with the millisecondsToSubtract subtracted from the current value of theInstant
.minusMinutes
(long minutesToSubtract) Return a newExpressionInstant
with the minutesToSubtract subtracted from the current value of theInstant
.minusSeconds
(long secondsToSubtract) Return a newExpressionInstant
with the secondsToSubtract subtracted from the current value of theInstant
.plusDays
(long daysToAdd) Return a newExpressionInstant
with the daysToAdd added to the current value of theInstant
.plusHours
(long hoursToAdd) Return a newExpressionInstant
with the hoursToAdd added to the current value of theInstant
.plusMillis
(long millisecondsToAdd) Return a newExpressionInstant
with the millisecondsToAdd added to the current value of theInstant
.plusMinutes
(long minutesToAdd) Return a newExpressionInstant
with the minutesToAdd added to the current value of theInstant
.plusSeconds
(long secondsToAdd) Return a newExpressionInstant
with the secondsToAdd added to the current value of theInstant
.
-
Constructor Details
-
Method Details
-
getEpochMillis
public long getEpochMillis()Return the milliseconds since the epoch of 1970-01-01T00:00:00Z.- Returns:
- the milliseconds since the epoch of 1970-01-01T00:00:00Z
-
getEpochSeconds
public long getEpochSeconds()Return the seconds since the epoch of 1970-01-01T00:00:00Z.- Returns:
- the seconds since the epoch of 1970-01-01T00:00:00Z
-
getRfc1123
Returns the current instant as a String in the Date format of RFC1123, which is the format used in aExpires
value in cookies.- Returns:
- the current instant as a String in the Date format of RFC1123
- See Also:
-
plusMillis
Return a newExpressionInstant
with the millisecondsToAdd added to the current value of theInstant
.- Parameters:
millisecondsToAdd
- the milliseconds to add.- Returns:
- a new
ExpressionInstant
with the millisecondsToAdd added to the current value of theInstant
.
-
minusMillis
Return a newExpressionInstant
with the millisecondsToSubtract subtracted from the current value of theInstant
.- Parameters:
millisecondsToSubtract
- the milliseconds to subtract.- Returns:
- a new
ExpressionInstant
with the millisecondsToSubtract subtracted from the current value of theInstant
.
-
plusSeconds
Return a newExpressionInstant
with the secondsToAdd added to the current value of theInstant
.- Parameters:
secondsToAdd
- the seconds to add.- Returns:
- a new
ExpressionInstant
with the secondsToAdd added to the current value of theInstant
.
-
minusSeconds
Return a newExpressionInstant
with the secondsToSubtract subtracted from the current value of theInstant
.- Parameters:
secondsToSubtract
- the seconds to subtract.- Returns:
- a new
ExpressionInstant
with the secondsToSubtract subtracted from the current value of theInstant
.
-
plusMinutes
Return a newExpressionInstant
with the minutesToAdd added to the current value of theInstant
.- Parameters:
minutesToAdd
- the minutes to add.- Returns:
- a new
ExpressionInstant
with the minutesToAdd added to the current value of theInstant
.
-
minusMinutes
Return a newExpressionInstant
with the minutesToSubtract subtracted from the current value of theInstant
.- Parameters:
minutesToSubtract
- the minutes to subtract.- Returns:
- a new
ExpressionInstant
with the minutesToSubtract subtracted from the current value of theInstant
.
-
plusHours
Return a newExpressionInstant
with the hoursToAdd added to the current value of theInstant
.- Parameters:
hoursToAdd
- the hours to add.- Returns:
- a new
ExpressionInstant
with the hoursToAdd added to the current value of theInstant
.
-
minusHours
Return a newExpressionInstant
with the hoursToSubtract subtracted from the current value of theInstant
.- Parameters:
hoursToSubtract
- the hours to subtract.- Returns:
- a new
ExpressionInstant
with the hoursToSubtract subtracted from the current value of theInstant
.
-
plusDays
Return a newExpressionInstant
with the daysToAdd added to the current value of theInstant
.- Parameters:
daysToAdd
- the days to add.- Returns:
- a new
ExpressionInstant
with the daysToAdd added to the current value of theInstant
.
-
minusDays
Return a newExpressionInstant
with the daysToSubtract subtracted from the current value of theInstant
.- Parameters:
daysToSubtract
- the days to subtract.- Returns:
- a new
ExpressionInstant
with the daysToSubtract subtracted from the current value of theInstant
.
-