Skip to content
This repository has been archived by the owner on Mar 5, 2018. It is now read-only.

REST service sample that protected by Spring OAuth 2

Notifications You must be signed in to change notification settings

war-and-code/spring-rest-api-security-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-micro-services-boilerplate

中文版

Index

spring-micro-services-boilerplate is a boilerplate which is very helpful for java programmer and friendly to front end.

And build with:

And use specification-arg-resolver for filter.

NOTE If you need RSA sign check, you can use validateWithSignCheck of ValidateHelper

Build and Run [TOP]

$ cd <spring-micro-services-boilerplate root path>
$ ./gradlew clean build bootRun

NOTICE [TOP]

  • Validate failed -> Response http status is 422(Unprocessable Entity)
  • Server error -> Response http status is 500(Internal Server Error)

Usage [TOP]

Step 1: Import the init.sql to your database, I suggest you to use PostgreSQL [TOP]

Step 2: Access resources with Swagger. [TOP]

Run it, Open your browser and access http://localhost:8080/swagger-ui.html#/.

NOTE Default port is 8080, you can modify it which key is server.port in application.yml.

and then:

You can test API by the tips.

  1. Get access_token and refresh_token with login API. and result is:
  2. Or get new access_token with refresh_token.
  3. Access users. and result is:

Deploy [TOP]

  1. Build war and use tomcat.
  2. Build jar and run java -jar foo.jar
  3. Use Docker. You can build your docker image by Dockerfile. And run it with docker-compose.yml.

License [TOP]

MIT

Copyright (c) since 2015 saintdan

Version History [TOP]

Version history is here. ;)

About

REST service sample that protected by Spring OAuth 2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%