With the other discourse sso module being basically abandoned, I was wondering if you were considering releasing a Drupal8 version of your module for Discourse?

While OAuth solutions are most certainly doable, they lack a bit of control (forcing usernames, avatars, etc).

CommentFileSizeAuthor
#13 discourse.zip4.57 KBjackpelorus

Comments

ColdSun created an issue. See original summary.

dabbor’s picture

Assigned: Unassigned » dabbor

Hi @ColdSun,

I wasn't planning to migrate the module to D8 anytime soon. But I'm going to revise that decision and inform here if I change my mind and have some time for it.

If you already have done some investigation how to migrate it to D8 or have some code, please share :)

Cheers,
Dalibor

ColdSun’s picture

I've started relatively fresh and have a semi-working Discourse SSO solution. Currently it successfully handles SSO logins and avatar synchronization.

There's still a few errors that appear in the watchdog list; and a few other small issues which I want to take care of sometime in the near future but the sso login itself works as desired.

I have also yet to create the discourse forum link but that shouldn't be too much of an issue either.

If you want to beat me to the punch though and continue the work; please feel free to.
http://assets.r3v.org/pocs/discourse.zip

Enjoy,
-ColdSun

dabbor’s picture

Hi @ColdSun,

thanks for your contribution :)

I will check it out when I have some time.

Best Regards,
Dalibor

mugua’s picture

@ColdSun, Hi,I used the module you offered base on http://assets.r3v.org/pocs/discourse.zip, I can't save the content in Drupal8.

Could you help to check it asap, Thanks a lot

such as below:

Discourse URL
https://forums.domain.com

The web address of the Discourse server.
SSO Secret
ABCD****(32bits)
Secret string used to encrypt/decrypt SSO information, be sure it is 10 chars or longer and matches the Discourse setting under Admin > Settings > Login. If there is a value here Drupal will attempt to login the user to Discourse on Drupal login.

ISSUE PIC

ColdSun’s picture

Ah, yes. That's on my todo list. It actually does save the settings and discourse will connect just fine.

The fields appear unpopulated because the values are not retrieved from the database.

In short, settings are being saved. Settings get used for authentication. Settings are not shown in the admin panel.

If this is an issue, I can more carefully cut out the general code from my module and rezip up a more complete file. The existing sample of the working installation was simply a quick 1-2 min job of copying/pasting things from our inhouse module.

mugua’s picture

@ColdeSun, Thanks for your feedback, But I still can't connect the D8 & discourse with this module(SSO), I can't find the mistake as below:

In Drupal8, I set:
Discourse URL:
https://forums.domain.com
SSO Secret:
ABC***(32bits)
In Discourse v1.9.0.beta4, I set:
enable sso: True
sso allows all return paths:True
enable sso provider:True
verbose sso logging:True
sso url: https://www.domain.com/discourse/sso
sso secret:ABC***(32bits, the same as D8)
sso overrides bio:True
sso overrides username:True
sso overrides name:True

I can't find the Login Page when I set this items(404 - Page Not Found). Attached the Picture as below.

ISSUE PIC2

ColdSun’s picture

Try setting the sso url to:

https://domain.tld/discourse_sso

Let me know if it works or if you have other problems.

I'm thinking of having the url be configurable in the admin page later. Thoughts?

Either way though, I definitely need to write some documentation and actually make it a general purpose Discourse SSO module instead of leaving it as a 'heres all the generic code stripped from our fully functional inhouse module'. Its fine for a Proof of Concept but it definitely seems that there's a desire for a full fledged and supported module. Duly noted.

mugua’s picture

@ColdSun, Set as your guide, It still has mistake as below:

The website encountered an unexpected error. Please try again later.

ISSUE PIC3

Could you offer your latest module to me for testing? Thanks a lot.

ColdSun’s picture

Unfortunately I'll be unable to include the full module as it also handles a few other services for us that we'd rather not release. What I can do though is Friday evening sit down on a fresh install, and get the current one up to date and include a tutorial for anything I've left ambiguous.

Sorry for the trouble.

In the mean time (just tested the current poc.zip) on a test site, and it seems to be working, all-be-it with a single error in the error log but the logging in still works.

Here's the settings I tested with:
URL: admin/config/system/discourse
Discourse URL: https://forums.ego.ninja (notice no trailing slash, I'll need to be sure to add the error checking in sanitized poc)
SSO Secret: simpletest

URL: forums.ego.ninja/admin/site_settings/category/all_results?filter=sso
Enable single sign on via an external site: enabled
sso allows all return paths: disabled
enable sso provider: disabled
verbose sso logging: disabled
sso url: https://ego.ninja/discourse_sso
sso secret: simpletest
sso overrides email: enabled
sso overrides username: enabled

