I am using Javers and need to provide the author of a commit. In order to do this, I create this class
private class SimpleAuthorProvider : AuthorProvider {
override fun provide(): String {
return "the_author"
}
}
However instead of hard coding the string, I would like to use the user who has sent the request. I am using a ReactiveAuthenticationManager
to set the authentication. This means I need to access it using ReactiveSecurityContextHolder.getContext()
which returns a Mono. As I need to essentially return a string from this, I am not sure how to access it?
I have tried to even do a hack or two e.g. block()
or toFuture().get()
but these both do not work.
Are there any other suggestions?