GithubHelp home page GithubHelp logo

hugheba / spring-grails-oauth2-sso Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 270 KB

Example SSO across SpringBoot and Grails apps authenticating against Wordpress

Groovy 32.32% HTML 1.45% Shell 8.42% PHP 1.59% JavaScript 0.97% CSS 51.75% Batchfile 3.51%
spring-boot springboot grails3 wordpress oauth2 sso

spring-grails-oauth2-sso's Introduction

sso-demo

This project is a demo of SSO across a Spring and Grails application authenticating against Wordpress.

Start Wordpress

The Wordpress installation is a simple self-contained Docker container.

Prerequisites

Wordpress Docker

The project contains preconfigured Docker resources for a Wordpress LAMP container.

Use docker-compose to start the container from the ./sso-wordpress

In a terminal, start the Wordpress Docker container with the following command:

docker-compose up -d

You should be able to reach the Wordpress installation from the browser at http://localhost:8091.

You can login with the username/password admin and admin.

Configure Wordpress oAuth2 Server Manually

Setup Wordpress with a new user and download and install the following plugins:

In the Wordpress Oauth Server settings, create a new clients1, one for Spring and one for Grails, and copy their clientId and secret to the respect conf files for the projects:

For the Spring client use:

Client Name:        Spring
Redirect URI:       http://localhost:8092/login
Client Description: Spring Project

Update the Spring project config file sso-demo/src/main/resources/application.yml, setting security.oauth.client[clientId,clientSecret]

And for the Grails client use:

Client Name:        Grails
Redirect URI:       http://localhost:8093/login
Client Description: Grails Project

Update the Grails project config file sso-grails-demo/grails-app/application.yml, setting org.grails.springsecurity.oauth.providers[clientId,clientSecret]

You'll also need to update the Wordpress settings for permalinks at Admin -> Settings -> Permalinks -> Common Settings and choose Post name and Save.

1 Unregisted version of the WP OAuth Server allows only one client at a time, so you'll have to toggle between the two to test. Be sure to update the new clientID and clientSecret. You may also just boot one application up at the same time and use port 8092 for both.

Start SpringBoot

Start the SpringBoot application in a new terminal with the following command:

./gradlew :sso-demo:bootRun

You should now be able to browse the SpringBoot application at http://localhost:8092.

Start Grails

Start the Grails application in a new terminal with the following command:

./gradlew :sso-grails-demo:bootRun

You should now be able to browse the Grails application at http://localhost:8093.

Usage

At the / (root) of each of the applications (SpringBoot and Grails) there should be a page with a login button.

Clicking the button will take you to a secured page in the application.

If you have not authenticated you will be redirected to the Wordpress site to login, otherwise you will be automatically logged in and your username will appear in the secured welcome page.

spring-grails-oauth2-sso's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.