No commit activity in last 3 years
No release in over 3 years
Discourse Mountable Sso is a mountable engine made to handle Discourse single sign on technique,it works with Rails 3.2.14
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

< 4.2, >= 3.2
 Project Readme

Discourse Mountable Sso

Discourse Mountable Sso is a mountable engine made to handle Discourse single sign on technique.

##Getting started

Discourse mountable sso 0.0.2 works with Rails >= 3.2 . You can add it to your Gemfile with:

gem 'discourse_mountable_sso'

Run the bundle command to install it.

After you install Discourse mountable sso and add it to your Gemfile, you need to create a file in config/initializers in your application filled with the below data :

#config/initializers/discourse_config.rb
DiscourseMountableSso.configuration.secret = <secret>
DiscourseMountableSso.configuration.discourse_url = <DISCOURSE_URL>	
DiscourseMountableSso.configuration.login_path = <LOGIN_PATH>
DiscourseMountableSso.configuration.discourse_data_method = <DISCOURSE_DATA_METHOD>
DiscourseMountableSso.configuration.logged_in_check_method = <CHECK_LOGIN_METHOD>
DiscourseMountableSso.configuration.store_return_to_url_method = <RETURN_TO_URL_METHOD>

##Configuration description

  • secret : Is the the secret you configured in your discourse admin panel
  • discourse_url : Is the URL of your discourse application.
  • login_path : Is the login path of your own app as www.example.com/login then your login path will be "/login"
  • discourse_data_method : Is a method returns the user data for discourse in this format:
    • {:avatar_url=>"http://www.example.com/avatar1.jpg", :email=>"lorem@ipsum.com", :name=>"lorem", :username=>"lorem", :external_id=>1}
  • logged_in_check_method : Is a method to check if the user is logged in or not and returns true or false.
  • store_return_to_url_method : Is a method to store the return_to path as after the user log-in in your app it'll be redirected back to discourse server.

##Notes:

  • Add this route to your routes.rb file
mount DiscourseMountableSso::Engine => "/discourse_mountable_sso"
  • We use a session named [:discourse_mountable_sso][:query_string]
  • Adjust your login method to check if you stored a return_to using store_return_to_url_method to redirect to this url.