[keycloak-user] Convert Bearer Token to Principal (Java+Spring+WS)

Adrian Moya adrianmoya at gmail.com
Thu May 31 11:36:13 EDT 2018


Hi! I'm trying to secure a websocket endpoint using the recommendations
from spring's documentation at
https://github.com/spring-projects/spring-framework/blob/master/src/docs/asciidoc/web/websocket.adoc#token-authentication

I can get the Bearer token in the Stomp Message Header but I don't know how
to convert it to a Principal. Is there a way to actually do this? Here's a
code snippet of what's expected:

if (StompCommand.CONNECT.equals(accessor.getCommand())) {
    Authentication user = ... ; // access authentication header(s)
    accessor.setUser(user);
}


-- 
Adrian E. Moya G.


More information about the keycloak-user mailing list