It all seems to work with this sanitized file originally provided. I'd go ahead and check that there's no trailing sash (note to self: filter it in the code) and verify that you're copy/pasting the secret in to both fields.

If it works, that's great and I apologize for the sloppy proof of concept. I could/should have taken the extra hour or so to really flesh out the error reporting and some of the other issues.

Finally, since it seems no one else is jumping to release a full fledge module for this, I'll go ahead and create a github project for it, and actually spend some time to make it a real module (since there's obviously a demand for it).

mugua’s picture

@ColdSun, It still can't work setting as the same you showed for me. Waiting for your newest update soon.

Thanks very much.

ColdSun’s picture

Unfortunately I'll be focusing on finishing up another module currently under development for a project I'm a part of. As soon as it is finished, I'll definitely be focusing my attention on releasing a discourse sso module for production use.

I'll be sure to let you know when it gets underway.

jackpelorus’s picture

StatusFileSize
new4.57 KB

Hello Drupal friends

Here i set a functional Drupal 8 SSO module integration with Discourse is the original posted in this thread with some fixes is only for dev.

Regards
JACK

jackpelorus’s picture

ColdSun’s picture

Thanks Jack.

Hopefully that gets everyone up to speed until a more full featured module can be installed.

jackpelorus’s picture

ok man
Thanks to you for the kick off!!
I continue with create a git repo and post here all links , relational data and info.
The repo contains more fixes and a better version, easier to config extra parameters(avatar, etc)
Regards
Jack

ColdSun’s picture

Sounds good. I'll try and add to your git repository once its up.

dabbor’s picture

I'm glad for such a fruitful collaboration of yours :)

I'm currently busy, but I'm happy to help with a code review when the proposed git/github repository is ready. We should also put in simple instructions how to test the result. Probably describe the steps with https://simplytest.me/, so it is easy for anyone to test it on a local environment as well.

I do not know what is the easiest way to spin up a Discourse forum (probably on https://www.discourse.org/) to perform testing. Not sure if the FREE 14 day trial is good enough for this purpose.

I'm happy to take on someone as a co-maintainer for this project: @ColdSun, @jackpelorus?

Cheers,
Dalibor

jurgenhaas’s picture

@jackpelorus I've tried your zip version from #13 above and for SSO this is working just great. I wonder if it were possible to maintain a D8 version here in this project? If the original maintainer wasn't active anymore, you (or some of us) could either take over or at least become co-maintainers. That way we could continue development and benefit from the build processes here at d.o

What do you think?

dabbor’s picture

I'm happy to to give the role of co-maintainer to someone who is involved development in D8 version of the module, like @ColdSun, or @jackpelorus. I'm too busy to promise some action from my side.

jackpelorus’s picture

Ok @dabbor I accept !!
Regards
Jack

jackpelorus’s picture

@jurgenhaas I think Yes !! I love this challenges !!
Regards
Jack

jurgenhaas’s picture

Hi @jackpelorus and @dabbor just wondering what's the state on this? I'm asking because we are about to develop more feature for the Discourse integration for a client project and we would like to contribute that to this or the other Discourse module. The features we're considering:

  1. Synchronize existing users
  2. Synchronize roles
  3. Synchronize user's role assignments
  4. Synchronize existing forum content

Is there a way to contirbute that work here or should we start on separate projects.

dabbor’s picture

Hi @jackpelorus,

Sorry it took me so long. I missed last couple of comments.

I granted you rights as a co-maintainer of the project. Let me know if I missed something or you would like to discuss something.

Cheers,
Dalibor

dabbor’s picture

Hi @jurgenhaas,

Sorry for late response. I have been too busy lately.

I can give you rights to co-maintain this project and coordinate contributions with @jackpelorus if you like.

I will be careful to respond promptly if your answer is yes.

Thanks,
Dalibor

jurgenhaas’s picture

@dabbor Thanks for offering co-maintainer role which I happily accept. As my teammater @boromino is currently doing the development of the mentioned features, would you mind adding him as well?

@jackpelorus can you create the 8.x branch and commit your current code there? We could then start using that for the extra development and commit the extra code on top of that.

dabbor’s picture

Hi @jurgenhaas, I've granted you and @boromino access to co-maintain the project.

Cheers,
Dalibor

boromino’s picture

Version: » 8.x-1.x-dev
Status: Active » Needs review

I created the 8.x branch based on the code by @jackpelorus' and added a discourse_sync submodule. Users are created and logged in to discourse, the submodule creates, updates and deletes discourse groups on editing drupal roles.

boromino’s picture

Status: Needs review » Fixed
boromino’s picture

Status: Fixed » Closed (fixed)