Git Product home page Git Product logo

okta-legacy-with-cloud-gateway-example's Introduction

Secure Legacy Applications with Spring Cloud Gateway

This repository contains examples of how to secure a "legacy" servlet application Spring Cloud Gateway.

This repository has two examples in it:

  • cloud-gateway - A basic Spring Cloud Gateway application that proxies and secures downstream requests
  • legacy-servlet-app - A simple servlet application.

Prerequisites: Java 8.

Spring Cloud Gateway Example

To install this example, run the following commands:

git clone https://github.com/oktadeveloper/okta-legacy-with-cloud-gateway-example.git
cd okta-legacy-with-cloud-gateway-example/cloud-gateway

Create a Web Application in Okta

Log in to your Okta Developer account (or sign up if you don't have an account).

  1. From the Applications page, choose Add Application.
  2. On the Create New Application page, select Web.
  3. Give your app a memorable name, add http://localhost:8080/login/oauth2/code/okta as a Login redirect URI, select Refresh Token (in addition to Authorization Code), and click Done.

Copy the issuer (found under API > Authorization Servers), client ID, and client secret into the src/main/resources/application.yml file of the cloud-gateway project.

okta:
  oauth2:
    issuer: https://{yourOktaDomain}/oauth2/default
    client-id=$clientId
    client-secret=$clientSecret

Then, run the project with: ./mvnw spring-boot:run

Legacy Servlet Application Example

In a seperate terminal window (in the same git repostiory as above) run:

cd legacy-servlet-app
./mvnw jetty:run -Dokta.oauth2.issuer=https://{yourOktaDomain}/oauth2/default

NOTE: the "issuer" must be the same in both projects.

Browse to http://localhost:8080 in an incognito/private window to login and view the user profile data.

Links

These examples uses the following open source libraries:

Help

Please post any questions as comments on the example's blog post, or on the Okta Developer Forums.

License

Apache 2.0, see LICENSE.

okta-legacy-with-cloud-gateway-example's People

Contributors

bdemers avatar lau-po avatar mraible 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.