Bratwurst: the wurst possible production DiscourseConnect provider

I felt like making something the other night, so I implemented an DiscourseConnect provider that is useful for development and testing:

The utility of this is to be able to configure an SSO backend so that you can test out the behaviour of Discourse with different scenarios from an external provider (e.g. “What happens if two users have the same email but different external IDs? What happens if the external ID changes? What happens if two users have the same username?”)

It 100% trusts the user to enter the correct response values. Fun!

If you’re already set up for development you should be able to clone the repo:

$ git clone https://github.com/Supermathie/bratwurst.git

Install gems:

$ bundle install

and run the server:

$ rails server -b '[::]' -p 3333

then test by pointing your browser at http://localhost:3333/.

To run it against a local development mode Discourse, configure your SSO URL to be: http://localhost:3333/sso and this secret as the default: thisisabadideatouseoutsideofssotesting

Screenshot in action:

21 Likes

Just adding this here in case someone is in need of yet another example of how to do this in ruby:

https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/13045/372?u=blake

https://github.com/oblakeerickson/sso_endpoint

https://github.com/oblakeerickson/sso_endpoint/blob/master/README.md

7 Likes