Giter Club home page Giter Club logo

springbootauthentication's Introduction

SpringBoot Auth demo REST APIs with GCP AppEngine

This project demonstrates how to use SpringBoot JWT token to secure your REST APIs

It also showcase how we can use springfox-swagger2 to document APIs

To use the code:
Refer to google documentation to create a cloud sql instance: https://cloud.google.com/sql/docs/mysql/create-instance

git clone [email protected]:abharku/SpringBootAuthentication.git

Update SpringBootAuthentication/src/main/resources/application.properties from cloud sql instance you have created

spring.cloud.gcp.sql.instance-connection-name.

spring.cloud.gcp.sql.database-name.

spring.datasource.username.

spring.datasource.password

Replace following properties in pom.xml in appengine-maven-plugin section

project-id

GCLOUD_SDK_PATH

How to setup GCP CLOUD SDK is explained at https://cloud.google.com/sdk/docs/install

To deploy to Appengine run below mvn command:

clean install appengine:deploy

Assuming that SDK is setup properly. If you want to run locally then make sure following environment variable is setup and pointing to a credential json file:

GOOGLE_APPLICATION_CREDENTIALS.

Use the token received from signin/Signup method and click the Authorize button on Swagger-ui

In the text box add

Bearer token (Replace token with token received)

After this you will be able to access get api/v1/users/{int} method which is the only method secured by auth header

A running version of the code is available below:

http://spring-demo-dot-starfish-k8s.nw.r.appspot.com/swagger-ui.html

springbootauthentication's People

Contributors

abharku avatar

Watchers

James Cloos 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.