Skip to content

Authentication principal Spring security #663

Discussion options

You must be logged in to vote

I Finally managed to get the security context, I did it this way and I think is non blocking..

    @ExperimentalCoroutinesApi
    @Suppress("ForbiddenVoid")
    override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> =
            if (isApplicable(exchange.request.uri.path)) {
                mono {
                    contextFactory.generateContext(getSecurityContext(coroutineContext[ReactorContext]!!)?.awaitFirstOrNull())
                }.flatMap { graphQLContext ->
                    chain.filter(exchange).subscriberContext { it.put(GRAPHQL_CONTEXT_KEY, graphQLContext) }
                }
            } else {
                chain.filter(exchange)
        …

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by smyrick
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #663 on September 03, 2020 21:51.