This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO auth provider.

Overview

PowerNukkit Ore to Discourse Auth Gateway

This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO auth provider.

This app does not hold any state and don't store any data, all it does is to convert HTTP requests from Ore to Discourse and vice-versa.

Setup

Ore

  1. Edit the Ore settings file Ore/ore/conf/ore-default-settings.conf in the folder where you installed Ore
  2. Inside the auth block set a secure secret at sso ➡️ secret, this will be your --auth-sso-api-key
  3. Inside the auth api set the url where this app will be running at url, this will be your --base-url
  4. (Optional) Inside the auth api set the avatar-url to https://{domain-of-your-discourse-forum}/user_avatar/{domain-of-your-discourse-forum}/%s/120/1.png replacing {domain-of-your-discourse-forum} with the domain of your discourse forum, note that it appears twice in the URL.

Discourse

  1. Go to your Discourse Admin Panel ➡️ Settings ➡️ Login
  2. Enable enable discourse connect provider (Please don't confuse with enable discourse connect, the setting ends with provider)
  3. Add the host where this app will be running and a random and secure SSO secret key of your choice to the discourse connect provider secrets settings, this will be your --discourse-sso-secret parameter
  4. Go to Discourse Admin Panel ➡️ Customise ➡️ Themes and repeat the next steps for each enabled theme that you have.
  5. Click on the theme name, then on the Edit CSS/HTML
  6. Add this to the end of the tab:
    ">
     <link rel="stylesheet" href="//code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css">
  7. Add this to the end of the tab (note: You can customise the content of the logging-out-dialog as you wish, the animation colors can be changed, just search for fill= inside the svg tag) ">
    <div id="logging-out-dialog" title="Please wait..." style="display: none">
    
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#fff;display:block;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
            <g transform="translate(50 50)">  <g transform="translate(-19 -19) scale(0.6)"> <g>
            <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.2s" begin="0s" repeatCount="indefinite">animateTransform><path d="M31.35997276079435 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 L37.3496987939662 -6.999999999999995 L47.3496987939662 -6.999999999999997 L47.349698793966205 6.999999999999973 L37.349698793966205 6.999999999999976 A38 38 0 0 1 31.359972760794346 21.460477824182682 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#1babfa">path>g>g> <g transform="translate(19 19) scale(0.6)"> <g>
            <animateTransform attributeName="transform" type="rotate" values="45;0" keyTimes="0;1" dur="0.2s" begin="-0.1s" repeatCount="indefinite">animateTransform><path d="M-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 L37.3496987939662 -6.999999999999995 L47.3496987939662 -6.999999999999997 L47.349698793966205 6.999999999999973 L37.349698793966205 6.999999999999976 A38 38 0 0 1 31.359972760794346 21.460477824182682 L31.359972760794346 21.460477824182682 L38.431040572659825 28.531545636048154 L28.531545636048183 38.4310405726598 L21.460477824182703 31.35997276079433 A38 38 0 0 1 6.9999999999999964 37.3496987939662 L6.9999999999999964 37.3496987939662 L6.999999999999995 47.3496987939662 L-7.000000000000009 47.3496987939662 L-7.000000000000007 37.3496987939662 A38 38 0 0 1 -21.46047782418263 31.359972760794385 L-21.46047782418263 31.359972760794385 L-28.531545636048094 38.43104057265987 L-38.431040572659796 28.531545636048186 L-31.359972760794328 21.460477824182703 A38 38 0 0 1 -37.34969879396619 7.000000000000032 L-37.34969879396619 7.000000000000032 L-47.34969879396619 7.0000000000000355 L-47.3496987939662 -7.000000000000002 L-37.3496987939662 -7.000000000000005 A38 38 0 0 1 -31.359972760794346 -21.460477824182682 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#ac384d">path>g>g>g>
        svg>
        <p align="center">
            Logging out...
        p>
    
    
    div>
    
    <script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js">script>
    <script>
        $( "#logging-out-dialog" ).dialog({
            autoOpen: false,
            modal: true,
            closeOnEscape:false,
            open: function(event, ui) {
                $(".ui-dialog-titlebar-close", $(this).parent()).hide();
            }
        });
        if(window.location.hash=='#action--ore-logout'){
            $(function(){
                $( "#logging-out-dialog" ).dialog( "open" );
                let user = $("#current-user > a").attr("title");
                $.ajax({
                    url: '/session/' + user,
                    type: 'DELETE',
                    success: function(result) {
                        const params = new Proxy(new URLSearchParams(window.location.search), {
                          get: (searchParams, prop) => searchParams.get(prop),
                        });
                        let referer = params.referer;
                        if (!referer) {
                            // Change to your fallback url
                            referer = 'https://your.ore.domain.example.com/';
                        }
                        document.location = referer;
                    }
                });
            });
        }
    script>

This App

Now you just need to run this app, you can build a single jar, build a dist-zip, or just use gradlew run, I'm going to use gradlew run here because it's easier.

  1. Download this repository
  2. Open the folder with your favorite terminal (PowerShell, CMD, Konsole, gnome-terminal, xTerm, etc)
  3. Run ./gradlew run --args="-h" to learn your options, you can also set the parameters using environment, for example you can set an environment parameter named DISCOURSE_URL instead of passing it as --discourse-url or -du directly.
  4. Call again but instead of -h fill the arguments with real data, and you will be good to go after you get a log saying Application started.

License

This software is provided without any warranty under the GNU Affero General Public License version 3.0 or higher

You might also like...
Demo Spting REST Service on Kotlin. Works with PostgreSQL via Spring Data. Data initialization provided by liquibase

Spring Boot REST API with Kotlin Spring Boot REST API service. Spring Data with PostgreSQL. Data initialization with Liquibase. Swagger UI Reference D

AppD-Task1 - A simple basic app with use of card view and toast
AppD-Task1 - A simple basic app with use of card view and toast

AppD-Task1 Made a simple basic app with use of card view and toast. Screenshots

A simple Kotlin class to use to connect to a MongoDB collection.
A simple Kotlin class to use to connect to a MongoDB collection.

mongodb-kotlin A simple Kotlin class to use to connect to a MongoDB collection. Once you have created a MongoDB project, choose Build a Database: Next

Simple use of Micronaut + Kotlin, implementation of UserContext

Micronaut 3.1.4 Documentation User Guide API Reference Configuration Reference Micronaut Guides Feature jdbc-hikari documentation Micronaut Hikari JDB

Showify is a my first simple ✅ Android application 📱 using DI, where I learn how to use dagger-hilt, retrofit2, mvvm, livedata, Requestly Interceptor
Showify is a my first simple ✅ Android application 📱 using DI, where I learn how to use dagger-hilt, retrofit2, mvvm, livedata, Requestly Interceptor

Showify is a my first simple ✅ Android application 📱 using DI, where I learn how to use dagger-hilt, retrofit2, mvvm, livedata, Requestly Interceptor and so much more...

🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

A tip app which the user can use a screen bar to choose a tip based on the service, the total is then displayed.

Tip Calculator Spencer Damon Tippy Total computes the tip and total amount for a bill. The app uses the base amount and tip percentage to calculate th

Use Android Jetpack libraries, Android Architecture Components, ViewModel and LiveData to build this app.

Unscramble App Starter code for Android Basics codelab - Store the data in a ViewModel Unscramble is a single player game app that displays scrambled

📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT 🖊️ NotyKT is the complete Kotlin-stack note taking 🖊️ application 📱 built to demonstrate a use of Kotlin programming language in server-side

Owner
The Nukkit you know but Powerful!
null
Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It will be based on a privacy friendly WebKit engine fork.

Candroid Browser Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It wil

Sean P. Myrick V19.1.7.2 3 Dec 22, 2022
Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Candroid app store, try visiting the Candroid Market.

Candroid App Store Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Ca

Sean P. Myrick V19.1.7.2 4 Dec 22, 2022
Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.

Kata Maxibon for Kotlin. We are here to practice property based testing. We are going to use KotlinTest to write our tests. We are going to practice p

Karumi 44 Oct 3, 2022
KataContacts written in Kotlin. The main goal is to practice Clean Architecture Development

KataContacts written in Kotlin We are here to practice Clean Architecture Development. Clean Architecture is a way of structuring code. We are going t

Karumi 48 Oct 3, 2022
TODO API Client Kata for Kotlin Developers. The main goal is to practice integration testing using MockWebServer

KataTODOApiClient for Kotlin We are here to practice integration testsing using HTTP stubbing. We are going to use MockWebServer to simulate a HTTP se

Karumi 61 Nov 20, 2022
Screenshot Kata for Android Developers with Kotlin. The main goal is to practice UI Screenshot Testing.

KataScreenshot in Kotlin We are here to practice UI testing using screenshot tests for Android. We are going to use Espresso to interact with the Appl

Karumi 76 Nov 20, 2022
Super Heroes Kata for Android Developers in Kotlin. The main goal is to practice UI Testing.

KataSuperHeroes in Kotlin We are here to practice UI Testing. We are going to use Espresso to interact with the Application UI. We are going to use Ko

Karumi 86 Nov 20, 2022
Integration Testing Kotlin Multiplatform Kata for Kotlin Developers. The main goal is to practice integration testing using Ktor and Ktor Client Mock

This kata is a Kotlin multiplatform version of the kata KataTODOApiClientKotlin of Karumi. We are here to practice integration testing using HTTP stub

Jorge Sánchez Fernández 29 Oct 3, 2022
The home of the amigo-platform which serves as the main service for the amigo multimedia platform

amigo-platform This is the home of the amigo-platform which serves as the main service for the amigo multimedia platform. Authentication with JWT Toke

null 1 Nov 22, 2021