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
ConstructorsConstructorDescriptionExpressionInstant(Instant instant) Create a newExpressionInstantbased on the passedInstant. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the milliseconds since the epoch of 1970-01-01T00:00:00Z.longReturns 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 aExpiresvalue in cookies.minusDays(long daysToSubtract) Return a newExpressionInstantwith the daysToSubtract subtracted from the current value of theInstant.minusHours(long hoursToSubtract) Return a newExpressionInstantwith the hoursToSubtract subtracted from the current value of theInstant.minusMillis(long millisecondsToSubtract) Return a newExpressionInstantwith the millisecondsToSubtract subtracted from the current value of theInstant.minusMinutes(long minutesToSubtract) Return a newExpressionInstantwith the minutesToSubtract subtracted from the current value of theInstant.minusSeconds(long secondsToSubtract) Return a newExpressionInstantwith the secondsToSubtract subtracted from the current value of theInstant.plusDays(long daysToAdd) Return a newExpressionInstantwith the daysToAdd added to the current value of theInstant.plusHours(long hoursToAdd) Return a newExpressionInstantwith the hoursToAdd added to the current value of theInstant.plusMillis(long millisecondsToAdd) Return a newExpressionInstantwith the millisecondsToAdd added to the current value of theInstant.plusMinutes(long minutesToAdd) Return a newExpressionInstantwith the minutesToAdd added to the current value of theInstant.plusSeconds(long secondsToAdd) Return a newExpressionInstantwith the secondsToAdd added to the current value of theInstant.
-
Constructor Details
-
Method Details
-
getEpochMillis
public long getEpochMillis()Returns 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()Returns 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 aExpiresvalue in cookies.- Returns:
- the current instant as a String in the Date format of RFC1123
- See Also:
-
plusMillis
Return a newExpressionInstantwith the millisecondsToAdd added to the current value of theInstant.- Parameters:
millisecondsToAdd- the milliseconds to add.- Returns:
- a new
ExpressionInstantwith the millisecondsToAdd added to the current value of theInstant.
-
minusMillis
Return a newExpressionInstantwith the millisecondsToSubtract subtracted from the current value of theInstant.- Parameters:
millisecondsToSubtract- the milliseconds to subtract.- Returns:
- a new
ExpressionInstantwith the millisecondsToSubtract subtracted from the current value of theInstant.
-
plusSeconds
Return a newExpressionInstantwith the secondsToAdd added to the current value of theInstant.- Parameters:
secondsToAdd- the seconds to add.- Returns:
- a new
ExpressionInstantwith the secondsToAdd added to the current value of theInstant.
-
minusSeconds
Return a newExpressionInstantwith the secondsToSubtract subtracted from the current value of theInstant.- Parameters:
secondsToSubtract- the seconds to subtract.- Returns:
- a new
ExpressionInstantwith the secondsToSubtract subtracted from the current value of theInstant.
-
plusMinutes
Return a newExpressionInstantwith the minutesToAdd added to the current value of theInstant.- Parameters:
minutesToAdd- the minutes to add.- Returns:
- a new
ExpressionInstantwith the minutesToAdd added to the current value of theInstant.
-
minusMinutes
Return a newExpressionInstantwith the minutesToSubtract subtracted from the current value of theInstant.- Parameters:
minutesToSubtract- the minutes to subtract.- Returns:
- a new
ExpressionInstantwith the minutesToSubtract subtracted from the current value of theInstant.
-
plusHours
Return a newExpressionInstantwith the hoursToAdd added to the current value of theInstant.- Parameters:
hoursToAdd- the hours to add.- Returns:
- a new
ExpressionInstantwith the hoursToAdd added to the current value of theInstant.
-
minusHours
Return a newExpressionInstantwith the hoursToSubtract subtracted from the current value of theInstant.- Parameters:
hoursToSubtract- the hours to subtract.- Returns:
- a new
ExpressionInstantwith the hoursToSubtract subtracted from the current value of theInstant.
-
plusDays
Return a newExpressionInstantwith the daysToAdd added to the current value of theInstant.- Parameters:
daysToAdd- the days to add.- Returns:
- a new
ExpressionInstantwith the daysToAdd added to the current value of theInstant.
-
minusDays
Return a newExpressionInstantwith the daysToSubtract subtracted from the current value of theInstant.- Parameters:
daysToSubtract- the days to subtract.- Returns:
- a new
ExpressionInstantwith the daysToSubtract subtracted from the current value of theInstant.
-