Using Discourse as an identity provider (SSO, DiscourseConnect)

Does anyone know if this Ruby/Rails integration moved to a new location? Or if it was removed, does anyone have a copy of the old code?

(It looks like the Go repo is also gone.)

It’s very possible @gogo52cn is the same person as https://github.com/gogo52cn ; they might be able to let us know?

1 Like

Is it possible to use discourse as a LDAP provider?

I don’t know if I’m doing it correctly, but this initial sketch for Rails 5.2 seems to work (in case it can save time for anyone). If anyone has suggestions for improving it, let me know.

I also saw an OmniAuth strategy, but I haven’t looked closely at it yet.

No, this not possible.

2 Likes

hello, I installed the plugin in WP-multisite.
I network-activated the plugin. The plugin showed that the connection was sucessful

I configured the credentials in one of the sites to enable Discourse as SSO provider.

However when I click on “Log in with Discourse” I get a 500 Error. Lookin at the logs I found this:

"talk.co-pp.io" 172.17.0.1 "GET /session/sso_provider?sso=bm9uY2U9YTk2ZWZkYzRjMmIyZmJlM2FjNTAzYTYzOWRiYzBkZTQmcmV0dXJuX3Nzb191cmw9aHR0cCUzQSUyRiUyRmNvLXBwLmlv&sig=33b1edba92b8f0d93b0e57edaf262e73a20689aeff2d86e2f61012d9cd99e878 HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-" 500 906 "-" 0.016 0.018 "-"

Any ideas?

@j127 @supermathie - there is a copy here…

https://github.com/AstonJ/sso_with_discourse

1 Like

Thanks – I recently switched to Phoenix and rewrote the SSO code in Elixir. (Your forum is great, by the way.)

1 Like

Ah that’s awesome Josh! Could you add it to the first post of this thread please? Hopefully I will get a chance to use it soon :smiley:

Also thank you for the kind words! If you like that forum, I am hoping to launch another (Discourse) forum next year which you might like as well :blush:

1 Like

Sure, I’ll have to extract it from the Phoenix app, but then I’ll post it on Github. Maybe other people can help improve it, since this is my first real Phoenix site.

Looking forward to seeing it. I read your other forum regularly.

1 Like

Can I use Discourse as an SSO provider if I’m also using SSO as my discourse auth?
I have things setup, but it doesn’t seem like Discourse correctly calls back the return URL.

…and yes, I do realize that Discourse is just acting as an SSO proxy, but the primary web app only implements Discourse SSO. This is not meant to be a permanent strategy but a temporary one, or at least a useful tool to have.

Hi,
I am using ASP.NET Core and receiving the below error.

SSO authentication failed due to missing secret. Contact the site administrators to fix this problem.

Please let me know any code changes or setting changes required for this issue?

I got the same issue.

It seems to indicate “blank secret”.

Maybe it is the domain not matching?

This seems to be a bug in Discourse

https://github.com/discourse/discourse/blob/1014e56e804049bcfb0b38029408f73313ec6290/app/controllers/session_controller.rb#L46

https://github.com/discourse/discourse/blob/1014e56e804049bcfb0b38029408f73313ec6290/lib/single_sign_on_provider.rb#L8

sso_secret is nil for sure :joy:

Scroll down to line 25 - it parses the host out of the return_url and looks up the secret using that.

Is it possible to get an API key from the SSO flow such that my app can create posts from the sso authed discourse user?

Or is the recommended way to create an all users api key, then when creating a post, use that api key paired with the username returned from the sso auth flow?

This is how our WordPress plugin handles it. The user’s Discourse username is saved to the database and then paired with the All User’s API Key to publish posts under that username.

2 Likes

Hey everyone,

I have just released an important security fix for discourse-auth-proxy. Please make sure you download and apply the new code.

If you’re using our image from DockerHub, the version with the fix is discourse/auth-proxy:20200609.185704.

2 Likes

Wondering if anyone can improve upon some existing SSO plugins for Mediawiki (e.g. Extension:PluggableSSO - MediaWiki ) to make this work without need for too much tech skills (i.e. entering all necessary info on a settings page and whoopee)

1 Like

Please try this out:

https://github.com/mdoggydog/DiscourseSsoConsumer

It operates as a plugin for the PluggableAuth extension. I haven’t put this on any public-facing sites yet, and it sorely lacks unit/etc tests, but it does seem to work so far. It should not require any tech skills beyond those needed for installing/configuring any other MediaWiki extension.

4 Likes