Class SecurityTime

java.lang.Object
io.helidon.security.SecurityTime

public class SecurityTime extends Object
Time used in security, configurable. Configuration may either shift time (to past or future) or explicitly set a value on one of the time fields (e.g. year, month)
  • Method Details

    • builder

      public static SecurityTime.Builder builder()
      A new builder for this class.
      Returns:
      builder to build a new instance
    • create

      public static SecurityTime create()
      Creates a new security time based on default time zone and current time.
      Returns:
      security time
    • create

      public static SecurityTime create(Config config)
      Load an instance from configuration.

      Example:

       # server-time
       server-time:
         # can shift time if needed (before explicit values are applied
         # shift-by-seconds: -1020
         #
         # All of the following settings:
         #   if configured, will override actual value, if not set, current value is used
         #
         # definition of a time zone (that is valid for ZoneId.of())
         # this will move the time to the specific timezone (same instant)
         # Time zone is applied first, everything else after
         # time-zone: Europe/Prague
         time-zone: "Australia/Darwin"
         year: 2017
         # 1 for January, 12 for December
         month: 9
         # day of month (1 - 31)
         day-of-month: 6
         # hour of day (0 - 23)
         hour-of-day: 13
         # minute of hour (0 - 59)
         minute: 0
         # second of minute (0-59)
         second: 0
         # millisecond of minute (0-999)
         # millisecond: 0
       
      Parameters:
      config - configuration located on the key "server-time" in example above (the key name can differ, the content is important)
      Returns:
      a new instance of time configured from this configuration
    • get

      public ZonedDateTime get()
      Get current (or as configured) time.
      Returns:
      a date time with a time-zone information as configured for this instance