Skip to content

Add sample code for cross domain websocket implementation including authentication #57

@rob-baily

Description

@rob-baily

@rstoyanchev and @rwinch, I have been doing research on how to handle cross domain websockets that need to handle authentication as well and I have yet to find any definitive answers in Spring documentation, on StackOverflow or other other internet sources. I've seen posts saying things like open the socket and then wait for an authenticated message and otherwise close the socket. The main issue seem to be a restriction from web based implementations on setting authentication information in the initial headers.

I believe in today's world this is a more common use case. I can see that in the example here it may be desirable to offer a quote service that others could include on their sites and give them information based on the user credentials and role.

I'd like to add some sample code to this (or by itself if that makes more sense) that others can use to follow and I wanted to get something that is considered secure. It also seems like we may need to consider something with or without SockJS since that appears to use iFrames in some cases. So if you have some advice about how to start this I would go ahead and take a crack at the code. I've done my own hacking to add an authentication token on the initial URL but that seems like it might not be the most secure option.

Sorry if this is wrong way to go about it but it seemed like a good avenue to get advice from the experts and help add to the community knowledge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions