项目作者: aldwindelgado

项目描述 :
Sample standalone OAuth2 resource server using Spring Boot
高级语言: Java
项目地址: git://github.com/aldwindelgado/spring-boot-oauth2-client.git
创建时间: 2017-08-30T07:50:03Z
项目社区:https://github.com/aldwindelgado/spring-boot-oauth2-client

开源协议:

下载


Sample standalone OAuth2 resource server for Spring Boot (Client)

The requesting method for token supports both json format and url-encoded format

The token validity is currently 60secs.

Update any of the clienId/clientPassword/tokenValidity to however you want.

Other implementations

Running

  1. mvn clean package spring-boot:run

Request for a token

Use any of the curl commands to request an access token.

Using URL-Encoded Format

  1. curl -X POST -H "Authorization: Basic YWNjb3VudDpwYXNzd29yZA==" -H "Content-Type: application/x-www-form-urlencoded" -v localhost:8080/oauth/token?grant_type=client_credentials

Using JSON Format

  1. curl -X POST -H "Authorization: Basic YWNjb3VudDpwYXNzd29yZA==" -H "Content-Type: application/json" -d '{ "grant_type": "client_credentials" }' -v localhost:8080/oauth/token

Using token to protected resource

  1. curl -H "Authorization: Bearer <access token>" -v localhost:8081

Authorization Server

See spring-boot-oauth2-server for running the oauth-server (authorization server)