java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.passkeys.PasskeyRowMapper
All Implemented Interfaces:
org.springframework.jdbc.core.RowMapper<Passkey>

@Component public class PasskeyRowMapper extends Object implements org.springframework.jdbc.core.RowMapper<Passkey>
Maps a row of the user_credentials table to a Passkey. The created and last_used columns are timestamp with time zones that Spring Security's own repository writes as JDBC timestamps, so they are read back the same way, which keeps the instant whatever the time zone of the JVM.
  • Constructor Details

    • PasskeyRowMapper

      public PasskeyRowMapper()
  • Method Details

    • mapRow

      public Passkey mapRow(ResultSet rs, int rowNum) throws SQLException
      Maps the current row.
      Specified by:
      mapRow in interface org.springframework.jdbc.core.RowMapper<Passkey>
      Parameters:
      rs - result set positioned on the row.
      rowNum - number of the row.
      Returns:
      the passkey; a row without a creation timestamp is given the epoch, since the domain requires one.
      Throws:
      SQLException - if a column cannot be read.
    • readInstant

      private static Instant readInstant(ResultSet rs, String column, Instant fallback) throws SQLException
      Reads a timestamp with time zone column that may be null.
      Parameters:
      rs - result set positioned on a row.
      column - name of the column.
      fallback - value returned when the column is null.
      Returns:
      the instant, or the fallback.
      Throws:
      SQLException - if the column cannot be read.