Basic accounts
- add account link in welcome.html - add AuthorizeExchangeSpec adminPaths in SecurityConfiguration - add AccountController - add users.html - add getAccounts in AccountRegistryService - add WebClient accountRegistryAccounts in webClient
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package ltd.hlaeja.util
|
||||
|
||||
import ltd.hlaeja.library.accountRegistry.Account
|
||||
import ltd.hlaeja.library.accountRegistry.Authentication
|
||||
import ltd.hlaeja.property.AccountRegistryProperty
|
||||
import org.springframework.http.HttpStatus.LOCKED
|
||||
@@ -9,6 +10,7 @@ import org.springframework.security.authentication.BadCredentialsException
|
||||
import org.springframework.security.authentication.LockedException
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException
|
||||
import org.springframework.web.reactive.function.client.WebClient
|
||||
import reactor.core.publisher.Flux
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
fun WebClient.accountRegistryAuthenticate(
|
||||
@@ -22,3 +24,12 @@ fun WebClient.accountRegistryAuthenticate(
|
||||
.onStatus(UNAUTHORIZED::equals) { throw BadCredentialsException("Invalid credentials") }
|
||||
.onStatus(NOT_FOUND::equals) { throw UsernameNotFoundException("User not found") }
|
||||
.bodyToMono(Authentication.Response::class.java)
|
||||
|
||||
fun WebClient.accountRegistryAccounts(
|
||||
page: Int,
|
||||
size: Int,
|
||||
property: AccountRegistryProperty
|
||||
): Flux<Account.Response> = get()
|
||||
.uri("${property.url}/accounts?page=$page&size=$size".also(::logCall))
|
||||
.retrieve()
|
||||
.bodyToFlux(Account.Response::class.java)
|
||||
|
||||
Reference in New Issue
Block a user