Skip to content
Sample of how to integrate SSO with discourse
Branch: master
Clone or download
Latest commit 4bec929 Feb 7, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode vscode msbuild tasks Feb 3, 2017
Idsrv.Discourse Validate redirect uris Feb 7, 2017
images readme Feb 3, 2017
.gitignore Initial commit Feb 3, 2017
Idsrv.Discourse.sln Minimal MVC proj Feb 3, 2017
README.md

README.md

IdentityServer integration w/ Discourse

This sample extends IdentityServer3 with endpoints enabling SSO with a Discourse instance.

Why?

Discourse supports direct integration with Twitter, Yahoo, Google, but not a generic OpenId Connect Provider like IdentityServer3.

How?

  1. Enable SSO in Discourse
  2. Create custom endpoints integrating with IdentityServer3

1. How to setup Discourse for custom SSO:

Go to your discourse instance as an admin at /admin/site_settings/category/login, and enable SSO:

/images/discourse_sso_setup.PNG

For more information, see Discourse own docs about this.

2. See DiscourseController.cs

These endpoints handle the communication between Discourse and IdentityServer3. Discourse initiates a login session by providing a payload that can be validated by using the secret and SHA256.

By using running in the idsrv pipeline, /core, we can use IdentityServer extension methods on the current context. Here, we're using the GetIdentityServerFullLoginAsync() extension. If idsrv says there is an authenticated user, we redirect back to Discource with the custom response it needs to login a user in Discourse. Otherwise, we show a login form.

Links:

You can’t perform that action at this time.