-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jdbc implementation for the password history feature
- Loading branch information
Showing
5 changed files
with
63 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 27 additions & 2 deletions
29
...tlin/com/vauthenticator/server/password/adapter/jdbc/JdbcPasswordHistoryRepositoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
package com.vauthenticator.server.password.adapter.jdbc | ||
|
||
import org.junit.jupiter.api.Assertions.* | ||
import com.vauthenticator.server.password.adapter.AbstractPasswordHistoryRepositoryTest | ||
import com.vauthenticator.server.password.domain.PasswordHistoryRepository | ||
import com.vauthenticator.server.support.JdbcUtils.jdbcTemplate | ||
import com.vauthenticator.server.support.JdbcUtils.resetDb | ||
import java.time.Clock | ||
|
||
class JdbcPasswordHistoryRepositoryTest | ||
class JdbcPasswordHistoryRepositoryTest : AbstractPasswordHistoryRepositoryTest() { | ||
override fun initPasswordHistoryRepository(): PasswordHistoryRepository = | ||
JdbcPasswordHistoryRepository( | ||
2, | ||
3, | ||
Clock.systemUTC(), | ||
jdbcTemplate | ||
) | ||
|
||
override fun resetDatabase() { | ||
resetDb() | ||
} | ||
|
||
override fun loadActualDynamoSizeFor(userName: String): List<Map<String, Any>> { | ||
return jdbcTemplate.query("SELECT * FROM PASSWORD_HISTORY WHERE user_name = ?", {rs,_ -> mapOf( | ||
"user_name" to rs.getString("user_name"), | ||
"created_at" to rs.getLong("created_at"), | ||
"password" to rs.getString("password") | ||
) }, userName) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters