So I am using webflux and I have a filter where I am logging all the requests. When logging an authenticated request I try exctract the principal from the request object which is a Mono I tried to get the value by using .block method but I got an error "IllegalStateException" i tried to use .map and doOnNext but these are not being called. How do i get the Princial value out
Extract Principal from the request in WebFlux
1k Views Asked by tinashe.chipomho At
1
There are 1 best solutions below
Related Questions in SPRING-BOOT
- Timing Issue with Spring Boot Annotation Configuration
- LightAdmin - Customise parsing DateTime with app timezone
- Creating distribution with repackaged spring boot jar using gradle application plugin
- Spring Boot MVC non-role based security
- Add JVM args to spring boot application
- The method and() is undefined for the type HttpSecurity
- swagger ui not working for swagger version 2
- Spring IO Platform 2.0 - Themes/Changes?
- JPA findDistinctPropertyBy magic method doesn't work as expected when using spring-boot-starter-jpa
- Spring boot check external service status on boot
- Running a specific spring batch job amongst several jobs contained withing a spring boot fat jar
- Adding security to rest api service built with Spring Boot app
- Spring Redirecting from Http to Https Breaks Rest Controller Test
- Service not starting using Spring-boot during integration tests
- Spring Boot Actuator Health Returning DOWN
Related Questions in REACTIVE
- Coursera Scala SBT submission issues
- How to delay retrying to send an HTTP request with RxJS5?
- Why does ReactiveUI have a dependency on an old version of System.Reactive?
- R Shiny reactive subsetting of data in a leaflet plot
- RxJS: How to do some clean-up before reactive search in angular 2
- why react search is so slow in angular 2
- Create ControlProperty for custom UIControl
- RxJava: OnNext Unsubscribe is not working
- R Shiny- reactive error: Warning: Error in .getReactiveEnvironment()$currentContext
- Getting an Observable that emits two types
- Does Observable.Range break The Observable Contract?
- How to change displayed table depending on the userInput
- Publish/subscribe per time interval in Meteor
- Observable returned from function never sends onNext
- ReactiveCrudRepository to use Hibernate in spring
Related Questions in WEBFLUX
- Set coroutine context from spring webflux WebFilter
- calling blocking feign client from reactive spring service
- r2dbc validate if id exists and then insert row
- How to use "cache" method of Mono
- How to check Webclient reposebody?
- Why is my Spring MVC (Tomcat NIO, RestHighLevelClient) outperforming Webflux (Netty, ReactiveElasticsearchClient) on load test?
- ServerHttpSecurity bean not found
- Spring Cloud GlobalFilter: Resend modified request on failure
- How to chaining responses from different services, in order to create a Flux Response using 'those responses' in WebFlux?
- How to use Spring WebClient to make multiple calls sequentionaly?
- Log response time when success & when error - Webflux (doOnSuccess gets called even with error)
- SpringBoot - Generic function for WebFlux getting ClassCastException
- How to get current authenticated user in Spring WebFlux
- Extract Mono nonblocking response and store it in a variable and use it globally
- Reactor log with MDC context within map
Related Questions in WEBFILTERING
- Web URL Filter implementation
- URL route blocking for HTTPS proxy
- How can I use iptables as a per-user whitelist web filter on Linux?
- Can't Toggle Static declarativeNetRequest Static Rules
- ReactiveFeignClient - how to propagate headers from controller to client without auth
- How to get response from HttpServletResponse and save to database in Java via interceptor
- Kubernetes web filtering solution
- Extract Principal from the request in WebFlux
- How to change API responseBody Message in WebFilter - Spring Flux
- How to send a portion of the requests to another url
- How to map tenant request to the root page of application in spring boot using spring webflux webfilter
- ngrok blocked by Fortinet FortiGuard
- Spring-boot webflux: add response time headers in webfilter
- Redirect instead of HTTP403
- Filters to apply for an application that can only run on IE compatibility
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Had the same issue and was able to piece together a solution mainly from this answer: https://stackoverflow.com/a/59011016/1169966
The closure you pass to flatMap will have an actual Principal object in that context.
Also note on that answer the comment about how you shouldn't subscribe as you are not the initiator/client.
I thought I had the solution with this but obviously it was always resulting in a null principal: